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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
["4 3", "10 1"] | The first line will contain two integers n, k (1 ≤ n ≤ 50, 1 ≤ k ≤ min{1018, l} where l is the length of the Kyoya's list). | e03c6d3bb8cf9119530668765691a346 | //God & me // ya mahdi adrekni
#include <iostream>
#include <algorithm>
using namespace std;
long long int fib[112]={1,1},k;
int p[112],n;
int main(){
for(int i=2;i<=85;i++)
fib[i]=fib[i-1]+fib[i-2];
cin>>n>>k;
for(int i=0;i<n;i++)
p[i]=i;
//int L=0;
while(k>0){//timed in test 5 :( maby for this.
... | ["1 3 2 4", "1 2 3 4 5 6 7 8 9 10"] | C++ | NoteThe standard cycle representation is (1)(32)(4), which after removing parenthesis gives us the original permutation. The first permutation on the list would be [1, 2, 3, 4], while the second permutation would be [1, 2, 4, 3]. | Print n space-separated integers, representing the permutation that is the answer for the question. | Let's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 and so on.Kyota Ootori has just learned about cyclic representation of a permutation. A cycle is a s... | [{"input": "4 3\r\n", "output": ["1 3 2 4"]}, {"input": "10 1\r\n", "output": ["1 2 3 4 5 6 7 8 9 10"]}, {"input": "1 1\r\n", "output": ["1"]}, {"input": "50 1\r\n", "output": ["1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50"]... | 100 | 100 | 100 | [{'input': '7 20\r\n', 'output': ['2 1 4 3 5 7 6']}, {'input': '27 298209\r\n', 'output': ['2 1 4 3 5 7 6 9 8 10 12 11 14 13 15 16 17 19 18 21 20 22 24 23 25 27 26']}, {'input': '24 47430\r\n', 'output': ['2 1 3 4 5 6 7 8 10 9 11 12 13 14 16 15 17 19 18 21 20 22 24 23']}, {'input': '25 58467\r\n', 'output': ['1 3 2 4 6... | [{'input': '50 5608642004\r\n', 'output': ['1 2 4 3 5 6 8 7 9 10 11 13 12 15 14 17 16 18 20 19 22 21 23 24 25 26 28 27 30 29 31 32 33 34 35 36 38 37 40 39 42 41 44 43 45 46 47 48 50 49']}, {'input': '9 1\r\n', 'output': ['1 2 3 4 5 6 7 8 9']}, {'input': '50 1\r\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... | [{'input': '10 89\r\n', 'output': ['2 1 4 3 6 5 8 7 10 9']}, {'input': '30 582773\r\n', 'output': ['1 3 2 4 5 6 8 7 10 9 11 13 12 14 15 16 17 19 18 20 21 23 22 25 24 26 28 27 29 30']}, {'input': '41 130268954\r\n', 'output': ['1 3 2 4 6 5 7 8 10 9 11 12 13 14 16 15 17 19 18 20 21 23 22 25 24 26 27 28 30 29 31 32 34 33 ... | [{'input': '26 168988\r\n', 'output': ['2 1 4 3 5 6 7 8 9 10 12 11 13 15 14 16 17 18 19 20 21 23 22 24 26 25']}, {'input': '36 7074882\r\n', 'output': ['1 2 4 3 5 7 6 8 9 10 11 12 13 14 16 15 18 17 19 20 22 21 23 25 24 26 27 28 30 29 32 31 33 34 35 36']}, {'input': '33 1811927\r\n', 'output': ['1 2 4 3 5 7 6 9 8 10 11 ... | [{'input': '26 168988\r\n', 'output': ['2 1 4 3 5 6 7 8 9 10 12 11 13 15 14 16 17 18 19 20 21 23 22 24 26 25']}, {'input': '46 1176411936\r\n', 'output': ['1 3 2 4 5 6 7 8 10 9 11 12 13 14 16 15 17 18 19 21 20 22 23 25 24 27 26 29 28 31 30 32 34 33 35 37 36 38 40 39 41 42 43 44 46 45']}, {'input': '50 20365011074\r\n',... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 101 | 100 | 100 | 100 |
["512 4", "1000000000 9"] | The first line of the input contains two integer numbers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^9$$$, $$$1 \le k \le 50$$$) — the number from which Tanya will subtract and the number of subtractions correspondingly. | 064162604284ce252b88050b4174ba55 | #include<bits/stdc++.h>
using namespace std;
long long a,b;
int main(void)
{
scanf("%d%d",&a,&b);
while(b--)if(a%10)a--;else a/=10;
printf("%lld",a);
return 0;
} | ["50", "1"] | C++ | NoteThe first example corresponds to the following sequence: $$$512 \rightarrow 511 \rightarrow 510 \rightarrow 51 \rightarrow 50$$$. | Print one integer number — the result of the decreasing $$$n$$$ by one $$$k$$$ times. It is guaranteed that the result will be positive integer number. | Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm: if the last digit of the number is non-zero, she decreases the number by one; if the last digit of the number is zero, she ... | [{"input": "512 4\r\n", "output": ["50"]}, {"input": "1000000000 9\r\n", "output": ["1"]}, {"input": "131203 11\r\n", "output": ["12"]}, {"input": "999999999 50\r\n", "output": ["9999"]}, {"input": "999999999 49\r\n", "output": ["99990"]}, {"input": "131203 9\r\n", "output": ["130"]}, {"input": "900000000 16\r\n", "out... | 100 | 100 | 100 | [{'input': '131203 11\r\n', 'output': ['12']}, {'input': '1000000000 9\r\n', 'output': ['1']}, {'input': '512 4\r\n', 'output': ['50']}, {'input': '2 1\r\n', 'output': ['1']}, {'input': '5 2\r\n', 'output': ['3']}] | [{'input': '999999999 50\r\n', 'output': ['9999']}, {'input': '131203 11\r\n', 'output': ['12']}, {'input': '900000000 16\r\n', 'output': ['1']}, {'input': '512 4\r\n', 'output': ['50']}, {'input': '909090909 50\r\n', 'output': ['3']}] | [{'input': '1000000000 9\r\n', 'output': ['1']}, {'input': '900000000 16\r\n', 'output': ['1']}, {'input': '1001 2\r\n', 'output': ['100']}, {'input': '5 2\r\n', 'output': ['3']}, {'input': '909090909 50\r\n', 'output': ['3']}] | [{'input': '2 1\r\n', 'output': ['1']}, {'input': '5 2\r\n', 'output': ['3']}, {'input': '131203 9\r\n', 'output': ['130']}, {'input': '1001 2\r\n', 'output': ['100']}, {'input': '512 4\r\n', 'output': ['50']}] | [{'input': '999999999 50\r\n', 'output': ['9999']}, {'input': '5 2\r\n', 'output': ['3']}, {'input': '131203 11\r\n', 'output': ['12']}, {'input': '1001 2\r\n', 'output': ['100']}, {'input': '909090909 50\r\n', 'output': ['3']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 102 | 100 | 100 | 100 |
["4 4 0\n2 1 2", "5 6 1\n2 7 2", "3 3 3\n2 2 2"] | The first line of the input contains three integers a, b and c (0 ≤ a, b, c ≤ 1 000 000) — the number of blue, violet and orange spheres that are in the magician's disposal. The second line of the input contains three integers, x, y and z (0 ≤ x, y, z ≤ 1 000 000) — the number of blue, violet and orange spheres that he... | 1db4ba9dc1000e26532bb73336cf12c3 | /////////////////////////////////////////////
///////////// YURKA PRO AZAZAZ //////////
///////////////////////////////////////////
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const long long INF = 1e9;
long long n,m,k,ans,sum,mn,pl;
long long ... | ["Yes", "No", "Yes"] | C++ | NoteIn the first sample the wizard has 4 blue and 4 violet spheres. In his first action he can turn two blue spheres into one violet one. After that he will have 2 blue and 5 violet spheres. Then he turns 4 violet spheres into 2 orange spheres and he ends up with 2 blue, 1 violet and 2 orange spheres, which is exactly ... | If the wizard is able to obtain the required numbers of spheres, print "Yes". Otherwise, print "No". | Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen before, he needs at least x blue, y violet and z orange spheres. Can he get them (possible, in multiple... | [{"input": "4 4 0\r\n2 1 2\r\n", "output": ["YES", "Yes"]}, {"input": "5 6 1\r\n2 7 2\r\n", "output": ["No", "NO"]}, {"input": "3 3 3\r\n2 2 2\r\n", "output": ["YES", "Yes"]}, {"input": "0 0 0\r\n0 0 0\r\n", "output": ["YES", "Yes"]}, {"input": "0 0 0\r\n0 0 1\r\n", "output": ["No", "NO"]}, {"input": "0 1 0\r\n0 0 0\r\... | 100 | 100 | 100 | [{'input': '4 0 4\r\n1 2 1\r\n', 'output': ['YES', 'Yes']}, {'input': '0 0 0\r\n0 0 0\r\n', 'output': ['YES', 'Yes']}, {'input': '100 100 100\r\n1 1 1\r\n', 'output': ['YES', 'Yes']}, {'input': '10 10 10\r\n1 1 1\r\n', 'output': ['YES', 'Yes']}, {'input': '225307 153572 114545\r\n154753 153282 149967\r\n', 'output': ['... | [{'input': '0 10 0\r\n2 2 2\r\n', 'output': ['YES', 'Yes']}, {'input': '0 2 4\r\n2 0 2\r\n', 'output': ['YES', 'Yes']}, {'input': '191789 291147 691092\r\n324321 416045 176232\r\n', 'output': ['YES', 'Yes']}, {'input': '3 3 3\r\n2 2 2\r\n', 'output': ['YES', 'Yes']}, {'input': '0 0 0\r\n0 0 1\r\n', 'output': ['No', 'NO... | [{'input': '14 9 8\r\n12 5 10\r\n', 'output': ['YES', 'Yes']}, {'input': '100 100 100\r\n1 1 1\r\n', 'output': ['YES', 'Yes']}, {'input': '1 2 4\r\n2 1 3\r\n', 'output': ['No', 'NO']}, {'input': '41 17 34\r\n0 19 24\r\n', 'output': ['YES', 'Yes']}, {'input': '0 9 0\r\n2 2 2\r\n', 'output': ['No', 'NO']}] | [{'input': '569950 228830 153718\r\n162186 357079 229352\r\n', 'output': ['No', 'NO']}, {'input': '7 7 1\r\n1 1 2\r\n', 'output': ['YES', 'Yes']}, {'input': '4 4 0\r\n1 1 3\r\n', 'output': ['No', 'NO']}, {'input': '4 4 0\r\n2 1 2\r\n', 'output': ['YES', 'Yes']}, {'input': '5 5 5\r\n1 1 1\r\n', 'output': ['YES', 'Yes']}... | [{'input': '9 0 9\r\n0 8 0\r\n', 'output': ['YES', 'Yes']}, {'input': '149416 303568 749016\r\n238307 493997 190377\r\n', 'output': ['No', 'NO']}, {'input': '136092 364927 395302\r\n149173 343146 390922\r\n', 'output': ['No', 'NO']}, {'input': '307075 152060 414033\r\n381653 222949 123101\r\n', 'output': ['No', 'NO']},... | 100 | 100 | 100 | 100 | 100 | 91.67 | 100 | 100 | 91.67 | 91.67 | 87.5 | 100 | 100 | 87.5 | 87.5 | 103 | 100 | 95.002 | 92.5 |
["1", "2", "3"] | The first line contains a single integer n (1 ≤ n ≤ 40). | c2cbc35012c6ff7ab0d6899e6015e4e7 | //Tornike Mandzulashvili
//#pragma comment(linker, "/STACK:16777216")
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <iostream>
#include <set>
#define PI 3.14159265
#define hash1 1000003
#define... | ["1", "3", "15"] | C++ | null | Print a single integer — the number zn modulo 1000000007 (109 + 7). It is guaranteed that the answer exists. | Consider the following equation: where sign [a] represents the integer part of number a.Let's find all integer z (z > 0), for which this equation is unsolvable in positive integers. The phrase "unsolvable in positive integers" means that there are no such positive integers x and y (x, y > 0), for which the given... | [{"input": "1\r\n", "output": ["1"]}, {"input": "2\r\n", "output": ["3"]}, {"input": "3\r\n", "output": ["15"]}, {"input": "4\r\n", "output": ["63"]}, {"input": "5\r\n", "output": ["4095"]}, {"input": "6\r\n", "output": ["65535"]}, {"input": "7\r\n", "output": ["262143"]}, {"input": "8\r\n", "output": ["73741816"]}, {"... | 100 | 100 | 100 | [{'input': '7\r\n', 'output': ['262143']}, {'input': '3\r\n', 'output': ['15']}, {'input': '26\r\n', 'output': ['642578561']}, {'input': '37\r\n', 'output': ['876153853']}, {'input': '32\r\n', 'output': ['389339971']}] | [{'input': '12\r\n', 'output': ['319908070']}, {'input': '2\r\n', 'output': ['3']}, {'input': '33\r\n', 'output': ['848994100']}, {'input': '36\r\n', 'output': ['411696552']}, {'input': '3\r\n', 'output': ['15']}] | [{'input': '30\r\n', 'output': ['287292016']}, {'input': '21\r\n', 'output': ['910358878']}, {'input': '28\r\n', 'output': ['485739298']}, {'input': '11\r\n', 'output': ['487761805']}, {'input': '1\r\n', 'output': ['1']}] | [{'input': '25\r\n', 'output': ['470083777']}, {'input': '34\r\n', 'output': ['273206869']}, {'input': '1\r\n', 'output': ['1']}, {'input': '18\r\n', 'output': ['110940209']}, {'input': '30\r\n', 'output': ['287292016']}] | [{'input': '37\r\n', 'output': ['876153853']}, {'input': '2\r\n', 'output': ['3']}, {'input': '15\r\n', 'output': ['317758023']}, {'input': '24\r\n', 'output': ['923450985']}, {'input': '10\r\n', 'output': ['140130950']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 104 | 100 | 100 | 100 |
["1 3", "2 2"] | The first line contains two integers $$$n$$$ and $$$m$$$, separated by spaces ($$$1 \leq n,m \leq 10^9$$$) — the number of kinds of presents and the number of boxes that Alice has. | 71029e5bf085b0f5f39d1835eb801891 | #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<set>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;
const ll p = 1e9 + 7;
ll n,m,ans;
ll qp(ll a,ll b){
ll ans = 1,base = a;
while(b != 0){
if(b & 1)ans = ans * base % p;
base = base * b... | ["7", "9"] | C++ | NoteIn the first example, there are seven ways to pack presents:$$$\{1\}\{\}\{\}$$$$$$\{\}\{1\}\{\}$$$$$$\{\}\{\}\{1\}$$$$$$\{1\}\{1\}\{\}$$$$$$\{\}\{1\}\{1\}$$$$$$\{1\}\{\}\{1\}$$$$$$\{1\}\{1\}\{1\}$$$In the second example there are nine ways to pack presents:$$$\{\}\{1,2\}$$$$$$\{1\}\{2\}$$$$$$\{1\}\{1,2\}$$$$$$\{2\}... | Print one integer — the number of ways to pack the presents with Alice's rules, calculated by modulo $$$10^9+7$$$ | Alice got many presents these days. So she decided to pack them into boxes and send them to her friends.There are $$$n$$$ kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gifts of the same kind). Presents of different kinds are different (i.e. that is, two gifts of differen... | [{"input": "1 3\r\n", "output": ["7"]}, {"input": "2 2\r\n", "output": ["9"]}, {"input": "1000000000 1000000000\r\n", "output": ["751201557"]}, {"input": "489132389 96\r\n", "output": ["496937"]}, {"input": "462817723 208\r\n", "output": ["886407548"]}, {"input": "10 415749054\r\n", "output": ["763222305"]}, {"input": ... | 100 | 100 | 100 | [{'input': '686898624 980111485\r\n', 'output': ['805355123']}, {'input': '565315457 718194150\r\n', 'output': ['180672585']}, {'input': '184 7\r\n', 'output': ['715075794']}, {'input': '1046 34\r\n', 'output': ['92349932']}, {'input': '807153816 542148359\r\n', 'output': ['452817189']}] | [{'input': '732 137\r\n', 'output': ['596791767']}, {'input': '635994662 423804127\r\n', 'output': ['831152709']}, {'input': '1 3\r\n', 'output': ['7']}, {'input': '943226362 45\r\n', 'output': ['326355794']}, {'input': '53 710974288\r\n', 'output': ['739543572']}] | [{'input': '1 1000000000\r\n', 'output': ['140625000']}, {'input': '67 445057511\r\n', 'output': ['687331027']}, {'input': '214 70\r\n', 'output': ['57768876']}, {'input': '39 884188112\r\n', 'output': ['485799965']}, {'input': '900 32\r\n', 'output': ['832035237']}] | [{'input': '117909304 588342759\r\n', 'output': ['852741659']}, {'input': '411520242 339446102\r\n', 'output': ['69858832']}, {'input': '67 445057511\r\n', 'output': ['687331027']}, {'input': '199108316 823003436\r\n', 'output': ['650559775']}, {'input': '156 342\r\n', 'output': ['306076272']}] | [{'input': '100 474\r\n', 'output': ['180274936']}, {'input': '943226362 45\r\n', 'output': ['326355794']}, {'input': '607778684 18\r\n', 'output': ['241523454']}, {'input': '651139198 572383165\r\n', 'output': ['362206900']}, {'input': '483378560 249\r\n', 'output': ['400296687']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 105 | 100 | 100 | 100 |
["6\n1 5 5 5 4 2", "5\n10 20 30 20 10", "4\n1 2 1 2", "7\n3 3 3 3 3 3 3"] | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 1 000) — the elements of the array. | 5482ed8ad02ac32d28c3888299bf3658 | #include<iostream>
using namespace std;
int i,x,y,n,f,ff;
int main(){
f=0;
cin>>n;
cin>>y;
for(i=2;i<=n;i++){
cin>>x;
if(x>y)ff=0;
if(x==y)ff=1;
if(x<y)ff=2;
if(ff<f){
cout<<"NO";
return 0;
}
f=ff;
y=x;
}
cou... | ["YES", "YES", "NO", "YES"] | C++ | NoteIn the first example the array is unimodal, because it is strictly increasing in the beginning (from position 1 to position 2, inclusively), that it is constant (from position 2 to position 4, inclusively) and then it is strictly decreasing (from position 4 to position 6, inclusively). | Print "YES" if the given array is unimodal. Otherwise, print "NO". You can output each letter in any case (upper or lower). | Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is constant; after that it is strictly decreasing. The first block (increasing) and the last block (decreasing) may be absent. It is allowed that both of this blocks are absent.For example, the following three arrays are uni... | [{"input": "6\r\n1 5 5 5 4 2\r\n", "output": ["YES"]}, {"input": "5\r\n10 20 30 20 10\r\n", "output": ["YES"]}, {"input": "4\r\n1 2 1 2\r\n", "output": ["NO"]}, {"input": "7\r\n3 3 3 3 3 3 3\r\n", "output": ["YES"]}, {"input": "6\r\n5 7 11 11 2 1\r\n", "output": ["YES"]}, {"input": "1\r\n7\r\n", "output": ["YES"]}, {"i... | 100 | 100 | 100 | [{'input': '4\r\n3 3 2 2\r\n', 'output': ['NO']}, {'input': '5\r\n1 2 1 2 1\r\n', 'output': ['NO']}, {'input': '4\r\n5 4 3 2\r\n', 'output': ['YES']}, {'input': '100\r\n191 196 201 202 207 212 216 219 220 222 224 227 230 231 234 235 238 242 246 250 253 254 259 260 263 267 269 272 277 280 284 287 288 290 295 297 300 305... | [{'input': '3\r\n2 1 2\r\n', 'output': ['NO']}, {'input': '2\r\n5 4\r\n', 'output': ['YES']}, {'input': '3\r\n4 3 3\r\n', 'output': ['NO']}, {'input': '8\r\n4 4 4 4 5 6 7 8\r\n', 'output': ['NO']}, {'input': '100\r\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000... | [{'input': '4\r\n2 2 1 1\r\n', 'output': ['NO']}, {'input': '5\r\n1 2 3 2 2\r\n', 'output': ['NO']}, {'input': '6\r\n3 3 1 2 2 1\r\n', 'output': ['NO']}, {'input': '2\r\n4 2\r\n', 'output': ['YES']}, {'input': '3\r\n4 3 3\r\n', 'output': ['NO']}] | [{'input': '4\r\n3 3 1 1\r\n', 'output': ['NO']}, {'input': '70\r\n290 292 294 297 299 300 303 305 310 312 313 315 319 320 325 327 328 333 337 339 340 341 345 350 351 354 359 364 367 372 374 379 381 382 383 384 389 393 395 397 398 400 402 405 409 411 416 417 422 424 429 430 434 435 440 442 445 449 451 453 458 460 465 4... | [{'input': '2\r\n2 1\r\n', 'output': ['YES']}, {'input': '100\r\n395 399 402 403 405 408 413 415 419 424 426 431 434 436 439 444 447 448 449 454 457 459 461 462 463 464 465 469 470 473 477 480 482 484 485 487 492 494 496 32 501 504 505 508 511 506 505 503 500 499 494 490 488 486 484 481 479 474 472 471 470 465 462 458 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 106 | 100 | 100 | 100 |
["1\n0 0 0 0 0 0 0 0 0 1", "2\n1 1 0 0 0 0 0 0 0 0", "3\n1 1 0 0 0 0 0 0 0 0"] | The first line contains integer n (1 ≤ n ≤ 100). The next line contains 10 integers a[0], a[1], ..., a[9] (0 ≤ a[i] ≤ 100) — elements of array a. The numbers are separated by spaces. | c1b5169a5c3b1bd4a2f1df1069ee7755 | //#include<fstream>
#include <vector>
#include <iostream>
using namespace std;
int n,i,j,a[11],m=1e9+7,ans=0;
long long c[211][211],F[211][11];
int f(int n, int t)
{
if (t==9)
return 1;
if (F[n][t]!=-1) return F[n][t];
int s=0,i;
long long ans1=0;
for(i=t;i<10;i++)
s+=a[i];
for(i=a[t];i+s-a[t]<=n;i++)
if (t... | ["1", "1", "36"] | C++ | NoteIn the first sample number 9 meets the requirements.In the second sample number 10 meets the requirements.In the third sample numbers 10, 110, 210, 120, 103 meet the requirements. There are other suitable numbers, 36 in total. | On a single line print the remainder of dividing the answer to the problem by 1000000007 (109 + 7). | Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his problems, the one Furik gave to Rubik. And Rubik asks you to solve it.There is integer n and array a, consisting of ten integers, indexed by numbers from 0 to 9. Your task is to count the number of positive int... | [{"input": "1\r\n0 0 0 0 0 0 0 0 0 1\r\n", "output": ["1"]}, {"input": "2\r\n1 1 0 0 0 0 0 0 0 0\r\n", "output": ["1"]}, {"input": "3\r\n1 1 0 0 0 0 0 0 0 0\r\n", "output": ["36"]}, {"input": "4\r\n0 1 0 1 2 0 0 0 0 0\r\n", "output": ["12"]}, {"input": "5\r\n2 1 2 0 0 0 0 0 0 0\r\n", "output": ["18"]}, {"input": "6\r\n... | 100 | 100 | 100 | [{'input': '100\r\n0 0 68 0 18 14 0 0 0 0\r\n', 'output': ['31893604']}, {'input': '10\r\n2 0 0 1 0 2 0 1 1 0\r\n', 'output': ['46501116']}, {'input': '100\r\n0 100 0 0 0 0 0 0 0 0\r\n', 'output': ['1']}, {'input': '100\r\n2 2 2 3 2 3 2 3 1 2\r\n', 'output': ['962893731']}, {'input': '100\r\n5 18 12 0 0 2 15 0 8 40\r\n... | [{'input': '6\r\n1 1 1 1 1 1 0 0 0 0\r\n', 'output': ['600']}, {'input': '100\r\n5 18 12 5 28 2 15 20 12 40\r\n', 'output': ['0']}, {'input': '6\r\n0 1 0 1 1 0 0 0 1 0\r\n', 'output': ['23160']}, {'input': '100\r\n3 1 3 3 1 2 3 2 0 2\r\n', 'output': ['230289012']}, {'input': '8\r\n1 0 1 0 1 1 2 2 0 0\r\n', 'output': ['... | [{'input': '100\r\n31 0 27 15 7 9 5 0 0 6\r\n', 'output': ['338317227']}, {'input': '100\r\n1 2 1 3 2 0 0 3 2 2\r\n', 'output': ['886460596']}, {'input': '76\r\n1 2 1 3 3 0 1 0 2 0\r\n', 'output': ['434673284']}, {'input': '14\r\n100 100 100 100 100 100 100 100 100 100\r\n', 'output': ['0']}, {'input': '100\r\n0 0 0 0 ... | [{'input': '100\r\n9 0 3 23 0 0 0 0 0 65\r\n', 'output': ['417270431']}, {'input': '10\r\n2 0 0 1 0 2 0 1 1 0\r\n', 'output': ['46501116']}, {'input': '8\r\n1 0 1 0 1 1 2 2 0 0\r\n', 'output': ['8820']}, {'input': '100\r\n15 16 10 9 11 7 18 14 0 0\r\n', 'output': ['657295203']}, {'input': '100\r\n50 0 0 0 0 50 0 0 0 0\... | [{'input': '100\r\n0 2 23 27 0 23 0 0 24 1\r\n', 'output': ['974134889']}, {'input': '100\r\n50 0 0 0 0 50 0 0 0 0\r\n', 'output': ['769496025']}, {'input': '4\r\n0 0 1 0 1 0 0 0 1 1\r\n', 'output': ['24']}, {'input': '6\r\n2 2 2 0 0 0 0 0 0 0\r\n', 'output': ['60']}, {'input': '46\r\n100 100 100 100 100 100 100 100 10... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 95.45 | 107 | 100 | 100 | 99.09 |
["100", "48", "521"] | The first line contains the positive integer x (1 ≤ x ≤ 1018) — the integer which Anton has. | e55b0debbf33c266091e6634494356b8 | #include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
using namespace std;
char s[32768];
char ans[32768];
int main() {
ios_base::sync_with_stdio(0);
cin.getline(s, sizeof(s));
int n = (int)strlen(s);
int def = 0;
for (int i = 0; i < n; i++) def += (int)(s[i] - '0');
int ret = def;
strc... | ["99", "48", "499"] | C++ | null | Print the positive integer which doesn't exceed x and has the maximum sum of digits. If there are several such integers, print the biggest of them. Printed integer must not contain leading zeros. | Anton has the integer x. He is interested what positive integer, which doesn't exceed x, has the maximum sum of digits.Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them. | [{"input": "100\r\n", "output": ["99"]}, {"input": "48\r\n", "output": ["48"]}, {"input": "521\r\n", "output": ["499"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "2\r\n", "output": ["2"]}, {"input": "3\r\n", "output": ["3"]}, {"input": "39188\r\n", "output": ["38999"]}, {"input": "5\r\n", "output": ["5"]}, {"inpu... | 100 | 100 | 100 | [{'input': '100000000000000\r\n', 'output': ['99999999999999']}, {'input': '271\r\n', 'output': ['199']}, {'input': '2599\r\n', 'output': ['1999']}, {'input': '10000000000\r\n', 'output': ['9999999999']}, {'input': '229\r\n', 'output': ['199']}] | [{'input': '218\r\n', 'output': ['199']}, {'input': '9999\r\n', 'output': ['9999']}, {'input': '9991919190909919\r\n', 'output': ['9989999999999999']}, {'input': '1890\r\n', 'output': ['999']}, {'input': '909999999999999999\r\n', 'output': ['899999999999999999']}] | [{'input': '2490\r\n', 'output': ['1999']}, {'input': '29652\r\n', 'output': ['28999']}, {'input': '199999999999999999\r\n', 'output': ['199999999999999999']}, {'input': '9879100000000099\r\n', 'output': ['8999999999999999']}, {'input': '999\r\n', 'output': ['999']}] | [{'input': '1500\r\n', 'output': ['999']}, {'input': '1809\r\n', 'output': ['999']}, {'input': '2099\r\n', 'output': ['1999']}, {'input': '2199\r\n', 'output': ['1999']}, {'input': '1000000000000000\r\n', 'output': ['999999999999999']}] | [{'input': '1390\r\n', 'output': ['999']}, {'input': '270\r\n', 'output': ['199']}, {'input': '129\r\n', 'output': ['99']}, {'input': '200\r\n', 'output': ['199']}, {'input': '151\r\n', 'output': ['99']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 100 | 100 | 108 | 100 | 100 | 98.572 |
["4 6", "10 1"] | The first and the only line of the input contains two distinct integers n and m (1 ≤ n, m ≤ 104), separated by a space . | 861f8edd2813d6d3a5ff7193a804486f | #include<iostream>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<iomanip>
#include<algorithm>
#include<cstdio>
using namespace std;
int ans,l,r;
int main()
{
cin>>l>>r;
while(l!=r)
{
if(l>r)
{
r++;
}
else
{
if(r&1)//奇数
{
r++;
}
else
{
... | ["2", "9"] | C++ | NoteIn the first example you need to push the blue button once, and then push the red button once.In the second example, doubling the number is unnecessary, so we need to push the blue button nine times. | Print a single number — the minimum number of times one needs to push the button required to get the number m out of number n. | Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking the blue button, device subtracts one from the number on the display. If at so... | [{"input": "4 6\r\n", "output": ["2"]}, {"input": "10 1\r\n", "output": ["9"]}, {"input": "1 2\r\n", "output": ["1"]}, {"input": "2 1\r\n", "output": ["1"]}, {"input": "1 3\r\n", "output": ["3"]}, {"input": "3 1\r\n", "output": ["2"]}, {"input": "2 10\r\n", "output": ["5"]}, {"input": "100 99\r\n", "output": ["1"]}, {"... | 100 | 100 | 100 | [{'input': '5001 10000\r\n', 'output': ['2']}, {'input': '1 9999\r\n', 'output': ['21']}, {'input': '10 1\r\n', 'output': ['9']}, {'input': '5555 10000\r\n', 'output': ['556']}, {'input': '4 6\r\n', 'output': ['2']}] | [{'input': '9967 9973\r\n', 'output': ['4982']}, {'input': '5000 10000\r\n', 'output': ['1']}, {'input': '7777 9999\r\n', 'output': ['2779']}, {'input': '4000 7997\r\n', 'output': ['3']}, {'input': '848 4561\r\n', 'output': ['283']}] | [{'input': '9997 9999\r\n', 'output': ['4999']}, {'input': '7777 9999\r\n', 'output': ['2779']}, {'input': '100 500\r\n', 'output': ['41']}, {'input': '6666 666\r\n', 'output': ['6000']}, {'input': '4 6\r\n', 'output': ['2']}] | [{'input': '4 6\r\n', 'output': ['2']}, {'input': '9997 9999\r\n', 'output': ['4999']}, {'input': '2 10000\r\n', 'output': ['19']}, {'input': '5000 10000\r\n', 'output': ['1']}, {'input': '10 1\r\n', 'output': ['9']}] | [{'input': '1 2\r\n', 'output': ['1']}, {'input': '3 10000\r\n', 'output': ['17']}, {'input': '2 100\r\n', 'output': ['9']}, {'input': '9912 1023\r\n', 'output': ['8889']}, {'input': '9102 9103\r\n', 'output': ['4552']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 109 | 100 | 100 | 100 |
["2 2", "4 3", "2020 2021"] | The only line contains two integers $$$n$$$, $$$m$$$ ($$$1\le n, m\le 2021$$$). | 1738dc65af1fffa445cb0c3074c6bedb | #include <bits/stdc++.h>
#define forn(i,s,t) for(register int i=(s);i<=(t);++i)
#define form(i,s,t) for(register int i=(s);i>=(t);--i)
using namespace std;
const int N = 2040, Mod = 998244353;
struct Mint {
int res;
Mint() {res = 0;}
Mint(int a) : res(a) {}
friend Mint operator + (Mint A, Mint B) {
retu... | ["2", "294", "50657649"] | C++ | NoteIn the first test case, these are the only two stupid $$$2\times 2$$$ colorings. | Output a single integer — the number of stupid colorings modulo $$$998244353$$$. | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Every cell of the grid should be colored either blue or yellow.A coloring of the grid is called stupid if every row has exactly one segment of blue cells and every column has exactly one segment of yellow cells.In other words, every row must have at least one blue ... | [{"input": "2 2\n", "output": ["2", "2\n", "2\n", "2 "]}, {"input": "4 3\n", "output": ["294 ", "294", "294\n", "294\n"]}, {"input": "2020 2021\n", "output": ["50657649", "50657649\n", "50657649\n"]}, {"input": "2021 2021\n", "output": ["138387540", "138387540\n", "138387540\n"]}, {"input": "2021 1\n", "output": ["0\n"... | 100 | 100 | 100 | [{'input': '4 2\n', 'output': ['30\n', '30\n', '30']}, {'input': '4 3\n', 'output': ['294 ', '294', '294\n', '294\n']}, {'input': '104 328\n', 'output': ['726939953\n', '726939953', '726939953\n']}, {'input': '10 19\n', 'output': ['272254938', '272254938\n', '272254938\n']}, {'input': '1 5\n', 'output': ['0\n', '0', '0... | [{'input': '5 5\n', 'output': ['29000\n', '29000', '29000\n']}, {'input': '7 7\n', 'output': ['8281392\n', '8281392\n', '8281392']}, {'input': '3 2\n', 'output': ['10\n', '10', '10\n']}, {'input': '5 1\n', 'output': ['0\n', '0', '0\n']}, {'input': '9 9\n', 'output': ['177198854\n', '177198854', '177198854\n']}] | [{'input': '4 5\n', 'output': ['6066', '6066\n', '6066\n']}, {'input': '1 5\n', 'output': ['0\n', '0', '0\n']}, {'input': '6 6\n', 'output': ['498764\n', '498764\n', '498764']}, {'input': '2020 2021\n', 'output': ['50657649', '50657649\n', '50657649\n']}, {'input': '2 5\n', 'output': ['70\n', '70\n', '70']}] | [{'input': '9 9\n', 'output': ['177198854\n', '177198854', '177198854\n']}, {'input': '4 2021\n', 'output': ['102125833\n', '102125833', '102125833\n']}, {'input': '4 1\n', 'output': ['0\n', '0', '0\n']}, {'input': '101 101\n', 'output': ['601990061', '601990061\n', '601990061\n']}, {'input': '4 5\n', 'output': ['6066'... | [{'input': '598 319\n', 'output': ['420237100\n', '420237100\n', '420237100']}, {'input': '2 5\n', 'output': ['70\n', '70\n', '70']}, {'input': '5 3\n', 'output': ['896\n', '896\n', '896']}, {'input': '1 5\n', 'output': ['0\n', '0', '0\n']}, {'input': '3 1\n', 'output': ['0\n', '0\n', '0']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 110 | 100 | 100 | 100 |
["3 222", "4 190", "7 1"] | The only line of the input contains two integers n and k (1 ≤ n ≤ 10, 1 ≤ k ≤ 240) — the number of the problems in the contest and the number of minutes Limak needs to get to the party from his house. | 41e554bc323857be7b8483ee358a35e2 | #include <bits/stdc++.h>
using namespace std;
long n, k, m, kq=0;
int main()
{
cin>>n>>k;
m=240-k;
for(int i=1;i<=n;i++)
{
if(m-(i*5)>=0) kq++;
else break;
m-= i*5;
}
cout<<kq;
}
| ["2", "4", "7"] | C++ | NoteIn the first sample, there are 3 problems and Limak needs 222 minutes to get to the party. The three problems require 5, 10 and 15 minutes respectively. Limak can spend 5 + 10 = 15 minutes to solve first two problems. Then, at 20:15 he can leave his house to get to the party at 23:57 (after 222 minutes). In this sc... | Print one integer, denoting the maximum possible number of problems Limak can solve so that he could get to the party at midnight or earlier. | Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be n problems, sorted by difficulty, i.e. problem 1 is the easiest and problem n is the hardest. Limak knows it will take him 5·i minutes to solve the i-th... | [{"input": "3 222\r\n", "output": ["2"]}, {"input": "4 190\r\n", "output": ["4"]}, {"input": "7 1\r\n", "output": ["7"]}, {"input": "10 135\r\n", "output": ["6"]}, {"input": "10 136\r\n", "output": ["5"]}, {"input": "1 1\r\n", "output": ["1"]}, {"input": "1 240\r\n", "output": ["0"]}, {"input": "10 1\r\n", "output": ["... | 100 | 100 | 100 | [{'input': '8 100\r\n', 'output': ['7']}, {'input': '3 239\r\n', 'output': ['0']}, {'input': '4 191\r\n', 'output': ['3']}, {'input': '10 164\r\n', 'output': ['5']}, {'input': '1 240\r\n', 'output': ['0']}] | [{'input': '4 100\r\n', 'output': ['4']}, {'input': '10 165\r\n', 'output': ['5']}, {'input': '10 88\r\n', 'output': ['7']}, {'input': '10 1\r\n', 'output': ['9']}, {'input': '4 190\r\n', 'output': ['4']}] | [{'input': '9 235\r\n', 'output': ['1']}, {'input': '9 236\r\n', 'output': ['0']}, {'input': '5 226\r\n', 'output': ['1']}, {'input': '10 2\r\n', 'output': ['9']}, {'input': '10 88\r\n', 'output': ['7']}] | [{'input': '10 1\r\n', 'output': ['9']}, {'input': '2 99\r\n', 'output': ['2']}, {'input': '10 164\r\n', 'output': ['5']}, {'input': '10 88\r\n', 'output': ['7']}, {'input': '9 170\r\n', 'output': ['4']}] | [{'input': '10 136\r\n', 'output': ['5']}, {'input': '3 239\r\n', 'output': ['0']}, {'input': '9 170\r\n', 'output': ['4']}, {'input': '8 61\r\n', 'output': ['7']}, {'input': '4 240\r\n', 'output': ['0']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 100 | 75 | 100 | 75 | 111 | 100 | 100 | 85 |
["5", "3"] | Input contains one integer number A (3 ≤ A ≤ 1000). | 1366732dddecba26db232d6ca8f35fdc | #include<bits/stdc++.h>
using namespace std;
long long int i,j=0,n,c,sum=0,x,a,b,f=0;
int base(int k,int l)
{
sum=0;
while(k!=0)
{
sum+=k%l;
k/=l;
}
return sum;
}
int gcd(int a,int b)
{
return(b==0?a:gcd(b,a%b));
}
int main()
{ f=0;
cin>>n;
for(i=2;i<n;i++)
f+=... | ["7/3", "2/1"] | C++ | NoteIn the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, 11. Sums of digits are 2, 3 and 2, respectively. | Output should contain required average value in format «X/Y», where X is the numerator and Y is the denominator. | Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.Now he wonders what is an average value of sum of digits of the number A written in all bases from 2 to A - 1.Note that all computation... | [{"input": "5\r\n", "output": ["7/3"]}, {"input": "3\r\n", "output": ["2/1"]}, {"input": "1000\r\n", "output": ["90132/499"]}, {"input": "927\r\n", "output": ["155449/925"]}, {"input": "260\r\n", "output": ["6265/129"]}, {"input": "131\r\n", "output": ["3370/129"]}, {"input": "386\r\n", "output": ["857/12"]}, {"input":... | 100 | 100 | 100 | [{'input': '331\r\n', 'output': ['20297/329']}, {'input': '309\r\n', 'output': ['17731/307']}, {'input': '251\r\n', 'output': ['11939/249']}, {'input': '305\r\n', 'output': ['17350/303']}, {'input': '984\r\n', 'output': ['174589/982']}] | [{'input': '258\r\n', 'output': ['12373/256']}, {'input': '514\r\n', 'output': ['6031/64']}, {'input': '537\r\n', 'output': ['52753/535']}, {'input': '474\r\n', 'output': ['20581/236']}, {'input': '604\r\n', 'output': ['33178/301']}] | [{'input': '28\r\n', 'output': ['85/13']}, {'input': '249\r\n', 'output': ['11659/247']}, {'input': '309\r\n', 'output': ['17731/307']}, {'input': '69\r\n', 'output': ['983/67']}, {'input': '726\r\n', 'output': ['95491/724']}] | [{'input': '127\r\n', 'output': ['3154/125']}, {'input': '602\r\n', 'output': ['13177/120']}, {'input': '305\r\n', 'output': ['17350/303']}, {'input': '88\r\n', 'output': ['1529/86']}, {'input': '197\r\n', 'output': ['7399/195']}] | [{'input': '995\r\n', 'output': ['59665/331']}, {'input': '785\r\n', 'output': ['111560/783']}, {'input': '469\r\n', 'output': ['40306/467']}, {'input': '93\r\n', 'output': ['246/13']}, {'input': '305\r\n', 'output': ['17350/303']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 112 | 100 | 100 | 100 |
["4\n6\n1\n1\n1\n1", "1\n10\n5", "3\n6\n1\n6\n5", "3\n7\n1\n6\n5"] | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ — the number of benches in the park. The second line contains a single integer $$$m$$$ $$$(1 \le m \le 10\,000)$$$ — the number of people additionally coming to the park. Each of the next $$$n$$$ lines contains a single integer $$$a_i$$$ $$$(1 \le... | 78f696bd954c9f0f9bb502e515d85a8d | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int n,m,a;
int main()
{
int kmin, kmax;
scanf("%d",&n);
scanf("%d",&m);
int cnt = 0,mx=0;
for (int i=0; i<n; i++){
scanf("%d",&a);
cnt += a;
if(a > mx) mx = a;
}
kmin = ceil((float)(cnt+m)/n);
i... | ["3 7", "15 15", "6 12", "7 13"] | C++ | NoteIn the first example, each of four benches is occupied by a single person. The minimum $$$k$$$ is $$$3$$$. For example, it is possible to achieve if two newcomers occupy the first bench, one occupies the second bench, one occupies the third bench, and two remaining — the fourth bench. The maximum $$$k$$$ is $$$7$$$... | Print the minimum possible $$$k$$$ and the maximum possible $$$k$$$, where $$$k$$$ is the maximum number of people sitting on one bench after additional $$$m$$$ people came to the park. | There are $$$n$$$ benches in the Berland Central park. It is known that $$$a_i$$$ people are currently sitting on the $$$i$$$-th bench. Another $$$m$$$ people are coming to the park and each of them is going to have a seat on some bench out of $$$n$$$ available.Let $$$k$$$ be the maximum number of people sitting on one... | [{"input": "4\r\n6\r\n1\r\n1\r\n1\r\n1\r\n", "output": ["3 7"]}, {"input": "1\r\n10\r\n5\r\n", "output": ["15 15"]}, {"input": "3\r\n6\r\n1\r\n6\r\n5\r\n", "output": ["6 12"]}, {"input": "3\r\n7\r\n1\r\n6\r\n5\r\n", "output": ["7 13"]}, {"input": "10\r\n1000\r\n100\r\n100\r\n100\r\n100\r\n100\r\n100\r\n100\r\n100\r\n10... | 100 | 100 | 100 | [{'input': '100\r\n8000\r\n88\r\n40\r\n39\r\n88\r\n33\r\n2\r\n60\r\n93\r\n62\r\n18\r\n44\r\n53\r\n79\r\n55\r\n34\r\n71\r\n45\r\n82\r\n97\r\n96\r\n96\r\n25\r\n83\r\n83\r\n54\r\n45\r\n47\r\n59\r\n94\r\n84\r\n12\r\n33\r\n97\r\n24\r\n71\r\n28\r\n81\r\n89\r\n52\r\n87\r\n96\r\n35\r\n34\r\n31\r\n45\r\n42\r\n14\r\n74\r\n8\r\n6... | [{'input': '100\r\n10000\r\n54\r\n54\r\n50\r\n52\r\n55\r\n51\r\n50\r\n53\r\n50\r\n56\r\n50\r\n51\r\n51\r\n52\r\n54\r\n50\r\n54\r\n52\r\n53\r\n56\r\n55\r\n51\r\n52\r\n55\r\n56\r\n52\r\n52\r\n56\r\n51\r\n56\r\n51\r\n51\r\n55\r\n54\r\n52\r\n55\r\n51\r\n55\r\n56\r\n54\r\n55\r\n54\r\n56\r\n56\r\n51\r\n52\r\n52\r\n56\r\n51\r... | [{'input': '100\r\n9990\r\n22\r\n89\r\n54\r\n55\r\n92\r\n20\r\n84\r\n12\r\n93\r\n6\r\n73\r\n50\r\n23\r\n62\r\n97\r\n88\r\n59\r\n87\r\n4\r\n14\r\n49\r\n28\r\n47\r\n93\r\n5\r\n36\r\n50\r\n78\r\n83\r\n99\r\n100\r\n27\r\n24\r\n23\r\n27\r\n84\r\n67\r\n72\r\n45\r\n51\r\n53\r\n32\r\n60\r\n9\r\n77\r\n63\r\n15\r\n98\r\n17\r\n49... | [{'input': '2\r\n2\r\n1\r\n100\r\n', 'output': ['100 102']}, {'input': '2\r\n3\r\n1\r\n100\r\n', 'output': ['100 103']}, {'input': '10\r\n1\r\n3\r\n3\r\n2\r\n3\r\n3\r\n3\r\n3\r\n3\r\n3\r\n3\r\n', 'output': ['3 4']}, {'input': '10\r\n10\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n', 'output': ['2 11']}, {'input... | [{'input': '40\r\n10000\r\n54\r\n5\r\n23\r\n10\r\n10\r\n77\r\n15\r\n84\r\n92\r\n63\r\n34\r\n21\r\n12\r\n56\r\n25\r\n32\r\n28\r\n50\r\n50\r\n86\r\n3\r\n26\r\n39\r\n69\r\n43\r\n99\r\n71\r\n38\r\n15\r\n33\r\n50\r\n79\r\n54\r\n84\r\n33\r\n47\r\n14\r\n66\r\n99\r\n25\r\n', 'output': ['296 10099']}, {'input': '10\r\n10\r\n1\r... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 113 | 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 <iostream>
int main(){std::cout<<"25\n";return 0;}
//1534 | ["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': '2\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': '7\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}] | [{'input': '2\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}] | [{'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}] | [{'input': '7\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 114 | 100 | 100 | 100 |
["4 2 100000007"] | The first line of input will contain three integers n, k, p (1 ≤ n ≤ 250 000, 1 ≤ k ≤ 26, 108 ≤ p ≤ 109 + 100, p will be prime). | 97f737f59100babe5e45e1a82a1f7d99 | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int n,k,p;
int fpow(int a,int b)
{
int ans=1,t=a;
while(b)
{
if(b&1)ans=1ll*ans*t%p;
t=1ll*t*t%p;b>>=1;
}
return ans;
}
int lowbit(int x)
{
return x&(-x);
}
int f[26][250010];
int fac[250010],inv[250010];
void init(... | ["14"] | C++ | NoteThere are 14 strings that that Alice can win with. For example, some strings are "bbaa" and "baaa". Alice will lose on strings like "aaaa" or "bbbb". | Print a single integer, the number of winning words for Alice, modulo p. | Alice and Bob are playing a game with a string of characters, with Alice going first. The string consists n characters, each of which is one of the first k letters of the alphabet. On a player’s turn, they can either arbitrarily permute the characters in the words, or delete exactly one character in the word (if there ... | [{"input": "4 2 100000007\r\n", "output": ["14"]}, {"input": "1 10 100000007\r\n", "output": ["10"]}, {"input": "5 2 100000007\r\n", "output": ["32"]}, {"input": "4 1 100000007\r\n", "output": ["0"]}, {"input": "4 3 100000007\r\n", "output": ["78"]}, {"input": "6 3 100000007\r\n", "output": ["636"]}, {"input": "250000 ... | 100 | 100 | 100 | [{'input': '1 10 100000007\r\n', 'output': ['10']}, {'input': '232154 3 893627789\r\n', 'output': ['492780692']}, {'input': '250000 21 159237107\r\n', 'output': ['124744886']}, {'input': '250000 26 419059819\r\n', 'output': ['246743278']}, {'input': '13131 14 625308461\r\n', 'output': ['313277523']}] | [{'input': '249998 22 318340733\r\n', 'output': ['293011292']}, {'input': '4 3 100000007\r\n', 'output': ['78']}, {'input': '245758 15 662045771\r\n', 'output': ['558307367']}, {'input': '13132 14 457083337\r\n', 'output': ['445627280']}, {'input': '4 2 100000007\r\n', 'output': ['14']}] | [{'input': '4 3 100000007\r\n', 'output': ['78']}, {'input': '250000 26 419059819\r\n', 'output': ['246743278']}, {'input': '131070 15 724141441\r\n', 'output': ['476164776']}, {'input': '4 1 100000007\r\n', 'output': ['0']}, {'input': '4 2 100000007\r\n', 'output': ['14']}] | [{'input': '4 2 100000007\r\n', 'output': ['14']}, {'input': '245758 15 662045771\r\n', 'output': ['558307367']}, {'input': '232154 3 893627789\r\n', 'output': ['492780692']}, {'input': '249998 22 318340733\r\n', 'output': ['293011292']}, {'input': '1312 25 425538233\r\n', 'output': ['44177569']}] | [{'input': '4 3 100000007\r\n', 'output': ['78']}, {'input': '1312 25 425538233\r\n', 'output': ['44177569']}, {'input': '4 2 100000007\r\n', 'output': ['14']}, {'input': '6 3 100000007\r\n', 'output': ['636']}, {'input': '5 2 100000007\r\n', 'output': ['32']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 95 | 95 | 95 | 100 | 115 | 100 | 100 | 97 |
["47", "16", "78"] | The single line contains an integer n (1 ≤ n ≤ 1000) — the number that needs to be checked. | 78cf8bc7660dbd0602bf6e499bc6bb0d | #include <bits/stdc++.h>
#define op cin.tie(0);ios_base::sync_with_stdio(0);
using namespace std;
int n;
bool lucky(int x)
{
while(x)
{
if(x%10!= 4 && x%10!=7)
return false;
x/=10;
}
return true;
}
int main()
{
op
cin>>n;
for(int i=1;i<=n;i++)
{
i... | ["YES", "YES", "NO"] | C++ | NoteNote that all lucky numbers are almost lucky as any number is evenly divisible by itself.In the first sample 47 is a lucky number. In the second sample 16 is divisible by 4. | In the only line print "YES" (without the quotes), if number n is almost lucky. Otherwise, print "NO" (without the 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.Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find ou... | [{"input": "47\r\n", "output": ["YES"]}, {"input": "16\r\n", "output": ["YES"]}, {"input": "78\r\n", "output": ["NO"]}, {"input": "48\r\n", "output": ["YES"]}, {"input": "100\r\n", "output": ["YES"]}, {"input": "107\r\n", "output": ["NO"]}, {"input": "77\r\n", "output": ["YES"]}, {"input": "477\r\n", "output": ["YES"]}... | 100 | 100 | 100 | [{'input': '1\r\n', 'output': ['NO']}, {'input': '999\r\n', 'output': ['NO']}, {'input': '1000\r\n', 'output': ['YES']}, {'input': '94\r\n', 'output': ['YES']}, {'input': '444\r\n', 'output': ['YES']}] | [{'input': '78\r\n', 'output': ['NO']}, {'input': '56\r\n', 'output': ['YES']}, {'input': '8\r\n', 'output': ['YES']}, {'input': '3\r\n', 'output': ['NO']}, {'input': '42\r\n', 'output': ['YES']}] | [{'input': '1000\r\n', 'output': ['YES']}, {'input': '88\r\n', 'output': ['YES']}, {'input': '1\r\n', 'output': ['NO']}, {'input': '70\r\n', 'output': ['YES']}, {'input': '298\r\n', 'output': ['NO']}] | [{'input': '49\r\n', 'output': ['YES']}, {'input': '70\r\n', 'output': ['YES']}, {'input': '999\r\n', 'output': ['NO']}, {'input': '2\r\n', 'output': ['NO']}, {'input': '788\r\n', 'output': ['YES']}] | [{'input': '4\r\n', 'output': ['YES']}, {'input': '7\r\n', 'output': ['YES']}, {'input': '88\r\n', 'output': ['YES']}, {'input': '298\r\n', 'output': ['NO']}, {'input': '77\r\n', 'output': ['YES']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 116 | 100 | 100 | 100 |
["6 4 3 1", "9 3 8 10"] | The first line contains four space-separated integers n, x, y, c (1 ≤ n, c ≤ 109; 1 ≤ x, y ≤ n; c ≤ n2). | 232c5206ee7c1903556c3625e0b0efc6 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, x, y, c;
bool ok(ll t) {
ll res = 0;
ll rowl = max(1ll, y - t), rowh = min(n, y + t);
for (ll row = rowl; row <= rowh; row++) {
ll tt = t - abs(y - row);
ll coll = max(1ll, x - tt), colh = min(n, x + tt);
res += colh - coll + 1;
if (... | ["0", "2"] | C++ | NoteInitially the first test has one painted cell, so the answer is 0. In the second test all events will go as is shown on the figure. . | In a single line print a single integer — the answer to the problem. | Mr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have at least c switched on squares. When this condition is fulfilled, Mr Bender will be happy.We'll consider the table rows numbered from top to bottom from 1 to n, and the columns — numbered from left to right fro... | [{"input": "6 4 3 1\r\n", "output": ["0"]}, {"input": "9 3 8 10\r\n", "output": ["2"]}, {"input": "9 4 3 10\r\n", "output": ["2"]}, {"input": "9 8 2 10\r\n", "output": ["2"]}, {"input": "1 1 1 1\r\n", "output": ["0"]}, {"input": "10 7 2 7\r\n", "output": ["2"]}, {"input": "8 2 6 10\r\n", "output": ["2"]}, {"input": "8 ... | 100 | 100 | 100 | [{'input': '1000000000 999999938 999999936 384381709\r\n', 'output': ['27600']}, {'input': '737 231 246 79279\r\n', 'output': ['199']}, {'input': '9 8 2 10\r\n', 'output': ['2']}, {'input': '847251738 695702891 698306947 648440371\r\n', 'output': ['18006']}, {'input': '10 7 2 7\r\n', 'output': ['2']}] | [{'input': '1000000000 999999938 65 384381709\r\n', 'output': ['27600']}, {'input': '1 1 1 1\r\n', 'output': ['0']}, {'input': '737 231 246 79279\r\n', 'output': ['199']}, {'input': '958 768 649 298927\r\n', 'output': ['431']}, {'input': '9 3 8 10\r\n', 'output': ['2']}] | [{'input': '1000000000 999999946 60 715189365\r\n', 'output': ['37707']}, {'input': '813 154 643 141422\r\n', 'output': ['299']}, {'input': '1000000000 6 97 272656295\r\n', 'output': ['23250']}, {'input': '737 231 246 79279\r\n', 'output': ['199']}, {'input': '9 3 8 55\r\n', 'output': ['7']}] | [{'input': '8 1 2 64\r\n', 'output': ['13']}, {'input': '10 7 2 7\r\n', 'output': ['2']}, {'input': '1 1 1 1\r\n', 'output': ['0']}, {'input': '71036059 25478942 38920202 19135721\r\n', 'output': ['3093']}, {'input': '8 8 3 1\r\n', 'output': ['0']}] | [{'input': '1 1 1 1\r\n', 'output': ['0']}, {'input': '9 8 2 50\r\n', 'output': ['7']}, {'input': '1000000000 999999946 999999916 423654797\r\n', 'output': ['28970']}, {'input': '1000000000 999999938 999999936 384381709\r\n', 'output': ['27600']}, {'input': '958 768 649 298927\r\n', 'output': ['431']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 117 | 100 | 100 | 100 |
["1", "2", "3"] | The only line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$). | 8218255989e5eab73ac7107072c3b2af | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using pii = pair<int, int>;
using vi = vector <int>;
#define F first
#define S second
#define pb push_ba... | ["1", "3", "9"] | C++ | NoteThe pictures below illustrate tries in the first two examples (for clarity, the round brackets are replaced with angle brackets). The maximum matching is highlighted with blue. | Print exactly one integer — the size of the maximum matching in the trie. Since the answer can be quite large, print it modulo $$$10^9 + 7$$$. | Neko is playing with his toys on the backyard of Aki's house. Aki decided to play a prank on him, by secretly putting catnip into Neko's toys. Unfortunately, he went overboard and put an entire bag of catnip into the toys...It took Neko an entire day to turn back to normal. Neko reported to Aki that he saw a lot of wei... | [{"input": "1\r\n", "output": ["1"]}, {"input": "2\r\n", "output": ["3"]}, {"input": "3\r\n", "output": ["9"]}, {"input": "4\r\n", "output": ["27"]}, {"input": "5\r\n", "output": ["84"]}, {"input": "6\r\n", "output": ["270"]}, {"input": "7\r\n", "output": ["892"]}, {"input": "8\r\n", "output": ["3012"]}, {"input": "9\r... | 100 | 100 | 100 | [{'input': '10\r\n', 'output': ['36074']}, {'input': '16\r\n', 'output': ['78484401']}, {'input': '5\r\n', 'output': ['84']}, {'input': '27\r\n', 'output': ['304700019']}, {'input': '4\r\n', 'output': ['27']}] | [{'input': '1000\r\n', 'output': ['143886430']}, {'input': '5\r\n', 'output': ['84']}, {'input': '900\r\n', 'output': ['454329300']}, {'input': '999\r\n', 'output': ['742390865']}, {'input': '9\r\n', 'output': ['10350']}] | [{'input': '2\r\n', 'output': ['3']}, {'input': '6\r\n', 'output': ['270']}, {'input': '25\r\n', 'output': ['569244761']}, {'input': '10\r\n', 'output': ['36074']}, {'input': '24\r\n', 'output': ['60828279']}] | [{'input': '998\r\n', 'output': ['311781222']}, {'input': '20\r\n', 'output': ['746806193']}, {'input': '24\r\n', 'output': ['60828279']}, {'input': '1000\r\n', 'output': ['143886430']}, {'input': '22\r\n', 'output': ['450571487']}] | [{'input': '23\r\n', 'output': ['724717660']}, {'input': '8\r\n', 'output': ['3012']}, {'input': '16\r\n', 'output': ['78484401']}, {'input': '10\r\n', 'output': ['36074']}, {'input': '500\r\n', 'output': ['660474384']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 118 | 100 | 100 | 100 |
["2\n3\n5\n1\n8", "3\n1\n6\n7\n25", "6\n4\n9\n10\n89"] | The first line contains one integer $$$a_1$$$ $$$(1 \le a_1 \le 1\,000)$$$ — the number of players in the first team. The second line contains one integer $$$a_2$$$ $$$(1 \le a_2 \le 1\,000)$$$ — the number of players in the second team. The third line contains one integer $$$k_1$$$ $$$(1 \le k_1 \le 1\,000)$$$ — the m... | 2be8e0b8ad4d3de2930576c0209e8b91 | #pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define mp(x, y) make_pair(x, y)
#define forn(i, a, b) for(size_t i=a; i<b; ++i)
#define ford(i, a, b) for(size_t i=b-1; i>=a; --i)
#define all(a) a.begin(), a.end()
#defi... | ["0 4", "4 4", "5 9"] | C++ | NoteIn the first example it could be possible that no player left the game, so the first number in the output is $$$0$$$. The maximum possible number of players that could have been forced to leave the game is $$$4$$$ — one player from the first team, and three players from the second.In the second example the maximum ... | Print two integers — the minimum and the maximum number of players that could have been thrown out of the game. | The final match of the Berland Football Cup has been held recently. The referee has shown $$$n$$$ yellow cards throughout the match. At the beginning of the match there were $$$a_1$$$ players in the first team and $$$a_2$$$ players in the second team.The rules of sending players off the game are a bit different in Berl... | [{"input": "2\r\n3\r\n5\r\n1\r\n8\r\n", "output": ["0 4", "0 4\n", "0\r\n4", "0 4\r\n", "0 4\r\n", "0 4 \n", "0\r\n4\r\n"]}, {"input": "3\r\n1\r\n6\r\n7\r\n25\r\n", "output": ["4 4\r\n", "4\r\n4\r\n", "4 4 \n", "4 4\n", "4\r\n4", "4 4\r\n", "4 4"]}, {"input": "6\r\n4\r\n9\r\n10\r\n89\r\n", "output": ["5 9", "5 9\r\... | 100 | 100 | 100 | [{'input': '6\r\n4\r\n9\r\n10\r\n89\r\n', 'output': ['5 9', '5 9\r\n', '5 9 \n', '5\r\n9\r\n', '5 9\r\n', '5\r\n9', '5 9\n']}, {'input': '4\r\n7\r\n1\r\n10\r\n60\r\n', 'output': ['0\r\n9', '0 9\r\n', '0 9 \n', '0 9', '0 9\n', '0\r\n9\r\n', '0 9\r\n']}, {'input': '69\r\n50\r\n425\r\n358\r\n47212\r\n', 'output': ['10... | [{'input': '1000\r\n1000\r\n1000\r\n1000\r\n2000000\r\n', 'output': ['2000 2000\r\n', '2000 2000 \n', '2000 2000\n', '2000 2000', '2000\r\n2000\r\n', '2000\r\n2000', '2000 2000\r\n']}, {'input': '998\r\n967\r\n976\r\n961\r\n1903335\r\n', 'output': ['1965 1965\n', '1965\r\n1965\r\n', '1965 1965 \n', '1965 1965\r\n', '... | [{'input': '621\r\n739\r\n132\r\n209\r\n236198\r\n', 'output': ['1135 1358 \n', '1135\r\n1358\r\n', '1135\r\n1358', '1135 1358\r\n', '1135 1358\n', '1135 1358', '1135 1358\r\n']}, {'input': '21\r\n924\r\n435\r\n527\r\n495557\r\n', 'output': ['419 944 \n', '419 944\r\n', '419 944\n', '419 944\r\n', '419 944', '419\r... | [{'input': '4\r\n7\r\n1\r\n10\r\n60\r\n', 'output': ['0\r\n9', '0 9\r\n', '0 9 \n', '0 9', '0 9\n', '0\r\n9\r\n', '0 9\r\n']}, {'input': '4\r\n5\r\n8\r\n5\r\n54\r\n', 'output': ['6\r\n8', '6 8', '6 8\n', '6\r\n8\r\n', '6 8\r\n', '6 8\r\n', '6 8 \n']}, {'input': '1000\r\n1000\r\n1000\r\n1000\r\n998\r\n', 'output': [... | [{'input': '1\r\n1\r\n1\r\n3\r\n4\r\n', 'output': ['2 2 \n', '2\r\n2\r\n', '2 2\n', '2 2\r\n', '2 2', '2\r\n2', '2 2\r\n']}, {'input': '254\r\n771\r\n827\r\n760\r\n693168\r\n', 'output': ['0\r\n900', '0\r\n900\r\n', '0 900\r\n', '0 900\r\n', '0 900\n', '0 900', '0 900 \n']}, {'input': '998\r\n967\r\n976\r\n961\r\n1... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 91.67 | 83.33 | 83.33 | 91.67 | 91.67 | 119 | 100 | 100 | 88.334 |
["2 2 3", "4 2 3"] | The first line contains three integers k1, k2 and k3 (1 ≤ ki ≤ 1500) — time intervals of the garlands. | df48af9f5e68cb6efc1214f7138accf9 | #include <bits/stdc++.h>
using namespace std;
int mx,b,c;
double arr[15000],a;
bool chek;
int main()
{
for(int i=1; i<=3; i++){
cin>>a;
if(a==1)arr[1]+=(1/a);
if(!((int)a%2))arr[2]+=(2/a);
if(!((int)a%3))arr[3]+=(3/a);
}
if((arr[1]) || (arr[2]>=2) || (arr[3]>=3)){
... | ["YES", "NO"] | C++ | NoteIn the first example Mishka can choose x1 = 1, x2 = 2, x3 = 1. The first garland will be lit during seconds 1, 3, 5, 7, ..., the second — 2, 4, 6, 8, ..., which already cover all the seconds after the 2-nd one. It doesn't even matter what x3 is chosen. Our choice will lead third to be lit during seconds 1, 4, 7, 10... | If Mishka can choose moments of time to switch on the garlands in such a way that each second after switching the garlands on at least one garland will be lit, print YES. Otherwise, print NO. | Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.When a garland is switched on, it periodically changes its state — sometimes it is lit, sometimes not. Formally, if i-th garland is switched on during x-th second,... | [{"input": "2 2 3\r\n", "output": ["YES"]}, {"input": "4 2 3\r\n", "output": ["NO"]}, {"input": "1499 1498 1500\r\n", "output": ["NO"]}, {"input": "1500 1500 1500\r\n", "output": ["NO"]}, {"input": "100 4 1\r\n", "output": ["YES"]}, {"input": "4 2 4\r\n", "output": ["YES"]}, {"input": "3 3 3\r\n", "output": ["YES"]}, {... | 100 | 100 | 100 | [{'input': '5 2 2\r\n', 'output': ['YES']}, {'input': '2 3 14\r\n', 'output': ['NO']}, {'input': '1 5 5\r\n', 'output': ['YES']}, {'input': '7 2 2\r\n', 'output': ['YES']}, {'input': '1 1 3\r\n', 'output': ['YES']}] | [{'input': '2 10 2\r\n', 'output': ['YES']}, {'input': '2 10 10\r\n', 'output': ['NO']}, {'input': '4 4 123\r\n', 'output': ['NO']}, {'input': '2 5 5\r\n', 'output': ['NO']}, {'input': '3 3 2\r\n', 'output': ['NO']}] | [{'input': '1 2 3\r\n', 'output': ['YES']}, {'input': '2 3 14\r\n', 'output': ['NO']}, {'input': '2 998 1000\r\n', 'output': ['NO']}, {'input': '6 4 7\r\n', 'output': ['NO']}, {'input': '1 1 3\r\n', 'output': ['YES']}] | [{'input': '2 998 1000\r\n', 'output': ['NO']}, {'input': '1 5 10\r\n', 'output': ['YES']}, {'input': '3 4 4\r\n', 'output': ['NO']}, {'input': '4 2 3\r\n', 'output': ['NO']}, {'input': '2 2 4\r\n', 'output': ['YES']}] | [{'input': '3 3 6\r\n', 'output': ['NO']}, {'input': '15 3 3\r\n', 'output': ['NO']}, {'input': '6 7 4\r\n', 'output': ['NO']}, {'input': '2 10 2\r\n', 'output': ['YES']}, {'input': '3 3 2\r\n', 'output': ['NO']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 78.57 | 85.71 | 92.86 | 78.57 | 120 | 100 | 100 | 85.714 |
["4\n1 1 1 4", "5\n1 1 5 2 1"] | The first line of the input contains integer n (1 ≤ n ≤ 24). Next line contains n positive integers: the i-th number represents ci (1 ≤ ci ≤ n). | ed0925cfaee961a3ceebd13b3c96a15a | #include <bits/stdc++.h>
using namespace std;
int C[25],A[25];
int N;
int dfs(int idx,int rem)
{
if(idx>N)
{
for(int i = 1;i<=N;i++)
{
if(C[i])
return 0;
}
return 1;
}
if(!A[idx])
return dfs(idx+1,A[idx+1]-1);
for(int i = min(A[idx],rem);i>0;i--)
{
if(C[i])
{
C[i]-=1,A[idx]-=i;
if(dfs(i... | ["YES", "NO"] | C++ | null | Output on the first line "YES" (without quotes) if there exist at least one tree following Iahub's restrictions, otherwise output "NO" (without quotes). | Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the food. Iahub asks Iahubina: can you build a rooted tree, such that each intern... | [{"input": "4\r\n1 1 1 4\r\n", "output": ["YES"]}, {"input": "5\r\n1 1 5 2 1\r\n", "output": ["NO"]}, {"input": "13\r\n1 1 1 1 1 1 1 1 1 4 4 4 13\r\n", "output": ["YES"]}, {"input": "4\r\n1 1 1 3\r\n", "output": ["NO"]}, {"input": "24\r\n1 1 1 1 1 1 1 1 1 1 1 1 24 1 1 1 1 1 1 1 1 1 1 1\r\n", "output": ["YES"]}, {"input... | 100 | 100 | 100 | [{'input': '24\r\n1 1 1 1 1 1 1 1 1 1 1 1 24 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['YES']}, {'input': '24\r\n3 3 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24\r\n', 'output': ['NO']}, {'input': '19\r\n9 7 1 8 1 1 1 13 1 1 3 3 19 1 1 1 1 1 1\r\n', 'output': ['NO']}, {'input': '14\r\n4 1 1 1 3 1 1 1 1 14 1 ... | [{'input': '2\r\n1 2\r\n', 'output': ['NO']}, {'input': '21\r\n1 1 1 6 1 1 13 21 1 1 3 1 8 1 19 3 3 1 1 1 1\r\n', 'output': ['YES']}, {'input': '13\r\n1 1 1 1 1 1 1 1 1 4 4 4 13\r\n', 'output': ['YES']}, {'input': '10\r\n1 1 1 1 7 1 1 1 4 10\r\n', 'output': ['YES']}, {'input': '24\r\n3 3 3 4 5 6 7 8 9 10 11 12 13 14 15... | [{'input': '5\r\n1 1 5 2 1\r\n', 'output': ['NO']}, {'input': '21\r\n1 1 1 6 1 1 13 21 1 1 3 1 8 1 19 3 3 1 1 1 1\r\n', 'output': ['YES']}, {'input': '22\r\n1 1 1 6 1 1 13 21 1 1 2 1 8 1 19 3 3 1 1 1 1 2\r\n', 'output': ['NO']}, {'input': '24\r\n8 5 3 1 1 5 10 1 1 1 1 5 1 2 7 3 4 1 1 24 1 1 2 8\r\n', 'output': ['NO']},... | [{'input': '12\r\n12 7 4 3 3 1 1 1 1 1 1 1\r\n', 'output': ['YES']}, {'input': '2\r\n1 2\r\n', 'output': ['NO']}, {'input': '21\r\n1 1 1 6 1 1 13 21 1 1 3 1 8 1 19 3 3 1 1 1 1\r\n', 'output': ['YES']}, {'input': '20\r\n20 9 4 4 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['YES']}, {'input': '4\r\n1 1 1 4\r\n', 'out... | [{'input': '1\r\n1\r\n', 'output': ['YES']}, {'input': '16\r\n1 1 1 1 1 1 1 1 1 1 1 1 16 1 1 1\r\n', 'output': ['YES']}, {'input': '19\r\n9 7 1 8 1 1 1 13 1 1 3 3 19 1 1 1 1 1 1\r\n', 'output': ['NO']}, {'input': '24\r\n1 1 1 1 1 1 1 1 1 1 1 1 24 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['YES']}, {'input': '4\r\n1 1 1 4\r... | 100 | 100 | 100 | 100 | 100 | 95.83 | 91.67 | 95.83 | 95.83 | 95.83 | 94.44 | 88.89 | 94.44 | 94.44 | 94.44 | 121 | 100 | 94.998 | 93.33 |
["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 <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const long long MAXN = 2000;
const long long mod = 1000000007;
long long C[MAXN][MAXN], nn[MAXN], f[MAXN];
long long ... | ["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': '50 2\r\n', 'output': ['628702797']}, {'input': '975 8\r\n', 'output': ['531455228']}, {'input': '2 2\r\n', 'output': ['2']}, {'input': '5 2\r\n', 'output': ['54']}, {'input': '7 4\r\n', 'output': ['1728']}] | [{'input': '685 7\r\n', 'output': ['840866481']}, {'input': '1000 2\r\n', 'output': ['675678679']}, {'input': '50 2\r\n', 'output': ['628702797']}, {'input': '1000 1\r\n', 'output': ['760074701']}, {'input': '1000 8\r\n', 'output': ['339760446']}] | [{'input': '876 8\r\n', 'output': ['703293724']}, {'input': '10 7\r\n', 'output': ['3176523']}, {'input': '7 4\r\n', 'output': ['1728']}, {'input': '1000 3\r\n', 'output': ['330155123']}, {'input': '475 5\r\n', 'output': ['449471303']}] | [{'input': '12 8\r\n', 'output': ['536870912']}, {'input': '685 7\r\n', 'output': ['840866481']}, {'input': '2 2\r\n', 'output': ['2']}, {'input': '473 4\r\n', 'output': ['145141007']}, {'input': '50 2\r\n', 'output': ['628702797']}] | [{'input': '9 8\r\n', 'output': ['2097152']}, {'input': '2 2\r\n', 'output': ['2']}, {'input': '50 2\r\n', 'output': ['628702797']}, {'input': '227 6\r\n', 'output': ['407444135']}, {'input': '975 8\r\n', 'output': ['531455228']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 122 | 100 | 100 | 100 |
["1 1 1", "3 1 0"] | The first line contains three space-separated integers a, b and c (0 ≤ a, b, c ≤ 231; a + b + c > 0) — the number of red, green and blue pixels, correspondingly. | b8008caf788336775cb8ebb76478b04c | #include<bits/stdc++.h>
using namespace std;
long long a[3];
int main()
{
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3);
if ((a[0]+a[1])%2==0) cout<<a[1]; else cout<<a[2];
}
| ["1", "3"] | C++ | NoteIn the first test sample the country needs only one fight to achieve peace and prosperity. Besides, it can be any fight whatsoever. For example, let's assume that the green and the blue pixels fight, then the surviving pixel will be red. As a result, after the fight there are two red pixels. There won't be other pi... | Print a single number — the minimum number of pixel fights before the country becomes peaceful and prosperous. If making the country peaceful and prosperous is impossible, print -1. | Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, if pixels of colors x and y (x ≠ y) meet in a violent fight, then the pixel t... | [{"input": "1 1 1\r\n", "output": ["1"]}, {"input": "3 1 0\r\n", "output": ["3"]}, {"input": "1 4 4\r\n", "output": ["4"]}, {"input": "5 10 6\r\n", "output": ["10"]}, {"input": "6 8 10\r\n", "output": ["8"]}, {"input": "1 10 2\r\n", "output": ["10"]}, {"input": "10 6 8\r\n", "output": ["8"]}, {"input": "18 67 5\r\n", "... | 100 | 100 | 100 | [{'input': '382601556 881329640 791556039\r\n', 'output': ['881329640']}, {'input': '6 8 10\r\n', 'output': ['8']}, {'input': '1 2 2147483648\r\n', 'output': ['2147483648']}, {'input': '8 97 83\r\n', 'output': ['97']}, {'input': '5 10 6\r\n', 'output': ['10']}] | [{'input': '5 9 0\r\n', 'output': ['9']}, {'input': '2 7 95\r\n', 'output': ['95']}, {'input': '3 1 0\r\n', 'output': ['3']}, {'input': '92134834 23742837 92374739\r\n', 'output': ['92374739']}, {'input': '0 2 10\r\n', 'output': ['2']}] | [{'input': '2147483648 0 2147483647\r\n', 'output': ['2147483648']}, {'input': '1 4 4\r\n', 'output': ['4']}, {'input': '772486757 1747374885 377299255\r\n', 'output': ['772486757']}, {'input': '1 0 1\r\n', 'output': ['1']}, {'input': '5 0 5\r\n', 'output': ['5']}] | [{'input': '1 1 1\r\n', 'output': ['1']}, {'input': '2147483630 2147483642 2147483610\r\n', 'output': ['2147483630']}, {'input': '48 6 7\r\n', 'output': ['48']}, {'input': '92134834 23742837 92374737\r\n', 'output': ['92374737']}, {'input': '9 530792195 6\r\n', 'output': ['530792195']}] | [{'input': '3 0 2\r\n', 'output': ['2']}, {'input': '772486757 1747374885 377299255\r\n', 'output': ['772486757']}, {'input': '3 1 0\r\n', 'output': ['3']}, {'input': '10 6 8\r\n', 'output': ['8']}, {'input': '6 8 10\r\n', 'output': ['8']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 123 | 100 | 100 | 100 |
["3 10 3 3", "3 10 1 3", "100 100 1 1000"] | The first line contains four space-separated integers k, a, b, v (2 ≤ k ≤ 1000; 1 ≤ a, b, v ≤ 1000) — the maximum number of sections in the box, the number of nuts, the number of divisors and the capacity of each section of the box. | 7cff20b1c63a694baca69bdf4bdb2652 | #include <bits/stdc++.h>
using namespace std;
int k, a, v, b, st, dr, piv;
int check(int x){
int nr = min(x * (k-1), b);
return ((x + nr) * v);
}
int main(){
// ifstream in("tst.in");
// ofstream out("tst.out");
cin >> k >> a >> b >> v;
st = 1;
dr = 10000;
while(st <= dr){
piv = (st + dr) / 2;
if(check(p... | ["2", "3", "1"] | C++ | NoteIn the first sample you can act like this: Put two divisors to the first box. Now the first box has three sections and we can put three nuts into each section. Overall, the first box will have nine nuts. Do not put any divisors into the second box. Thus, the second box has one section for the last nut. In the en... | Print a single integer — the answer to the problem. | You have a nuts and lots of boxes. The boxes have a wonderful feature: if you put x (x ≥ 0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into x + 1 sections.You are minimalist. Therefore, on the one hand, you are against dividing some box into more than k sections. On the other hand, ... | [{"input": "3 10 3 3\r\n", "output": ["2"]}, {"input": "3 10 1 3\r\n", "output": ["3"]}, {"input": "100 100 1 1000\r\n", "output": ["1"]}, {"input": "5 347 20 1\r\n", "output": ["327"]}, {"input": "6 978 10 5\r\n", "output": ["186"]}, {"input": "6 856 50 35\r\n", "output": ["5"]}, {"input": "8 399 13 36\r\n", "output":... | 100 | 100 | 100 | [{'input': '763 193 388 346\r\n', 'output': ['1']}, {'input': '7 897 49 42\r\n', 'output': ['4']}, {'input': '6 856 50 35\r\n', 'output': ['5']}, {'input': '10 849 3 28\r\n', 'output': ['28']}, {'input': '3 10 1 3\r\n', 'output': ['3']}] | [{'input': '5 347 20 1\r\n', 'output': ['327']}, {'input': '763 193 388 346\r\n', 'output': ['1']}, {'input': '634 993 9 3\r\n', 'output': ['322']}, {'input': '461 790 518 105\r\n', 'output': ['1']}, {'input': '810 1000 6 5\r\n', 'output': ['194']}] | [{'input': '4 787 48 4\r\n', 'output': ['149']}, {'input': '477 492 438 690\r\n', 'output': ['1']}, {'input': '346 991 4 4\r\n', 'output': ['244']}, {'input': '683 995 10 1\r\n', 'output': ['985']}, {'input': '461 790 518 105\r\n', 'output': ['1']}] | [{'input': '10 849 3 28\r\n', 'output': ['28']}, {'input': '10 697 1 34\r\n', 'output': ['20']}, {'input': '4 714 7 6\r\n', 'output': ['112']}, {'input': '579 990 8 9\r\n', 'output': ['102']}, {'input': '8 399 13 36\r\n', 'output': ['2']}] | [{'input': '683 995 10 1\r\n', 'output': ['985']}, {'input': '5 347 20 1\r\n', 'output': ['327']}, {'input': '10 849 3 28\r\n', 'output': ['28']}, {'input': '10 697 1 34\r\n', 'output': ['20']}, {'input': '6 856 50 35\r\n', 'output': ['5']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 124 | 100 | 100 | 100 |
["2 10\n8 9", "3 5\n4 4 4"] | The first line contains two integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 100) denoting the number of marks, received by Noora and the value of highest possible mark. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ k) denoting marks received by Noora before Leha's hack. | f22267bf3fad0bf342ecf4c27ad3a900 | #include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
const int ok=500;
int n,k,a[ok];
double sum,cnt;
int av;
int main()
{
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
int n1=n;
cnt=sum*1.0/n;
av=round(cnt);
while(av!=k)
{
sum+=k;
n+... | ["4", "3"] | C++ | NoteConsider the first example testcase.Maximal mark is 10, Noora received two marks — 8 and 9, so current final mark is 9. To fix it, Leha can add marks [10, 10, 10, 10] (4 marks in total) to the registry, achieving Noora having average mark equal to . Consequently, new final mark is 10. Less number of marks won't fix... | Print a single integer — minimal number of additional marks, that Leha has to add in order to change Noora's final mark to k. | Noora is a student of one famous high school. It's her final year in school — she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one.In school, where Noora is studying, teachers are putting down marks to the online class register, whic... | [{"input": "2 10\r\n8 9\r\n", "output": ["4"]}, {"input": "3 5\r\n4 4 4\r\n", "output": ["3"]}, {"input": "3 10\r\n10 8 9\r\n", "output": ["3"]}, {"input": "2 23\r\n21 23\r\n", "output": ["2"]}, {"input": "5 10\r\n5 10 10 9 10\r\n", "output": ["7"]}, {"input": "12 50\r\n18 10 26 22 22 23 14 21 27 18 25 12\r\n", "output... | 100 | 100 | 100 | [{'input': '5 10\r\n10 10 10 10 10\r\n', 'output': ['0']}, {'input': '100 100\r\n71 87 100 85 89 98 90 90 71 65 76 75 85 100 81 100 91 80 73 89 86 78 82 89 77 92 78 90 100 81 85 89 73 100 66 60 72 88 91 73 93 76 88 81 86 78 83 77 74 93 97 94 85 78 82 78 91 91 100 78 89 76 78 82 81 78 83 88 87 83 78 98 85 97 98 89 88 75... | [{'input': '3 6\r\n6 6 6\r\n', 'output': ['0']}, {'input': '78 43\r\n2 7 6 5 5 6 4 5 3 4 6 8 4 5 5 4 3 1 2 4 4 6 5 6 4 4 6 4 8 4 6 5 6 1 4 5 6 3 2 5 2 5 3 4 8 8 3 3 4 4 6 6 5 4 5 5 7 9 3 9 6 4 7 3 6 9 6 5 1 7 2 5 6 3 6 2 5 4\r\n', 'output': ['5884']}, {'input': '12 50\r\n18 10 26 22 22 23 14 21 27 18 25 12\r\n', 'outpu... | [{'input': '1 5\r\n1\r\n', 'output': ['7']}, {'input': '2 1\r\n1 1\r\n', 'output': ['0']}, {'input': '96 41\r\n13 32 27 34 28 34 30 26 21 24 29 20 25 34 25 16 27 15 22 22 34 22 25 19 23 17 17 22 26 24 23 20 21 27 19 33 13 24 22 18 30 30 27 14 26 24 20 20 22 11 19 31 19 29 18 28 30 22 17 15 28 32 17 24 17 24 24 19 26 23... | [{'input': '5 2\r\n2 2 2 2 2\r\n', 'output': ['0']}, {'input': '7 7\r\n1 1 1 1 1 1 1\r\n', 'output': ['77']}, {'input': '2 5\r\n5 5\r\n', 'output': ['0']}, {'input': '1 2\r\n2\r\n', 'output': ['0']}, {'input': '5 4\r\n4 4 4 4 4\r\n', 'output': ['0']}] | [{'input': '100 1\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': ['0']}, {'input': '1 100\r\n100\r\n', 'output': ['0']}, {'input': '10 5\r\n5 5 5 5 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 125 | 100 | 100 | 100 |
["12345", "09"] | The first line contains nonempty sequence consisting of digits from 0 to 9 — Masha's phone number. The sequence length does not exceed 50. | 2dd8bb6e8182278d037aa3a59ca3517b | #include <bits/stdc++.h>
using namespace std;
#define MX (int)1e6+1
#define pb push_back
#define ip pair<int,int>
#define ll long long
#define INF 70
const ll mod = 1e9 + 7;
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);
ll dp[55][10][10],n;
string input;
... | ["48", "15"] | C++ | null | Output the single number — the number of phone numbers Masha will dial. | Alas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy. The phone number is divined like that. First one needs to write down one's own phone numbers. For example, let's suppose ... | [{"input": "12345\r\n", "output": ["48"]}, {"input": "09\r\n", "output": ["15"]}, {"input": "3\r\n", "output": ["9"]}, {"input": "55\r\n", "output": ["14"]}, {"input": "737\r\n", "output": ["23"]}, {"input": "21583\r\n", "output": ["55"]}, {"input": "33408349\r\n", "output": ["133"]}, {"input": "0180990956\r\n", "outpu... | 100 | 100 | 100 | [{'input': '55\r\n', 'output': ['14']}, {'input': '737\r\n', 'output': ['23']}, {'input': '23321232101010000101232344554334\r\n', 'output': ['5316368']}, {'input': '9876543210\r\n', 'output': ['157']}, {'input': '36460576924876475371008334246121610\r\n', 'output': ['31319157']}] | [{'input': '74239501210975375541963549337949373386030687741681\r\n', 'output': ['3422420940']}, {'input': '17601120900014764776764048700928872725171605903217\r\n', 'output': ['10428170619']}, {'input': '95066916647678224147260013920\r\n', 'output': ['446529']}, {'input': '21583\r\n', 'output': ['55']}, {'input': '98765... | [{'input': '74239501210975375541963549337949373386030687741681\r\n', 'output': ['3422420940']}, {'input': '10764487327809690332754482187409867297140746339768\r\n', 'output': ['3435387051']}, {'input': '39884857105160870767160905699169880375621726152715\r\n', 'output': ['244663375']}, {'input': '676765666545656543321110... | [{'input': '78767765544454334445445555455676565433343455432332\r\n', 'output': ['11031574582']}, {'input': '0180990956\r\n', 'output': ['473']}, {'input': '9876543210\r\n', 'output': ['157']}, {'input': '21583\r\n', 'output': ['55']}, {'input': '36460576924876475371008334246121610\r\n', 'output': ['31319157']}] | [{'input': '74239501210975375541963549337949373386030687741681\r\n', 'output': ['3422420940']}, {'input': '12345\r\n', 'output': ['48']}, {'input': '78776656654555655544443212222101121000000000100000\r\n', 'output': ['164642009']}, {'input': '317579445234107659439645596\r\n', 'output': ['145866']}, {'input': '398848571... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 126 | 100 | 100 | 100 |
["2 3\n1 1", "3 2\n0 0", "1 10\n5 3"] | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 100\,000$$$) — the number of fast food restaurants on the circle and the distance between the neighboring restaurants, respectively. The second line contains two integers $$$a$$$ and $$$b$$$ ($$$0 \le a, b \le \frac{k}{2}$$$) — the distances to... | 5bb4adff1b332f43144047955eefba0c | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define N 100005
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define print(x) cout << #x << "=" << x << "\t";
ll n;
ll k;
ll a;
ll b;
ll ma = -1e18;
ll mi = 1e18;
int main() {
ios::sync_with_stdio(false); ... | ["1 6", "1 3", "5 5"] | C++ | NoteIn the first example the restaurants are located in the cities $$$1$$$ and $$$4$$$, the initial city $$$s$$$ could be $$$2$$$, $$$3$$$, $$$5$$$, or $$$6$$$. The next city Sergey stopped at could also be at cities $$$2, 3, 5, 6$$$. Let's loop through all possible combinations of these cities. If both $$$s$$$ and the... | Print the two integers $$$x$$$ and $$$y$$$. | Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through $$$n \cdot k$$$ cities. The cities are numerated from $$$1$$$ to $$$n \cdot k$$$, the distance between the neighboring cities is exactly $$$1$$$ km.Sergey does not like beetles, he loves burgers. Fortunately for him, there ... | [{"input": "2 3\r\n1 1\r\n", "output": ["1 6"]}, {"input": "3 2\r\n0 0\r\n", "output": ["1 3"]}, {"input": "1 10\r\n5 3\r\n", "output": ["5 5"]}, {"input": "3 3\r\n1 0\r\n", "output": ["9 9"]}, {"input": "4 3\r\n1 1\r\n", "output": ["1 12"]}, {"input": "5 5\r\n2 2\r\n", "output": ["1 25"]}, {"input": "6 3\r\n1 1\r\n", ... | 100 | 100 | 100 | [{'input': '4 3\r\n1 1\r\n', 'output': ['1 12']}, {'input': '36739 36739\r\n18369 18369\r\n', 'output': ['1 1349754121']}, {'input': '100000 100000\r\n0 1\r\n', 'output': ['10000000000 10000000000']}, {'input': '2 1\r\n0 0\r\n', 'output': ['1 2']}, {'input': '3 3\r\n1 0\r\n', 'output': ['9 9']}] | [{'input': '1 10\r\n5 3\r\n', 'output': ['5 5']}, {'input': '16127 18181\r\n6581 2408\r\n', 'output': ['18181 293204987']}, {'input': '1 100\r\n0 0\r\n', 'output': ['1 1']}, {'input': '3 10\r\n1 3\r\n', 'output': ['5 15']}, {'input': '99079 99053\r\n49479 49521\r\n', 'output': ['99053 9814072187']}] | [{'input': '3 2\r\n0 0\r\n', 'output': ['1 3']}, {'input': '89527 91159\r\n44571 44990\r\n', 'output': ['91159 8161191793']}, {'input': '98752 97209\r\n41218 39020\r\n', 'output': ['21427641 3199861056']}, {'input': '23981 21841\r\n10376 10637\r\n', 'output': ['21841 523769021']}, {'input': '3 10\r\n1 3\r\n', 'output':... | [{'input': '4 3\r\n1 1\r\n', 'output': ['1 12']}, {'input': '95911 95917\r\n47946 47954\r\n', 'output': ['95917 9199495387']}, {'input': '3 2\r\n0 0\r\n', 'output': ['1 3']}, {'input': '96557 28657\r\n2964 7036\r\n', 'output': ['28657 2767033949']}, {'input': '99871 99877\r\n5273 34727\r\n', 'output': ['99877 997481586... | [{'input': '99999 23782\r\n0 0\r\n', 'output': ['1 99999']}, {'input': '4 3\r\n1 1\r\n', 'output': ['1 12']}, {'input': '89527 91159\r\n44571 44990\r\n', 'output': ['91159 8161191793']}, {'input': '3 10\r\n1 3\r\n', 'output': ['5 15']}, {'input': '99873 99876\r\n24862 13862\r\n', 'output': ['1189 2493728937']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 127 | 100 | 100 | 100 |
["9 9 5 5 2 1", "100 100 52 50 46 56"] | The first line contains six integers n, m, x, y, a, b (1 ≤ n, m ≤ 109, 0 ≤ x ≤ n, 0 ≤ y ≤ m, 1 ≤ a ≤ n, 1 ≤ b ≤ m). | 8f1211b995f35462ae83b2be27f54585 | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <set>
using namespace std;
#define ll long long
int n,m,x,y,a,b;
int main()
{
// freopen("in.txt","r",stdin);
cin>>n>>m>>x>>y>>a>>b;
ll t=__gcd(a,b);
a/=t;
b/=t;
ll lx,ly;
lx=n/a*a;
ly=m/b*b;
if(l... | ["1 3 9 7", "17 8 86 92"] | C++ | null | Print four integers x1, y1, x2, y2, which represent the founded sub-rectangle whose left-bottom point is (x1, y1) and right-up point is (x2, y2). | You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x,... | [{"input": "9 9 5 5 2 1\r\n", "output": ["1 3 9 7"]}, {"input": "100 100 52 50 46 56\r\n", "output": ["17 8 86 92"]}, {"input": "100 100 16 60 42 75\r\n", "output": ["0 0 56 100"]}, {"input": "100 100 28 22 47 50\r\n", "output": ["0 0 94 100"]}, {"input": "100 100 44 36 96 21\r\n", "output": ["0 25 96 46"]}, {"input": ... | 100 | 100 | 100 | [{'input': '4309493 76088457 2523467 46484812 909115 53662610\r\n', 'output': ['1887086 960803 3159847 76088457']}, {'input': '100 100 32 63 2 41\r\n', 'output': ['30 18 34 100']}, {'input': '27087649 52123970 20327636 19640608 8481031 14569965\r\n', 'output': ['1644556 0 27087649 43709895']}, {'input': '100 100 16 60 ... | [{'input': '100 100 20 53 6 22\r\n', 'output': ['6 1 33 100']}, {'input': '81460 7041354 53032 1297536 41496 5748697\r\n', 'output': ['27916 0 78148 6958949']}, {'input': '1063740 2675928 277215 2022291 204933 298547\r\n', 'output': ['0 1183193 1024665 2675928']}, {'input': '27087649 52123970 20327636 19640608 8481031 ... | [{'input': '33417574 19362112 17938303 4013355 10231192 2596692\r\n', 'output': ['166200 0 33417574 8439249']}, {'input': '1000000000 1000000000 1000000000 1000000000 1000000000 1\r\n', 'output': ['0 999999999 1000000000 1000000000']}, {'input': '48445042 43730155 14655564 6244917 43454856 2866363\r\n', 'output': ['0 4... | [{'input': '1000000000 1000000000 1000000000 1000000000 1 1\r\n', 'output': ['0 0 1000000000 1000000000']}, {'input': '100 100 28 22 47 50\r\n', 'output': ['0 0 94 100']}, {'input': '11996821 42550832 8901163 19214381 3510233 20406511\r\n', 'output': ['4976355 0 11996821 40813022']}, {'input': '33417574 19362112 179383... | [{'input': '1000000000 1000000000 867388331 312356312 405405075 887925029\r\n', 'output': ['594594925 0 1000000000 887925029']}, {'input': '48445042 43730155 14655564 6244917 43454856 2866363\r\n', 'output': ['0 4811735 43454856 7678098']}, {'input': '1000000000 1000000000 84072459 754904836 124007132 824006731\r\n', '... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 90 | 100 | 90 | 100 | 128 | 100 | 100 | 96 |
["2 4 2", "6 13 1", "1 4 3"] | A single line contains three space-separated integers a, b, k (1 ≤ a, b, k ≤ 106; a ≤ b). | 3e1751a2990134f2132d743afe02a10e | #include <iostream>
using namespace std;
int a,b,k,q[1000006];
bool pr[1000006];
int main (){
cin >> a >> b >> k;
pr[1] = 1;
for (int i = 2; i*i <= b; i++){
if (pr[i] == 0){
for(int j = i*i; j <= b; j+=i)
pr[j] = 1;
}
}
for (int i = 1; i <= b; ... | ["3", "4", "-1"] | C++ | null | In a single line print a single integer — the required minimum l. If there's no solution, print -1. | You've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.Consider positive integers a, a + 1, ..., b (a ≤ b). You want to find the minimum integer l (1 ≤ l ≤ b - a + 1) such that for any integ... | [{"input": "2 4 2\r\n", "output": ["3"]}, {"input": "6 13 1\r\n", "output": ["4"]}, {"input": "1 4 3\r\n", "output": ["-1"]}, {"input": "5 8 2\r\n", "output": ["4"]}, {"input": "8 10 3\r\n", "output": ["-1"]}, {"input": "1 5 2\r\n", "output": ["3"]}, {"input": "6 8 3\r\n", "output": ["-1"]}, {"input": "21 29 2\r\n", "o... | 100 | 100 | 100 | [{'input': '4 4 95\r\n', 'output': ['-1']}, {'input': '12357 534133 2\r\n', 'output': ['138']}, {'input': '5 5 10\r\n', 'output': ['-1']}, {'input': '579857 857749 9\r\n', 'output': ['300']}, {'input': '1000 900000 50000\r\n', 'output': ['659334']}] | [{'input': '20 1000000 40000\r\n', 'output': ['539580']}, {'input': '1 1000000 78499\r\n', 'output': ['-1']}, {'input': '8 10 3\r\n', 'output': ['-1']}, {'input': '6 8 3\r\n', 'output': ['-1']}, {'input': '1 2 1\r\n', 'output': ['2']}] | [{'input': '404430 864261 6\r\n', 'output': ['236']}, {'input': '2 5 2\r\n', 'output': ['3']}, {'input': '689973 807140 7\r\n', 'output': ['236']}, {'input': '100000 1000000 7821\r\n', 'output': ['108426']}, {'input': '5 5 10\r\n', 'output': ['-1']}] | [{'input': '690059 708971 10000\r\n', 'output': ['-1']}, {'input': '1 5 2\r\n', 'output': ['3']}, {'input': '21 29 2\r\n', 'output': ['9']}, {'input': '1000 10000 13\r\n', 'output': ['168']}, {'input': '1 4 3\r\n', 'output': ['-1']}] | [{'input': '404430 864261 6\r\n', 'output': ['236']}, {'input': '2 5 2\r\n', 'output': ['3']}, {'input': '1 5 2\r\n', 'output': ['3']}, {'input': '177146 548389 8\r\n', 'output': ['240']}, {'input': '690059 708971 10000\r\n', 'output': ['-1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.31 | 96.15 | 92.31 | 96.15 | 96.15 | 129 | 100 | 100 | 94.614 |
["5 2 433416647", "10 3 409693891", "65 4 177545087"] | The single line of the input contains three integers n, d and mod (1 ≤ n ≤ 1000, 2 ≤ d ≤ 10, 108 ≤ mod ≤ 109) — the number of vertices in the tree, the degree of internal vertices and the prime modulo. | bdd0fc1d6dbab5eeb5aea135fdfffc9d | #include <bits/stdc++.h>
using namespace std;
const int maxn=1005;
const int maxd=11;
long long n,d,mod,dp[maxn][maxd],pd[maxn][maxd],f,t[maxd];
inline long long ksm(long long x,long long n) {
long long ret=1;
while (n) {
if (n&1)
ret=ret*x%mod;
n>>=1;
x=x*x%mod;
}
re... | ["1", "2", "910726"] | C++ | null | Print the number of trees over the modulo mod. | A tree is a connected graph without cycles.Two trees, consisting of n vertices each, are called isomorphic if there exists a permutation p: {1, ..., n} → {1, ..., n} such that the edge (u, v) is present in the first tree if and only if the edge (pu, pv) is present in the second tree.Vertex of the tree is called interna... | [{"input": "5 2 433416647\r\n", "output": ["1"]}, {"input": "10 3 409693891\r\n", "output": ["2"]}, {"input": "65 4 177545087\r\n", "output": ["910726"]}, {"input": "2 2 434448163\r\n", "output": ["1"]}, {"input": "2 3 434448163\r\n", "output": ["1"]}, {"input": "2 4 434448163\r\n", "output": ["1"]}, {"input": "2 5 434... | 100 | 100 | 100 | [{'input': '5 2 433416647\r\n', 'output': ['1']}, {'input': '104 7 434448163\r\n', 'output': ['47207']}, {'input': '996 8 990767311\r\n', 'output': ['350615945']}, {'input': '1 2 727733989\r\n', 'output': ['1']}, {'input': '995 4 817408561\r\n', 'output': ['36421881']}] | [{'input': '1 4 904448911\r\n', 'output': ['1']}, {'input': '1000 3 750160753\r\n', 'output': ['16572167']}, {'input': '1000 2 750160753\r\n', 'output': ['1']}, {'input': '106 9 434448163\r\n', 'output': ['1296']}, {'input': '999 2 750160753\r\n', 'output': ['1']}] | [{'input': '999 2 750160753\r\n', 'output': ['1']}, {'input': '65 4 177545087\r\n', 'output': ['910726']}, {'input': '102 4 904448911\r\n', 'output': ['0']}, {'input': '5 2 433416647\r\n', 'output': ['1']}, {'input': '2 2 434448163\r\n', 'output': ['1']}] | [{'input': '1000 5 970400047\r\n', 'output': ['0']}, {'input': '1 8 727733989\r\n', 'output': ['1']}, {'input': '998 5 680633279\r\n', 'output': ['233182629']}, {'input': '989 8 990767311\r\n', 'output': ['976760285']}, {'input': '180 3 434448163\r\n', 'output': ['106622108']}] | [{'input': '992 10 762763321\r\n', 'output': ['571064998']}, {'input': '1 3 727733989\r\n', 'output': ['1']}, {'input': '1000 3 750160753\r\n', 'output': ['16572167']}, {'input': '102 6 944036243\r\n', 'output': ['748711']}, {'input': '2 3 434448163\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 96.88 | 130 | 100 | 100 | 99.376 |
["5 11", "6 16"] | The only line of the input contains two integers $$$n$$$ and $$$S$$$ ($$$1 \le n \le 100\,000$$$, $$$1 \le S \le 10^9$$$) | 04c067326ec897091c3dbcf4d134df96 | #include <iostream>
#include <cstdio>
#include <cctype>
#define il inline
#define vd void
#define rep(i,x,y) for(register int i=x;i<=y;++i)
#define drp(i,x,y) for(register int i=x;i>=y;--i)
using namespace std;
const int Len=2333333;
char buf[Len],*p1=buf,*p2=buf,duf[Len],*q1=duf;
il char gc(); il int rd(); il vd pc(ch... | ["3", "3"] | C++ | NoteIn the first example, some of the possible ways to get sum $$$11$$$ with $$$3$$$ coins are: $$$(3, 4, 4)$$$ $$$(2, 4, 5)$$$ $$$(1, 5, 5)$$$ $$$(3, 3, 5)$$$ It is impossible to get sum $$$11$$$ with less than $$$3$$$ coins.In the second example, some of the possible ways to get sum $$$16$$$ with $$$3$$$ coins are:... | Print exactly one integer — the minimum number of coins required to obtain sum $$$S$$$. | You have unlimited number of coins with values $$$1, 2, \ldots, n$$$. You want to select some set of coins having the total value of $$$S$$$. It is allowed to have multiple coins with the same value in the set. What is the minimum number of coins required to get sum $$$S$$$? | [{"input": "5 11\r\n", "output": ["3"]}, {"input": "6 16\r\n", "output": ["3"]}, {"input": "14 28\r\n", "output": ["2"]}, {"input": "5 29\r\n", "output": ["6"]}, {"input": "10 24\r\n", "output": ["3"]}, {"input": "1 30\r\n", "output": ["30"]}, {"input": "14969 66991573\r\n", "output": ["4476"]}, {"input": "1 1000000000... | 100 | 100 | 100 | [{'input': '5 11\r\n', 'output': ['3']}, {'input': '2 999999999\r\n', 'output': ['500000000']}, {'input': '11 35\r\n', 'output': ['4']}, {'input': '47832 942980453\r\n', 'output': ['19715']}, {'input': '12 45\r\n', 'output': ['4']}] | [{'input': '4821 917142246\r\n', 'output': ['190240']}, {'input': '12 394018478\r\n', 'output': ['32834874']}, {'input': '90952 904040054\r\n', 'output': ['9940']}, {'input': '1 1000000000\r\n', 'output': ['1000000000']}, {'input': '66269 356663481\r\n', 'output': ['5383']}] | [{'input': '73439 384841883\r\n', 'output': ['5241']}, {'input': '2 999999999\r\n', 'output': ['500000000']}, {'input': '7 236413222\r\n', 'output': ['33773318']}, {'input': '45084 431878651\r\n', 'output': ['9580']}, {'input': '6 16\r\n', 'output': ['3']}] | [{'input': '1 1000000000\r\n', 'output': ['1000000000']}, {'input': '45084 431878651\r\n', 'output': ['9580']}, {'input': '8 750191967\r\n', 'output': ['93773996']}, {'input': '5 11\r\n', 'output': ['3']}, {'input': '10 46\r\n', 'output': ['5']}] | [{'input': '3 877026418\r\n', 'output': ['292342140']}, {'input': '83 361125900\r\n', 'output': ['4350915']}, {'input': '8 750191967\r\n', 'output': ['93773996']}, {'input': '45084 431878651\r\n', 'output': ['9580']}, {'input': '8 550991517\r\n', 'output': ['68873940']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 50 | 100 | 50 | 100 | 50 | 131 | 100 | 100 | 70 |
["1 3", "3 2", "5 0"] | The first line of the input contains two space-separated integers n and m (0 ≤ n, m ≤ 1 000 000, n + m > 0) — the number of students using two-block pieces and the number of students using three-block pieces, respectively. | 23f2c8cac07403899199abdcfd947a5a | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <string.h>
#include <string>
#define sqr(x) (x)*(x)
#define fi first
#define se second
#define ONLINE_JUDGE
using namespace std;
typedef long long ... | ["9", "8", "10"] | C++ | NoteIn the first case, the student using two-block pieces can make a tower of height 4, and the students using three-block pieces can make towers of height 3, 6, and 9 blocks. The tallest tower has a height of 9 blocks.In the second case, the students can make towers of heights 2, 4, and 8 with two-block pieces and tow... | Print a single integer, denoting the minimum possible height of the tallest tower. | Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks.The students don’t want to use too many blocks, but they also want to be unique... | [{"input": "1 3\r\n", "output": ["9"]}, {"input": "3 2\r\n", "output": ["8"]}, {"input": "5 0\r\n", "output": ["10"]}, {"input": "4 2\r\n", "output": ["9"]}, {"input": "0 1000000\r\n", "output": ["3000000"]}, {"input": "1000000 1\r\n", "output": ["2000000"]}, {"input": "1083 724\r\n", "output": ["2710"]}, {"input": "11... | 100 | 100 | 100 | [{'input': '500000 499000\r\n', 'output': ['1498500']}, {'input': '3 2\r\n', 'output': ['8']}, {'input': '999999 1000000\r\n', 'output': ['3000000']}, {'input': '300000 200000\r\n', 'output': ['750000']}, {'input': '651 420\r\n', 'output': ['1606']}] | [{'input': '300000 200000\r\n', 'output': ['750000']}, {'input': '10 988723\r\n', 'output': ['2966169']}, {'input': '14 42\r\n', 'output': ['126']}, {'input': '10 6\r\n', 'output': ['24']}, {'input': '918273 219\r\n', 'output': ['1836546']}] | [{'input': '163706 157895\r\n', 'output': ['482402']}, {'input': '32 16\r\n', 'output': ['72']}, {'input': '500000 167000\r\n', 'output': ['1000500']}, {'input': '974174 827926\r\n', 'output': ['2703150']}, {'input': '967227 894524\r\n', 'output': ['2792626']}] | [{'input': '15 10\r\n', 'output': ['38']}, {'input': '7 4\r\n', 'output': ['16']}, {'input': '300000 200000\r\n', 'output': ['750000']}, {'input': '1000000 666667\r\n', 'output': ['2500000']}, {'input': '0 1000000\r\n', 'output': ['3000000']}] | [{'input': '10 6\r\n', 'output': ['24']}, {'input': '4 3\r\n', 'output': ['10']}, {'input': '961920 647392\r\n', 'output': ['2413968']}, {'input': '651 420\r\n', 'output': ['1606']}, {'input': '4 2\r\n', 'output': ['9']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 132 | 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<bits/stdc++.h>
using namespace std ;
long long n, ans ;
int main()
{
cin >> n ;
if(2520 > n) cout << 0 << endl;
else
{
cout << n / 2520 << endl;
}
}
| ["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': '2519\r\n', 'output': ['0']}, {'input': '314159265\r\n', 'output': ['124666']}, {'input': '504000000000000000\r\n', 'output': ['200000000000000']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}] | [{'input': '2519\r\n', 'output': ['0']}, {'input': '314159265\r\n', 'output': ['124666']}, {'input': '3000\r\n', 'output': ['1']}, {'input': '3628800\r\n', 'output': ['1440']}, {'input': '2521\r\n', 'output': ['1']}] | [{'input': '3000\r\n', 'output': ['1']}, {'input': '2520\r\n', 'output': ['1']}, {'input': '2519\r\n', 'output': ['0']}, {'input': '3628800\r\n', 'output': ['1440']}, {'input': '314159265\r\n', 'output': ['124666']}] | [{'input': '3628800\r\n', 'output': ['1440']}, {'input': '2520\r\n', 'output': ['1']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}, {'input': '2519\r\n', 'output': ['0']}] | [{'input': '3628800\r\n', 'output': ['1440']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}, {'input': '314159265\r\n', 'output': ['124666']}, {'input': '2520\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 50 | 133 | 100 | 100 | 90 |
["2 4", "0 10", "107 109"] | The first and only line of input contains two space-separated integers a and b (0 ≤ a ≤ b ≤ 1018). | 2ed5a7a6176ed9b0bda1de21aad13d60 | #include <bits/stdc++.h>
using namespace std ;
typedef long long ll;
ll a, b, ans;
int main () {
cin >> a >> b;
if(a == b) {
cout << 1;
return 0;
}
long long x = b - a;
//cout << x << '\n';
if (x >= 5){
cout << 0;
return 0;
}
if (x == 1){
cout <... | ["2", "0", "2"] | C++ | NoteIn the first example, the last digit of is 2;In the second example, the last digit of is 0;In the third example, the last digit of is 2. | Output one line containing a single decimal digit — the last digit of the value that interests Koyomi. | Even if the world is full of counterfeits, I still regard it as wonderful.Pile up herbs and incense, and arise again from the flames and ashes of its predecessor — as is known to many, the phoenix does it like this.The phoenix has a rather long lifespan, and reincarnates itself once every a! years. Here a! denotes the ... | [{"input": "2 4\r\n", "output": ["2"]}, {"input": "0 10\r\n", "output": ["0"]}, {"input": "107 109\r\n", "output": ["2"]}, {"input": "10 13\r\n", "output": ["6"]}, {"input": "998244355 998244359\r\n", "output": ["4"]}, {"input": "999999999000000000 1000000000000000000\r\n", "output": ["0"]}, {"input": "2 3\r\n", "outpu... | 100 | 100 | 100 | [{'input': '101 1002\r\n', 'output': ['0']}, {'input': '6 107\r\n', 'output': ['0']}, {'input': '1 3\r\n', 'output': ['6']}, {'input': '11111234567890 11111234567898\r\n', 'output': ['0']}, {'input': '1 2\r\n', 'output': ['2']}] | [{'input': '1 22\r\n', 'output': ['0']}, {'input': '124 125\r\n', 'output': ['5']}, {'input': '535 536\r\n', 'output': ['6']}, {'input': '999999999999999999 1000000000000000000\r\n', 'output': ['0']}, {'input': '10 13\r\n', 'output': ['6']}] | [{'input': '0 999999\r\n', 'output': ['0']}, {'input': '6 19\r\n', 'output': ['0']}, {'input': '0 2\r\n', 'output': ['2']}, {'input': '999999999999999997 999999999999999999\r\n', 'output': ['2']}, {'input': '50000000062000007 50000000062000011\r\n', 'output': ['0']}] | [{'input': '0 2\r\n', 'output': ['2']}, {'input': '124 125\r\n', 'output': ['5']}, {'input': '50000000062000007 50000000062000011\r\n', 'output': ['0']}, {'input': '6 107\r\n', 'output': ['0']}, {'input': '1 1000\r\n', 'output': ['0']}] | [{'input': '1000000000000000000 1000000000000000000\r\n', 'output': ['1']}, {'input': '0 2\r\n', 'output': ['2']}, {'input': '124 125\r\n', 'output': ['5']}, {'input': '2 3\r\n', 'output': ['3']}, {'input': '1 22\r\n', 'output': ['0']}] | 100 | 100 | 100 | 100 | 100 | 88.89 | 88.89 | 77.78 | 88.89 | 100 | 87.5 | 87.5 | 75 | 87.5 | 100 | 134 | 100 | 88.89 | 87.5 |
["3 2 1", "4 2 2", "3 2 2"] | The single line of the input contains integers n, w and b (3 ≤ n ≤ 4000, 2 ≤ w ≤ 4000, 1 ≤ b ≤ 4000) — the number of days, the number of good events and the number of not-so-good events. It is guaranteed that w + b ≥ n. | 63e93a161bbff623323e66c98d5e20ac | #include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#define N 4010
#define mo 1000000009
#define int64 long long
#define For(i,x,y) for (i=x;i<=y;i++)
using namespace std;
int i,j,k,n,m,w,b;
int64 f1[N],f2[N],an;
inline int64 C(int n,int m) {
if (m>n) return 0;
if (!m) return 1;
ret... | ["2", "4", "4"] | C++ | NoteWe'll represent the good events by numbers starting from 1 and the not-so-good events — by letters starting from 'a'. Vertical lines separate days.In the first sample the possible ways are: "1|a|2" and "2|a|1". In the second sample the possible ways are: "1|a|b|2", "2|a|b|1", "1|b|a|2" and "2|b|a|1". In the third s... | Print the required number of ways modulo 1000000009 (109 + 9). | Polycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycarpus knows that he is in for w good events and b not-so-good events. At least one event is going to ta... | [{"input": "3 2 1\r\n", "output": ["2"]}, {"input": "4 2 2\r\n", "output": ["4"]}, {"input": "3 2 2\r\n", "output": ["4"]}, {"input": "3 3 1\r\n", "output": ["12"]}, {"input": "3 3 3\r\n", "output": ["72"]}, {"input": "4 2 3\r\n", "output": ["24"]}, {"input": "4 3 2\r\n", "output": ["48"]}, {"input": "10 10 10\r\n", "o... | 100 | 100 | 100 | [{'input': '300 300 1\r\n', 'output': ['775907030']}, {'input': '10 10 10\r\n', 'output': ['318389383']}, {'input': '3 3 3\r\n', 'output': ['72']}, {'input': '3 300 1\r\n', 'output': ['828107078']}, {'input': '4000 1000 3000\r\n', 'output': ['876839920']}] | [{'input': '4000 3998 2\r\n', 'output': ['296557186']}, {'input': '4000 100 3900\r\n', 'output': ['221262673']}, {'input': '4 2 3\r\n', 'output': ['24']}, {'input': '300 300 1\r\n', 'output': ['775907030']}, {'input': '4000 2 3998\r\n', 'output': ['686088712']}] | [{'input': '3 4000 4000\r\n', 'output': ['680114446']}, {'input': '4000 100 4000\r\n', 'output': ['908339579']}, {'input': '3 3 3\r\n', 'output': ['72']}, {'input': '4000 2 3998\r\n', 'output': ['686088712']}, {'input': '10 4 9\r\n', 'output': ['135283173']}] | [{'input': '300 300 1\r\n', 'output': ['775907030']}, {'input': '300 300 300\r\n', 'output': ['375912430']}, {'input': '4000 2000 2000\r\n', 'output': ['310481606']}, {'input': '3 2 1\r\n', 'output': ['2']}, {'input': '10 4 9\r\n', 'output': ['135283173']}] | [{'input': '3 2 1\r\n', 'output': ['2']}, {'input': '4 2 3\r\n', 'output': ['24']}, {'input': '4000 4000 1\r\n', 'output': ['63263244']}, {'input': '3 3 1\r\n', 'output': ['12']}, {'input': '4000 3998 2\r\n', 'output': ['296557186']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 135 | 100 | 100 | 100 |
["11\n00000000008", "22\n0011223344556677889988", "11\n31415926535"] | The first line contains an integer $$$n$$$ — the number of cards with digits that you have ($$$1 \leq n \leq 100$$$). The second line contains a string of $$$n$$$ digits (characters "0", "1", ..., "9") $$$s_1, s_2, \ldots, s_n$$$. The string will not contain any other characters, such as leading or trailing spaces. | 259d01b81bef5536b969247ff2c2d776 | #include<bits/stdc++.h>
using namespace std;
int num=0,n;
char ch;
int main() {
scanf("%d\n",&n);
for (int i=1;i<=n;i++) {
scanf("%c",&ch);
if (ch=='8') num++;
}
if (num==0) printf("0");
else {
if (num*11<=n) printf("%d",num);
else printf("%d",n/11);
}
return ... | ["1", "2", "0"] | C++ | NoteIn the first example, one phone number, "8000000000", can be made from these cards.In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789".In the third example you can't make any phone number from the given cards. | If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0. | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.You have $$$n$$$ cards with digits, and you want to use them to make as many phone... | [{"input": "11\r\n00000000008\r\n", "output": ["1"]}, {"input": "22\r\n0011223344556677889988\r\n", "output": ["2"]}, {"input": "11\r\n31415926535\r\n", "output": ["0"]}, {"input": "99\r\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\r\n", "output": ["9"]}, {"input"... | 100 | 100 | 100 | [{'input': '100\r\n2833898888858387469888804083887280788584887487186899808436848018181838884988432785338497585788803883\r\n', 'output': ['9']}, {'input': '51\r\n882889888888689888850888388887688788888888888858888\r\n', 'output': ['4']}, {'input': '74\r\n709888948748676889688165828864886888810634252883168584381898088287... | [{'input': '54\r\n438283821340622774637957966575424773837418828888614203\r\n', 'output': ['4']}, {'input': '20\r\n88888888888888888888\r\n', 'output': ['1']}, {'input': '44\r\n15920309219313427633220119270900111650391207\r\n', 'output': ['0']}, {'input': '84\r\n1812888882826085488580588715818888538884867858013811088588... | [{'input': '95\r\n29488352815808808845913584782288724288898869488882098428839370889284838688458247785878848884289\r\n', 'output': ['8']}, {'input': '11\r\n00000000008\r\n', 'output': ['1']}, {'input': '80\r\n88888888888888888888888888888888888888888888888888888888888888888888888888888888\r\n', 'output': ['7']}, {'input... | [{'input': '100\r\n8820286285185244938452488887088871457098945874486988698468788381417332842888928188688887641132194956\r\n', 'output': ['9']}, {'input': '66\r\n157941266854773786962397310504192100434183957442977444078457168272\r\n', 'output': ['5']}, {'input': '100\r\n88000000000000000000000000000000000000000000000000... | [{'input': '99\r\n097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108\r\n', 'output': ['9']}, {'input': '40\r\n8888888888888888888888888888888888888888\r\n', 'output': ['3']}, {'input': '81\r\n8088888834888878888888088888888888881888888883888888888888888686888884888888828... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 87.5 | 87.5 | 87.5 | 87.5 | 136 | 100 | 100 | 87.5 |
["1 993244853", "2 993244853", "3 993244853", "2019 993244853", "2020 437122297"] | The only line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 250\,000$$$, $$$10^8 \le m \le 10^9$$$, $$$m$$$ is prime). | 020d5dae7157d937c3f58554c9b155f9 | //#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include<bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#includ... | ["1", "6", "32", "923958830", "265955509"] | C++ | NoteFor sample input $$$n=3$$$, let's consider all permutations of length $$$3$$$: $$$[1, 2, 3]$$$, all subsegments are framed segment. Happiness is $$$6$$$. $$$[1, 3, 2]$$$, all subsegments except $$$[1, 2]$$$ are framed segment. Happiness is $$$5$$$. $$$[2, 1, 3]$$$, all subsegments except $$$[2, 3]$$$ are framed ... | Print $$$r$$$ ($$$0 \le r < m$$$), the sum of happiness for all permutations of length $$$n$$$, modulo a prime number $$$m$$$. | Recall that the permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is $$$... | [{"input": "1 993244853\r\n", "output": ["1"]}, {"input": "2 993244853\r\n", "output": ["6"]}, {"input": "3 993244853\r\n", "output": ["32"]}, {"input": "2019 993244853\r\n", "output": ["923958830"]}, {"input": "2020 437122297\r\n", "output": ["265955509"]}, {"input": "250000 993244853\r\n", "output": ["872048421"]}, {... | 100 | 100 | 100 | [{'input': '250000 993244853\r\n', 'output': ['872048421']}, {'input': '6 223676287\r\n', 'output': ['7728']}, {'input': '80428 410667659\r\n', 'output': ['284512223']}, {'input': '1000 100000651\r\n', 'output': ['92079298']}, {'input': '220424 428927617\r\n', 'output': ['43877713']}] | [{'input': '1 993244853\r\n', 'output': ['1']}, {'input': '200422 984828937\r\n', 'output': ['556345906']}, {'input': '100000 100000921\r\n', 'output': ['51605491']}, {'input': '160428 434183023\r\n', 'output': ['156691255']}, {'input': '6 223676287\r\n', 'output': ['7728']}] | [{'input': '249996 997202249\r\n', 'output': ['633673455']}, {'input': '249998 990040613\r\n', 'output': ['108188702']}, {'input': '32433 992864681\r\n', 'output': ['302084847']}, {'input': '20422 956269049\r\n', 'output': ['895579878']}, {'input': '9 298827211\r\n', 'output': ['4982400']}] | [{'input': '60426 547574749\r\n', 'output': ['323978028']}, {'input': '234324 994631069\r\n', 'output': ['720229385']}, {'input': '160428 434183023\r\n', 'output': ['156691255']}, {'input': '1 993244853\r\n', 'output': ['1']}, {'input': '80428 410667659\r\n', 'output': ['284512223']}] | [{'input': '180420 266525887\r\n', 'output': ['239713633']}, {'input': '32433 992864681\r\n', 'output': ['302084847']}, {'input': '250000 993244853\r\n', 'output': ['872048421']}, {'input': '220424 428927617\r\n', 'output': ['43877713']}, {'input': '1 993244853\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 137 | 100 | 100 | 100 |
["4 2 1 3", "7 2 2 4", "3 5 9 1"] | The first line of the input contains four space-separated positive integer numbers not exceeding 100 — lengthes of the sticks. | 8f5df9a41e6e100aa65b9fc1d26e447a | #include<bits/stdc++.h>
using namespace std;
int a[5];
int u[4];
bool f[5],falg;
void dfs(int dep)
{
if(dep==4)
{
if(u[1]+u[2]>u[3]&&u[1]+u[3]>u[2]&&u[2]+u[3]>u[1])
{
printf("TRIANGLE");
exit(0);
}
if(u[1]+u[2]>=u[3]&&u[1]+u[3]>=u[2]&&u[2]+u[3]>=u[1])falg=... | ["TRIANGLE", "SEGMENT", "IMPOSSIBLE"] | C++ | null | Output TRIANGLE if it is possible to construct a non-degenerate triangle. Output SEGMENT if the first case cannot take place and it is possible to construct a degenerate triangle. Output IMPOSSIBLE if it is impossible to construct any triangle. Remember that you are to use three sticks. It is not allowed to break the s... | Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of different colours. Naturally, one of the sticks is extra. It is not allo... | [{"input": "4 2 1 3\r\n", "output": ["TRIANGLE"]}, {"input": "7 2 2 4\r\n", "output": ["SEGMENT"]}, {"input": "3 5 9 1\r\n", "output": ["IMPOSSIBLE"]}, {"input": "3 1 5 1\r\n", "output": ["IMPOSSIBLE"]}, {"input": "10 10 10 10\r\n", "output": ["TRIANGLE"]}, {"input": "11 5 6 11\r\n", "output": ["TRIANGLE"]}, {"input": ... | 100 | 100 | 100 | [{'input': '85 16 61 9\r\n', 'output': ['IMPOSSIBLE']}, {'input': '5 11 2 25\r\n', 'output': ['IMPOSSIBLE']}, {'input': '45 25 5 15\r\n', 'output': ['IMPOSSIBLE']}, {'input': '5 4 5 5\r\n', 'output': ['TRIANGLE']}, {'input': '1 8 2 7\r\n', 'output': ['TRIANGLE']}] | [{'input': '10 30 7 20\r\n', 'output': ['SEGMENT']}, {'input': '81 64 9 7\r\n', 'output': ['IMPOSSIBLE']}, {'input': '27 6 18 53\r\n', 'output': ['IMPOSSIBLE']}, {'input': '4 10 4 4\r\n', 'output': ['TRIANGLE']}, {'input': '51 90 24 8\r\n', 'output': ['IMPOSSIBLE']}] | [{'input': '6 19 32 61\r\n', 'output': ['IMPOSSIBLE']}, {'input': '65 10 36 17\r\n', 'output': ['IMPOSSIBLE']}, {'input': '22 80 29 7\r\n', 'output': ['SEGMENT']}, {'input': '2 3 7 10\r\n', 'output': ['SEGMENT']}, {'input': '11 30 79 43\r\n', 'output': ['IMPOSSIBLE']}] | [{'input': '45 25 5 15\r\n', 'output': ['IMPOSSIBLE']}, {'input': '7 7 10 7\r\n', 'output': ['TRIANGLE']}, {'input': '13 25 12 1\r\n', 'output': ['SEGMENT']}, {'input': '7 2 2 7\r\n', 'output': ['TRIANGLE']}, {'input': '100 21 30 65\r\n', 'output': ['IMPOSSIBLE']}] | [{'input': '50 1 50 100\r\n', 'output': ['TRIANGLE']}, {'input': '1 9 1 9\r\n', 'output': ['TRIANGLE']}, {'input': '3 3 3 1\r\n', 'output': ['TRIANGLE']}, {'input': '4 3 2 8\r\n', 'output': ['TRIANGLE']}, {'input': '81 64 9 7\r\n', 'output': ['IMPOSSIBLE']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 90.91 | 100 | 100 | 95 | 100 | 95 | 100 | 90 | 138 | 100 | 98.182 | 96 |
["1 2", "8 16", "1 1"] | The single line contains space-separated integers l and r (1 ≤ l ≤ r ≤ 1018). Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier. | d90e99d539b16590c17328d79a5921e0 | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#define F first
#define S second
#define eps 1e-8
#define pb push_back... | ["3", "31", "0"] | C++ | null | In a single line print a single integer — the maximum value of for all pairs of integers a, b (l ≤ a ≤ b ≤ r). | A little girl loves problems on bitwise operations very much. Here's one of them.You are given two integers l and r. Let's consider the values of for all pairs of integers a and b (l ≤ a ≤ b ≤ r). Your task is to find the maximum value among all considered ones.Expression means applying bitwise excluding or operation... | [{"input": "1 2\r\n", "output": ["3"]}, {"input": "8 16\r\n", "output": ["31"]}, {"input": "1 1\r\n", "output": ["0"]}, {"input": "506 677\r\n", "output": ["1023"]}, {"input": "33 910\r\n", "output": ["1023"]}, {"input": "36 94\r\n", "output": ["127"]}, {"input": "10000000000 20000000000\r\n", "output": ["34359738367"]... | 100 | 100 | 100 | [{'input': '215365547805299155 861595308221385098\r\n', 'output': ['1152921504606846975']}, {'input': '259703440079833303 857510033561081530\r\n', 'output': ['1152921504606846975']}, {'input': '203359308073091683 455893840817516371\r\n', 'output': ['576460752303423487']}, {'input': '1 1000000000000000000\r\n', 'output'... | [{'input': '5000000 5900000\r\n', 'output': ['2097151']}, {'input': '10000000000 20000000000\r\n', 'output': ['34359738367']}, {'input': '203359308073091683 455893840817516371\r\n', 'output': ['576460752303423487']}, {'input': '47456305370335136 388462406071482688\r\n', 'output': ['576460752303423487']}, {'input': '8 1... | [{'input': '215365547805299155 861595308221385098\r\n', 'output': ['1152921504606846975']}, {'input': '797162752288318119 908416915938410706\r\n', 'output': ['576460752303423487']}, {'input': '23811264031960242 520940113721281721\r\n', 'output': ['576460752303423487']}, {'input': '501827377176522663 590153819613032662\... | [{'input': '454452550141901489 843034681327343036\r\n', 'output': ['1152921504606846975']}, {'input': '200851182089362664 449305852839820160\r\n', 'output': ['576460752303423487']}, {'input': '203359308073091683 455893840817516371\r\n', 'output': ['576460752303423487']}, {'input': '765369978472937483 796958953973862258... | [{'input': '9999999999998 9999999999999\r\n', 'output': ['1']}, {'input': '501827377176522663 590153819613032662\r\n', 'output': ['1152921504606846975']}, {'input': '780993382943360354 889872865454335075\r\n', 'output': ['576460752303423487']}, {'input': '36 94\r\n', 'output': ['127']}, {'input': '363313173638414449 50... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 87.5 | 87.5 | 87.5 | 87.5 | 139 | 100 | 100 | 87.5 |
["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 <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
long long ans=1,n,m,k;
int main()
{
cin >> n >> m >> k;
if (k == 1 || k>n){
for (int i = 1; i <= n; i++){ ans = (ans*m) % 1000000007; }
cout << ans;
}
else if (k == n){
for (int i = 1; i <= int((n + 1) / 2); i++)... | ["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': '10 10 1\r\n', 'output': ['999999937']}, {'input': '10 25 8\r\n', 'output': ['25']}, {'input': '1501 893 1501\r\n', 'output': ['889854713']}, {'input': '3 3 3\r\n', 'output': ['9']}, {'input': '1769 849 1000\r\n', 'output': ['849']}] | [{'input': '1999 1999 1999\r\n', 'output': ['21610777']}, {'input': '777 1 777\r\n', 'output': ['1']}, {'input': '1451 239 1451\r\n', 'output': ['968856942']}, {'input': '100 10 100\r\n', 'output': ['319300014']}, {'input': '1230 987 1\r\n', 'output': ['890209975']}] | [{'input': '784 1 1999\r\n', 'output': ['1']}, {'input': '1999 1999 1999\r\n', 'output': ['21610777']}, {'input': '13 9 1\r\n', 'output': ['865810542']}, {'input': '4 4 1\r\n', 'output': ['256']}, {'input': '10 23 9\r\n', 'output': ['529']}] | [{'input': '11 2 11\r\n', 'output': ['64']}, {'input': '11 2 5\r\n', 'output': ['4']}, {'input': '10 10 10\r\n', 'output': ['100000']}, {'input': '1501 893 1501\r\n', 'output': ['889854713']}, {'input': '5 2 5\r\n', 'output': ['8']}] | [{'input': '10 2 1\r\n', 'output': ['1024']}, {'input': '5 2 1\r\n', 'output': ['32']}, {'input': '345 1777 1\r\n', 'output': ['756253754']}, {'input': '1 1 1\r\n', 'output': ['1']}, {'input': '13 9 1\r\n', 'output': ['865810542']}] | 100 | 100 | 100 | 100 | 100 | 92.31 | 76.92 | 92.31 | 76.92 | 46.15 | 83.33 | 66.67 | 91.67 | 58.33 | 25 | 140 | 100 | 76.922 | 65 |
["2 3"] | The only line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 100\,000$$$), the number of rows and the number of columns of the field. | 0f1ab296cbe0952faa904f2bebe0567b | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll n,m,f[100010][2][2],k,ans;
//f[第i位][1黑0白][1/0前位与这位是否同色]
int main()
{
scanf("%lld%lld",&n,&m);
k=max(n,m);
f[1][0][0]=1;
f[1][1][0]=1;
for(int i=2;i<=k;i++)
{
f[i][0][0]=(f[i-1][1][0]+f[i-... | ["8"] | C++ | NoteThe picture below shows all possible random pictures of size $$$2$$$ by $$$3$$$. | Print one integer, the number of random pictures modulo $$$10^9 + 7$$$. | Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.To prove his skills, Ivan decided to demonstrate his friends a concept of random picture. A picture is a field of $$$n$... | [{"input": "2 3\r\n", "output": ["8"]}, {"input": "1 2\r\n", "output": ["4"]}, {"input": "1 1\r\n", "output": ["2"]}, {"input": "2 1\r\n", "output": ["4"]}, {"input": "1 3\r\n", "output": ["6"]}, {"input": "3 1\r\n", "output": ["6"]}, {"input": "2 5\r\n", "output": ["18"]}, {"input": "3 6\r\n", "output": ["30"]}, {"inp... | 100 | 100 | 100 | [{'input': '1 1\r\n', 'output': ['2']}, {'input': '2 5\r\n', 'output': ['18']}, {'input': '1 99999\r\n', 'output': ['822870997']}, {'input': '99999 1\r\n', 'output': ['822870997']}, {'input': '13771 94814\r\n', 'output': ['581579207']}] | [{'input': '2 3\r\n', 'output': ['8']}, {'input': '13771 94814\r\n', 'output': ['581579207']}, {'input': '52702 64157\r\n', 'output': ['1000000005']}, {'input': '2 1\r\n', 'output': ['4']}, {'input': '99999 100000\r\n', 'output': ['758107445']}] | [{'input': '1 3\r\n', 'output': ['6']}, {'input': '91697 91697\r\n', 'output': ['999949469']}, {'input': '2 3\r\n', 'output': ['8']}, {'input': '1 99998\r\n', 'output': ['112365460']}, {'input': '1 88588\r\n', 'output': ['153641669']}] | [{'input': '91248 82914\r\n', 'output': ['542035391']}, {'input': '1 88588\r\n', 'output': ['153641669']}, {'input': '99999 100000\r\n', 'output': ['758107445']}, {'input': '2 3\r\n', 'output': ['8']}, {'input': '1 2\r\n', 'output': ['4']}] | [{'input': '100000 100000\r\n', 'output': ['870472905']}, {'input': '1 99998\r\n', 'output': ['112365460']}, {'input': '2 2\r\n', 'output': ['6']}, {'input': '3 6\r\n', 'output': ['30']}, {'input': '99999 99999\r\n', 'output': ['645741985']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 141 | 100 | 100 | 100 |
["25\n2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 28", "5\n16 23 8 15 4", "3\n14 15 92"] | The first line of input contains K (1 ≤ K ≤ 25), the number of onsite finalists you know. The second line of input contains r1, r2, ..., rK (1 ≤ ri ≤ 106), the qualifying ranks of the finalists you know. All these ranks are distinct. | ef657588b4f2fe8b2ff5f8edc0ab8afd | #include<iostream>
#include<algorithm>
using namespace std;
int n;
int ans;
const int maxn=1e6+10;
int sum[maxn];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>sum[i];
}
sort(sum+1,sum+1+n);
if(sum[n]<=25)
{
cout<<"0"<<endl;
return 0;
}
else
{
ans=sum[n]-25;
}
cout<<ans<<endl;
return 0;
} | ["3", "0", "67"] | C++ | NoteIn the first example, you know all 25 onsite finalists. The contestants who ranked 1-st, 13-th, and 27-th must have declined, so the answer is 3. | Print the minimum possible number of contestants that declined the invitation to compete onsite. | This year, as in previous years, MemSQL is inviting the top 25 competitors from the Start[c]up qualification round to compete onsite for the final round. Not everyone who is eligible to compete onsite can afford to travel to the office, though. Initially the top 25 contestants are invited to come onsite. Each eligible ... | [{"input": "25\r\n2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 28\r\n", "output": ["3"]}, {"input": "5\r\n16 23 8 15 4\r\n", "output": ["0"]}, {"input": "3\r\n14 15 92\r\n", "output": ["67"]}, {"input": "1\r\n1000000\r\n", "output": ["999975"]}, {"input": "25\r\n1000000 999999 999998 999997 999996 99... | 100 | 100 | 100 | [{'input': '10\r\n17 11 7 13 18 12 14 5 16 2\r\n', 'output': ['0']}, {'input': '18\r\n24939 35558 47058 70307 26221 12866 3453 40422 47557 36322 40698 64060 10825 77777 48645 26124 4859 64222\r\n', 'output': ['77752']}, {'input': '25\r\n1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 99998... | [{'input': '25\r\n2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 28\r\n', 'output': ['3']}, {'input': '11\r\n6494 3961 1858 4351 8056 780 7720 6211 1961 8192 3621\r\n', 'output': ['8167']}, {'input': '2\r\n46 45\r\n', 'output': ['21']}, {'input': '18\r\n24939 35558 47058 70307 26221 12866 3453 40422 47... | [{'input': '6\r\n198 397 732 1234 309 827\r\n', 'output': ['1209']}, {'input': '14\r\n18809 9534 11652 6493 8929 9370 4125 23888 16403 3559 23649 19243 14289 17852\r\n', 'output': ['23863']}, {'input': '25\r\n58115 794098 753382 484882 238434 674285 690118 858677 196185 173301 349729 918792 600745 636016 122678 366783 ... | [{'input': '2\r\n26 27\r\n', 'output': ['2']}, {'input': '25\r\n58115 794098 753382 484882 238434 674285 690118 858677 196185 173301 349729 918792 600745 636016 122678 366783 137179 377098 917081 369620 449039 379412 503678 1000000 292099\r\n', 'output': ['999975']}, {'input': '4\r\n999 581 787 236\r\n', 'output': ['97... | [{'input': '24\r\n633483 654321 122445 481150 347578 37803 525083 151084 211073 358699 339420 452023 219553 119727 74852 66750 371279 405099 618894 649977 235337 607819 81649 649804\r\n', 'output': ['654296']}, {'input': '1\r\n1000000\r\n', 'output': ['999975']}, {'input': '11\r\n6494 3961 1858 4351 8056 780 7720 6211 ... | 100 | 100 | 100 | 100 | 100 | 100 | 81.82 | 81.82 | 81.82 | 100 | 100 | 75 | 75 | 75 | 100 | 142 | 100 | 89.092 | 85 |
["ya\n4\nah\noy\nto\nha", "hp\n2\nht\ntp", "ah\n1\nha"] | The first line contains two lowercase English letters — the password on the phone. The second line contains single integer n (1 ≤ n ≤ 100) — the number of words Kashtanka knows. The next n lines contain two lowercase English letters each, representing the words Kashtanka knows. The words are guaranteed to be distinct. | cad8283914da16bc41680857bd20fe9f | #include<stdio.h>
char a1,b1,a[23333],b[23333];
int i,j,n;
int main()
{
scanf(" %c%c",&a1,&b1);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf(" %c%c",&a[i],&b[i]);
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if((b[i]==a1&&a[j]==b1)||(a[i]==a1&&b[i]==b1))
{
printf("YES\n");
return 0;
}
}
}
pr... | ["YES", "NO", "YES"] | C++ | NoteIn the first example the password is "ya", and Kashtanka can bark "oy" and then "ah", and then "ha" to form the string "oyahha" which contains the password. So, the answer is "YES".In the second example Kashtanka can't produce a string containing password as a substring. Note that it can bark "ht" and then "tp" pro... | Print "YES" if Kashtanka can bark several words in a line forming a string containing the password, and "NO" otherwise. You can print each letter in arbitrary case (upper or lower). | As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of two lowercase English letters.Mu-mu's enemy Kashtanka wants to unlock Mu-mu's pho... | [{"input": "ya\r\n4\r\nah\r\noy\r\nto\r\nha\r\n", "output": ["YES"]}, {"input": "hp\r\n2\r\nht\r\ntp\r\n", "output": ["NO"]}, {"input": "ah\r\n1\r\nha\r\n", "output": ["YES"]}, {"input": "bb\r\n4\r\nba\r\nab\r\naa\r\nbb\r\n", "output": ["YES"]}, {"input": "bc\r\n4\r\nca\r\nba\r\nbb\r\ncc\r\n", "output": ["YES"]}, {"inp... | 100 | 100 | 100 | [{'input': 'ay\r\n1\r\nay\r\n', 'output': ['YES']}, {'input': 'if\r\n100\r\njd\r\nbc\r\nje\r\nhi\r\nga\r\nde\r\nkb\r\nfc\r\ncd\r\ngd\r\naj\r\ncb\r\nei\r\nbf\r\ncf\r\ndk\r\ndb\r\ncg\r\nki\r\ngg\r\nkg\r\nfa\r\nkj\r\nii\r\njf\r\njg\r\ngb\r\nbh\r\nbg\r\neh\r\nhj\r\nhb\r\ndg\r\ndj\r\njc\r\njb\r\nce\r\ndi\r\nig\r\nci\r\ndf\r... | [{'input': 'ok\r\n1\r\nok\r\n', 'output': ['YES']}, {'input': 'az\r\n1\r\nby\r\n', 'output': ['NO']}, {'input': 'aa\r\n2\r\nca\r\ncc\r\n', 'output': ['NO']}, {'input': 'aa\r\n1\r\naa\r\n', 'output': ['YES']}, {'input': 'hp\r\n1\r\nhp\r\n', 'output': ['YES']}] | [{'input': 'aa\r\n1\r\naa\r\n', 'output': ['YES']}, {'input': 'hh\r\n50\r\nag\r\nhg\r\ndg\r\nfh\r\neg\r\ngh\r\ngd\r\nda\r\nbh\r\nab\r\nhf\r\ndc\r\nhb\r\nfe\r\nad\r\nec\r\nac\r\nfd\r\nca\r\naf\r\ncg\r\nhd\r\neb\r\nce\r\nhe\r\nha\r\ngb\r\nea\r\nae\r\nfb\r\nff\r\nbe\r\nch\r\nhh\r\nee\r\nde\r\nge\r\ngf\r\naa\r\ngg\r\neh\r\... | [{'input': 'ah\r\n1\r\nah\r\n', 'output': ['YES']}, {'input': 'fe\r\n50\r\nje\r\nbi\r\nbg\r\ngc\r\nfb\r\nig\r\ndf\r\nji\r\ndg\r\nfe\r\nfc\r\ncf\r\ngf\r\nai\r\nhe\r\nac\r\nch\r\nja\r\ngh\r\njf\r\nge\r\ncb\r\nij\r\ngb\r\ncg\r\naf\r\neh\r\nee\r\nhd\r\njd\r\njb\r\nii\r\nca\r\nci\r\nga\r\nab\r\nhi\r\nag\r\nfj\r\nej\r\nfi\r\... | [{'input': 'qc\r\n2\r\nyc\r\nkr\r\n', 'output': ['NO']}, {'input': 'sb\r\n1\r\nsb\r\n', 'output': ['YES']}, {'input': 'dd\r\n2\r\nac\r\ndc\r\n', 'output': ['NO']}, {'input': 'bb\r\n4\r\nba\r\nab\r\naa\r\nbb\r\n', 'output': ['YES']}, {'input': 'sh\r\n1\r\nsh\r\n', 'output': ['YES']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 92.86 | 100 | 100 | 92.86 | 143 | 100 | 100 | 95.716 |
["XX.\n...\n.XX", "X.X\nX..\n..."] | Input contains the matrix of three rows of three symbols each. Symbol «X» means that the corresponding button was pressed, and «.» means that is was not pressed. The matrix may contain no «X», also it may contain no «.». | 6a5fe5fac8a4e3993dc3423180cdd6a9 | #include<bits/stdc++.h>
using namespace std;
string s1,s2,s3;
int main(){
cin>>s1>>s2>>s3;
s1=s1+s2;
s1=s1+s3;
for(int i=0;i<=3;i++){
if(s1[i]!=s1[8-i]){
printf("NO");
return 0;
}
}
printf("YES");
return 0;
} | ["YES", "NO"] | C++ | NoteIf you are not familiar with the term «central symmetry», you may look into http://en.wikipedia.org/wiki/Central_symmetry | Print YES if the password is symmetric with respect to the central button of the terminal and NO otherwise. | There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo for many years. When, finally, Pearlo learned all secrets of espionage... | [{"input": "XX.\r\n...\r\n.XX\r\n", "output": ["YES"]}, {"input": "X.X\r\nX..\r\n...\r\n", "output": ["NO"]}, {"input": "...\r\n...\r\n...\r\n", "output": ["YES"]}, {"input": ".X.\r\n.X.\r\n.X.\r\n", "output": ["YES"]}, {"input": "XXX\r\nXXX\r\nXXX\r\n", "output": ["YES"]}, {"input": "XXX\r\nX.X\r\nXXX\r\n", "output": ... | 100 | 100 | 100 | [{'input': '.X.\r\n...\r\n...\r\n', 'output': ['NO']}, {'input': 'XXX\r\n...\r\nXXX\r\n', 'output': ['YES']}, {'input': '...\r\nX.X\r\n...\r\n', 'output': ['YES']}, {'input': '..X\r\nX.X\r\nX..\r\n', 'output': ['YES']}, {'input': '.X.\r\n...\r\nX.X\r\n', 'output': ['NO']}] | [{'input': 'X..\r\n.X.\r\n..X\r\n', 'output': ['YES']}, {'input': 'XXX\r\n.X.\r\nXXX\r\n', 'output': ['YES']}, {'input': 'X.X\r\nX.X\r\nX.X\r\n', 'output': ['YES']}, {'input': '...\r\nX.X\r\nX..\r\n', 'output': ['NO']}, {'input': 'XXX\r\nXXX\r\nXXX\r\n', 'output': ['YES']}] | [{'input': 'X.X\r\nX..\r\n...\r\n', 'output': ['NO']}, {'input': '..X\r\n...\r\nX..\r\n', 'output': ['YES']}, {'input': '...\r\n...\r\n..X\r\n', 'output': ['NO']}, {'input': 'XXX\r\n.X.\r\nXXX\r\n', 'output': ['YES']}, {'input': '..X\r\n...\r\n...\r\n', 'output': ['NO']}] | [{'input': 'XXX\r\nX.X\r\nXXX\r\n', 'output': ['YES']}, {'input': 'XXX\r\n...\r\nXXX\r\n', 'output': ['YES']}, {'input': '...\r\n..X\r\nXXX\r\n', 'output': ['NO']}, {'input': 'X.X\r\nX..\r\n...\r\n', 'output': ['NO']}, {'input': '.X.\r\n.X.\r\n.X.\r\n', 'output': ['YES']}] | [{'input': '...\r\n...\r\n.X.\r\n', 'output': ['NO']}, {'input': 'XXX\r\n.X.\r\n...\r\n', 'output': ['NO']}, {'input': '...\r\n...\r\n...\r\n', 'output': ['YES']}, {'input': 'XXX\r\n.X.\r\nXXX\r\n', 'output': ['YES']}, {'input': 'XXX\r\nXXX\r\nXXX\r\n', 'output': ['YES']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 144 | 100 | 100 | 100 |
["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 <bits/stdc++.h>
#include <stdio.h>
#define PB push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define MAX 4002
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
ll m,b;
ll f;
int main()
{
cin>>m>>b;
for(ll x=0;x<=m*b;x++)
{
ll y= -(x+m-1)/m+b;
f=max(f,... | ["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': '646 1171\r\n', 'output': ['49802404050106']}, {'input': '259 770\r\n', 'output': ['2281741798549']}, {'input': '139 9252\r\n', 'output': ['1137907933561080']}, {'input': '945 2563\r\n', 'output': ['1115613396515835']}, {'input': '6 3\r\n', 'output': ['171']}] | [{'input': '446 5030\r\n', 'output': ['1878390629993745']}, {'input': '440 8704\r\n', 'output': ['9470470760118060']}, {'input': '539 9221\r\n', 'output': ['16893595018603386']}, {'input': '10 1\r\n', 'output': ['55']}, {'input': '46 3844\r\n', 'output': ['9007500020760']}] | [{'input': '393 4874\r\n', 'output': ['1327174123029975']}, {'input': '440 8704\r\n', 'output': ['9470470760118060']}, {'input': '10 1\r\n', 'output': ['55']}, {'input': '369 4511\r\n', 'output': ['927715710215505']}, {'input': '646 1171\r\n', 'output': ['49802404050106']}] | [{'input': '1000 10000\r\n', 'output': ['74133360011484445']}, {'input': '446 5030\r\n', 'output': ['1878390629993745']}, {'input': '440 8704\r\n', 'output': ['9470470760118060']}, {'input': '393 4874\r\n', 'output': ['1327174123029975']}, {'input': '10 1\r\n', 'output': ['55']}] | [{'input': '289 6393\r\n', 'output': ['1620061541812350']}, {'input': '2 3\r\n', 'output': ['25']}, {'input': '259 770\r\n', 'output': ['2281741798549']}, {'input': '515 1563\r\n', 'output': ['75233740231341']}, {'input': '1 5\r\n', 'output': ['30']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 145 | 100 | 100 | 100 |
["1", "2", "10"] | The only line of the input file contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the number of roman digits to use. | 75ec99318736a8a1b62a8d51efd95355 | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define per(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
template <typename T1, typename T2>
inline bool umin(T1& x, const T2& y){return x>y ? ... | ["4", "10", "244"] | C++ | NoteIn the first sample there are exactly $$$4$$$ integers which can be represented — I, V, X and L.In the second sample it is possible to represent integers $$$2$$$ (II), $$$6$$$ (VI), $$$10$$$ (VV), $$$11$$$ (XI), $$$15$$$ (XV), $$$20$$$ (XX), $$$51$$$ (IL), $$$55$$$ (VL), $$$60$$$ (XL) and $$$100$$$ (LL). | Output a single integer — the number of distinct integers which can be represented using $$$n$$$ roman digits exactly. | Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers $$$1$$$, $$$5$$$, $$$10$$$ and $$$50$$$ respectively. The use of other roman digits is not allowed.Numbers in this system are written as a sequence of one or more digits. We define the value of ... | [{"input": "1\r\n", "output": ["4"]}, {"input": "2\r\n", "output": ["10"]}, {"input": "10\r\n", "output": ["244"]}, {"input": "1000\r\n", "output": ["48753"]}, {"input": "2000\r\n", "output": ["97753"]}, {"input": "5000\r\n", "output": ["244753"]}, {"input": "10000\r\n", "output": ["489753"]}, {"input": "111199\r\n", "... | 100 | 100 | 100 | [{'input': '2\r\n', 'output': ['10']}, {'input': '1200\r\n', 'output': ['58553']}, {'input': '14\r\n', 'output': ['439']}, {'input': '5\r\n', 'output': ['56']}, {'input': '600000000\r\n', 'output': ['29399999753']}] | [{'input': '20\r\n', 'output': ['733']}, {'input': '1\r\n', 'output': ['4']}, {'input': '55\r\n', 'output': ['2448']}, {'input': '5\r\n', 'output': ['56']}, {'input': '101232812\r\n', 'output': ['4960407541']}] | [{'input': '9\r\n', 'output': ['198']}, {'input': '1200\r\n', 'output': ['58553']}, {'input': '6\r\n', 'output': ['83']}, {'input': '116\r\n', 'output': ['5437']}, {'input': '2\r\n', 'output': ['10']}] | [{'input': '5\r\n', 'output': ['56']}, {'input': '10\r\n', 'output': ['244']}, {'input': '10000\r\n', 'output': ['489753']}, {'input': '155\r\n', 'output': ['7348']}, {'input': '1000\r\n', 'output': ['48753']}] | [{'input': '111199\r\n', 'output': ['5448504']}, {'input': '10\r\n', 'output': ['244']}, {'input': '12\r\n', 'output': ['341']}, {'input': '7\r\n', 'output': ['116']}, {'input': '2000\r\n', 'output': ['97753']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 146 | 100 | 100 | 100 |
["4\n1001", "1\n1"] | The first line contains integer number n (1 ≤ n ≤ 100) — the length of string s. The second line contains the string s consisting of characters "0" and "1". It is guaranteed that the string s is correct. | ac244791f8b648d672ed3de32ce0074d | #include <iostream>
using namespace std;
string s;
int k,i;
main(){
cin>>i>>s;
for (i=0; i<s.size();i++) if (s[i]=='0') k++;
if(k!=s.size()) cout<<1;
for (i=0; i<k; i++) cout<<0;
} | ["100", "1"] | C++ | NoteIn the first example you can obtain the answer by the following sequence of operations: "1001" "1010" "1100" "100".In the second example you can't obtain smaller answer no matter what operations you use. | Print one string — the minimum correct string that you can obtain from the given one. | String can be called correct if it consists of characters "0" and "1" and there are no redundant leading zeroes. Here are some examples: "0", "10", "1001".You are given a correct string s.You can perform two different operations on this string: swap any pair of adjacent characters (for example, "101" "110"); replac... | [{"input": "4\r\n1001\r\n", "output": ["100"]}, {"input": "1\r\n1\r\n", "output": ["1"]}, {"input": "100\r\n1110111100001111011111111010110011111111011110000111101101011100110110001011000000101010110101011100\r\n", "output": ["1000000000000000000000000000000000000000"]}, {"input": "100\r\n100000000000000000000000000000... | 100 | 100 | 100 | [{'input': '100\r\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\r\n', 'output': ['1']}, {'input': '50\r\n10010010000000000000000000000000000000001000000000\r\n', 'output': ['10000000000000000000000000000000000000000000000']}, {'input': '100\r\n11111111111111111111... | [{'input': '1\r\n0\r\n', 'output': ['0']}, {'input': '1\r\n1\r\n', 'output': ['1']}, {'input': '3\r\n110\r\n', 'output': ['10']}, {'input': '50\r\n10010010000000000000000000000000000000001000000000\r\n', 'output': ['10000000000000000000000000000000000000000000000']}, {'input': '100\r\n1000000000000000000000000000000000... | [{'input': '100\r\n1111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111\r\n', 'output': ['10']}, {'input': '100\r\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\r\n', 'output': ['1']}, {'input': '100\r\n11101111000011... | [{'input': '100\r\n1110111100001111011111111010110011111111011110000111101101011100110110001011000000101010110101011100\r\n', 'output': ['1000000000000000000000000000000000000000']}, {'input': '100\r\n1111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111\r\n', 'output': ['... | [{'input': '8\r\n10101010\r\n', 'output': ['10000']}, {'input': '4\r\n1001\r\n', 'output': ['100']}, {'input': '100\r\n1110111100001111011111111010110011111111011110000111101101011100110110001011000000101010110101011100\r\n', 'output': ['1000000000000000000000000000000000000000']}, {'input': '1\r\n1\r\n', 'output': ['1... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 100 | 87.5 | 87.5 | 87.5 | 147 | 100 | 100 | 90 |
["4 1 2"] | The first line of input contains three integers n (2 ≤ n ≤ 108), c0 and c1 (0 ≤ c0, c1 ≤ 108) — the number of letters in the alphabet, and costs of '0' and '1', respectively. | 39b824b740a40f68bae39b8d9f0adcbe | #include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ans;
int n,a,b,s;
int c[20005];
bool check(ll m){
int sum=m/a;
for (int i=0;i<=s;i++) c[i]=i+1;
for (int i=1;1ll*i*b<=m&&sum<n;i++)
for (int j=0;1ll*i*b+1ll*j*a<=m&&sum<n;j++)
sum+=c[j],c[j]+=(j?c[j-1]:0);
return sum>=n;
}
void calc(ll m){
... | ["12"] | C++ | NoteThere are 4 letters in the alphabet. The optimal encoding is "00", "01", "10", "11". There are 4 zeroes and 4 ones used, so the total cost is 4·1 + 4·2 = 12. | Output a single integer — minimum possible total a cost of the whole alphabet. | R3D3 spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of popular local bands. While listening to "The White Buttons" and their hit song "Dacan the Baker", he met anoth... | [{"input": "4 1 2\r\n", "output": ["12"]}, {"input": "2 1 5\r\n", "output": ["6"]}, {"input": "3 1 1\r\n", "output": ["5"]}, {"input": "5 5 5\r\n", "output": ["60"]}, {"input": "4 0 0\r\n", "output": ["0"]}, {"input": "6 0 6\r\n", "output": ["30"]}, {"input": "6 6 0\r\n", "output": ["30"]}, {"input": "2 1 2\r\n", "outp... | 100 | 100 | 100 | [{'input': '2 50000000 0\r\n', 'output': ['50000000']}, {'input': '2 1 5\r\n', 'output': ['6']}, {'input': '1389928 84918086 54850899\r\n', 'output': ['1953921305304795']}, {'input': '28258585 6194848 49146833\r\n', 'output': ['14441957862691571']}, {'input': '9678 133 5955\r\n', 'output': ['196970292']}] | [{'input': '70931513 41663344 29095671\r\n', 'output': ['64816798089350400']}, {'input': '100000000 50000000 0\r\n', 'output': ['4999999950000000']}, {'input': '100000000 0 100000000\r\n', 'output': ['9999999900000000']}, {'input': '9678 133 5955\r\n', 'output': ['196970292']}, {'input': '6 0 6\r\n', 'output': ['30']}] | [{'input': '8619 6736 9365\r\n', 'output': ['900966230']}, {'input': '100000000 1 0\r\n', 'output': ['99999999']}, {'input': '4 1 2\r\n', 'output': ['12']}, {'input': '100000000 50000000 100000000\r\n', 'output': ['191720992950000000']}, {'input': '4755 6759 4899\r\n', 'output': ['336456318']}] | [{'input': '25721978 63666459 14214946\r\n', 'output': ['20847031763747988']}, {'input': '64302230 83635846 22670768\r\n', 'output': ['77790985833197594']}, {'input': '34291060 92893503 64680754\r\n', 'output': ['66960630525688676']}, {'input': '92820995 96034432 40568102\r\n', 'output': ['158135215198065044']}, {'inpu... | [{'input': '8642 5709 51\r\n', 'output': ['135655830']}, {'input': '64302230 83635846 22670768\r\n', 'output': ['77790985833197594']}, {'input': '2793 175 3594\r\n', 'output': ['36405762']}, {'input': '4730 8020 8722\r\n', 'output': ['484587068']}, {'input': '61988457 90532323 72913492\r\n', 'output': ['130757350538583... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 93.94 | 93.94 | 100 | 100 | 100 | 92.86 | 96.43 | 148 | 100 | 97.576 | 97.858 |
["2", "4", "8", "20"] | The input contains one integer $$$n$$$ ($$$2 \le n \le 20$$$), $$$n$$$ is an even number. | ad0985c56a207f76afa2ecd642f56728 | #include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
typedef long long ll;
const ll Maxn=20+5;
ll n,mul[Maxn];
int main()
{ scanf("%lld",&n);
mul[0]=1;
for(ll i=1;i<=n;i++)mul[i]=1ll*mul[i-1]*i;
printf("%lld\n",mul[n]/mul[n/2]/mul[n/2]/2*mul[n/2-1]*mul[n/2-1]);
re... | ["1", "3", "1260", "12164510040883200"] | C++ | null | Print one integer — the number of ways to make two round dances. It is guaranteed that the answer fits in the $$$64$$$-bit integer data type. | One day, $$$n$$$ people ($$$n$$$ is an even number) met on a plaza and made two round dances, each round dance consists of exactly $$$\frac{n}{2}$$$ people. Your task is to find the number of ways $$$n$$$ people can make two round dances if each round dance consists of exactly $$$\frac{n}{2}$$$ people. Each person shou... | [{"input": "2\r\n", "output": ["1"]}, {"input": "4\r\n", "output": ["3"]}, {"input": "8\r\n", "output": ["1260"]}, {"input": "20\r\n", "output": ["12164510040883200"]}, {"input": "6\r\n", "output": ["40"]}, {"input": "10\r\n", "output": ["72576"]}, {"input": "12\r\n", "output": ["6652800"]}, {"input": "14\r\n", "output... | 100 | 100 | 100 | [{'input': '6\r\n', 'output': ['40']}, {'input': '18\r\n', 'output': ['39520825344000']}, {'input': '16\r\n', 'output': ['163459296000']}, {'input': '10\r\n', 'output': ['72576']}, {'input': '12\r\n', 'output': ['6652800']}] | [{'input': '10\r\n', 'output': ['72576']}, {'input': '2\r\n', 'output': ['1']}, {'input': '16\r\n', 'output': ['163459296000']}, {'input': '6\r\n', 'output': ['40']}, {'input': '20\r\n', 'output': ['12164510040883200']}] | [{'input': '12\r\n', 'output': ['6652800']}, {'input': '6\r\n', 'output': ['40']}, {'input': '10\r\n', 'output': ['72576']}, {'input': '8\r\n', 'output': ['1260']}, {'input': '14\r\n', 'output': ['889574400']}] | [{'input': '20\r\n', 'output': ['12164510040883200']}, {'input': '10\r\n', 'output': ['72576']}, {'input': '2\r\n', 'output': ['1']}, {'input': '18\r\n', 'output': ['39520825344000']}, {'input': '8\r\n', 'output': ['1260']}] | [{'input': '20\r\n', 'output': ['12164510040883200']}, {'input': '4\r\n', 'output': ['3']}, {'input': '2\r\n', 'output': ['1']}, {'input': '14\r\n', 'output': ['889574400']}, {'input': '6\r\n', 'output': ['40']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 149 | 100 | 100 | 100 |
["4\n1 3 3 2", "3\n1 1 1", "4\n42 0 0 42"] | The first line contains a single integer n (1 ≤ n ≤ 100) — the number of participants. The next line contains a sequence of n integers a1, a2, ..., an (0 ≤ ai ≤ 600) — participants' scores. It's guaranteed that at least one participant has non-zero score. | 3b520c15ea9a11b16129da30dcfb5161 | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
/* A. Olympiad */
using namespace std;
typedef long long ll;
int n, a[105], res, vis[605];
int main(int argc, char * argv[])
{
scanf("%d", &n);
for (int i = 0; i < n; i ++)
scanf("%d", &a[i]);
sort(a, ... | ["3", "1", "1"] | C++ | NoteThere are three ways to choose a subset in sample case one. Only participants with 3 points will get diplomas. Participants with 2 or 3 points will get diplomas. Everyone will get a diploma! The only option in sample case two is to award everyone.Note that in sample case three participants with zero scores canno... | Print a single integer — the desired number of ways. | The recent All-Berland Olympiad in Informatics featured n participants with each scoring a certain amount of points.As the head of the programming committee, you are to determine the set of participants to be awarded with diplomas with respect to the following criteria: At least one participant should get a diploma. ... | [{"input": "4\r\n1 3 3 2\r\n", "output": ["3"]}, {"input": "3\r\n1 1 1\r\n", "output": ["1"]}, {"input": "4\r\n42 0 0 42\r\n", "output": ["1"]}, {"input": "10\r\n1 0 1 0 1 0 0 0 0 1\r\n", "output": ["1"]}, {"input": "10\r\n572 471 540 163 50 30 561 510 43 200\r\n", "output": ["10"]}, {"input": "100\r\n122 575 426 445 1... | 100 | 100 | 100 | [{'input': '2\r\n0 5\r\n', 'output': ['1']}, {'input': '100\r\n1 2 1 0 3 0 2 0 0 1 2 0 1 3 0 3 3 1 3 0 0 2 1 2 2 1 3 3 3 3 3 2 0 0 2 1 2 3 2 3 0 1 1 3 3 2 0 3 1 0 2 2 2 1 2 3 2 1 0 3 0 2 0 3 0 2 1 0 3 1 0 2 2 1 3 1 3 0 2 3 3 1 1 3 1 3 0 3 2 0 2 3 3 0 2 0 2 0 1 3\r\n', 'output': ['3']}, {'input': '99\r\n1 0 1 0 1 0 0 0 ... | [{'input': '100\r\n122 575 426 445 172 81 247 429 97 202 175 325 382 384 417 356 132 502 328 537 57 339 518 211 479 306 140 168 268 16 140 263 593 249 391 310 555 468 231 180 157 18 334 328 276 155 21 280 322 545 111 267 467 274 291 304 235 34 365 180 21 95 501 552 325 331 302 353 296 22 289 399 7 466 32 302 568 333 75... | [{'input': '99\r\n21 74 25 44 71 80 46 28 96 1 74 24 81 83 16 55 31 1 27 36 56 38 17 10 78 5 39 67 67 15 39 62 92 48 90 9 54 67 30 79 56 17 33 27 75 54 20 79 21 44 10 66 66 73 90 3 34 33 64 79 20 94 0 51 24 30 1 52 95 21 88 98 6 65 31 1 67 32 74 91 83 9 93 27 53 11 8 79 42 20 50 91 19 96 6 24 66 16 37\r\n', 'output': [... | [{'input': '10\r\n1 0 1 0 1 0 0 0 0 1\r\n', 'output': ['1']}, {'input': '2\r\n0 5\r\n', 'output': ['1']}, {'input': '2\r\n0 1\r\n', 'output': ['1']}, {'input': '5\r\n1 0 0 1 2\r\n', 'output': ['2']}, {'input': '100\r\n572 471 540 163 50 30 561 510 43 200 213 387 500 424 113 487 357 333 294 337 435 202 447 494 485 465 1... | [{'input': '78\r\n5 4 13 2 5 6 2 10 10 1 2 6 7 9 6 3 5 7 1 10 2 2 7 0 2 11 11 3 1 13 3 10 6 2 0 3 0 5 0 1 4 11 1 1 7 0 12 7 5 12 0 2 12 9 8 3 4 3 4 11 4 10 2 3 10 12 5 6 1 11 2 0 8 7 9 1 3 12\r\n', 'output': ['13']}, {'input': '2\r\n0 600\r\n', 'output': ['1']}, {'input': '100\r\n572 471 540 163 50 30 561 510 43 200 21... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 150 | 100 | 100 | 100 |
["4", "7", "12"] | The only line contains integer n from the problem's statement (1 ≤ n ≤ 109). | 2468eead8acc5b8f5ddc51bfa2bd4fb7 | #include<stdio.h>
#include<vector>
#include<algorithm>
#include<queue>
#include <string>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
//typedef bitset<8> mask;
//int x4[4]={1,0,0,-1};
//int y4[4]={0,1,-1,0};
ll n,x,y,z,ans1=1e18+20,ans2=-100000000;
int main()
{
//cout... | ["28 41", "47 65", "48 105"] | C++ | NoteLet's consider the first sample test. If initially Sam has a parallelepiped consisting of 32 = 2 × 4 × 4 hay blocks in his barn, then after the theft the barn has 4 = (2 - 1) × (4 - 2) × (4 - 2) hay blocks left. Thus, the thieves could have stolen 32 - 4 = 28 hay blocks. If Sam initially had a parallelepiped consis... | Print space-separated minimum and maximum number of hay blocks that could have been stolen by the thieves. Note that the answer to the problem can be large enough, so you must use the 64-bit integer type for calculations. Please, do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred ... | Once upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. Sam scythed hay and put it into haystack. As Sam was a bright farmer, he tried to make the process of storing hay simple... | [{"input": "4\r\n", "output": ["28 41"]}, {"input": "7\r\n", "output": ["47 65"]}, {"input": "12\r\n", "output": ["48 105"]}, {"input": "1\r\n", "output": ["17 17"]}, {"input": "6\r\n", "output": ["34 57"]}, {"input": "8\r\n", "output": ["40 73"]}, {"input": "9\r\n", "output": ["41 81"]}, {"input": "14\r\n", "output": ... | 100 | 100 | 100 | [{'input': '615716902\r\n', 'output': ['10508698 4925735225']}, {'input': '958557600\r\n', 'output': ['4637398 7668460809']}, {'input': '7033800\r\n', 'output': ['210976 56270409']}, {'input': '905969664\r\n', 'output': ['4529412 7247757321']}, {'input': '999893387\r\n', 'output': ['1000724227 7999147105']}] | [{'input': '935625600\r\n', 'output': ['4563150 7485004809']}, {'input': '20\r\n', 'output': ['64 169']}, {'input': '299999771\r\n', 'output': ['1499998867 2399998177']}, {'input': '573308928\r\n', 'output': ['3301020 4586471433']}, {'input': '332393619\r\n', 'output': ['10714371 2659148961']}] | [{'input': '7661860\r\n', 'output': ['546725 61294889']}, {'input': '422114561\r\n', 'output': ['78417139 3376916497']}, {'input': '12\r\n', 'output': ['48 105']}, {'input': '821620800\r\n', 'output': ['4185636 6572966409']}, {'input': '348\r\n', 'output': ['396 2793']}] | [{'input': '15\r\n', 'output': ['55 129']}, {'input': '534879507\r\n', 'output': ['253364145 4279036065']}, {'input': '6\r\n', 'output': ['34 57']}, {'input': '821620800\r\n', 'output': ['4185636 6572966409']}, {'input': '628464178\r\n', 'output': ['3574502 5027713433']}] | [{'input': '1\r\n', 'output': ['17 17']}, {'input': '14\r\n', 'output': ['58 121']}, {'input': '535074941\r\n', 'output': ['647722381 4280599537']}, {'input': '615716902\r\n', 'output': ['10508698 4925735225']}, {'input': '18\r\n', 'output': ['57 153']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 151 | 100 | 100 | 100 |
["WBWBWBWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB", "WBWBWBWB\nWBWBWBWB\nBBWBWWWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWWW\nBWBWBWBW\nBWBWBWBW"] | The input consists of exactly eight lines. Each line contains exactly eight characters "W" or "B" without any spaces: the j-th character in the i-th line stands for the color of the j-th cell of the i-th row of the elephants' board. Character "W" stands for the white color, character "B" stands for the black color. Con... | ca65e023be092b2ce25599f52acc1a67 | /* *************************************************************
* "The world is nothing but a good program, *
* and we are all some instances of the program!!" *
* PROBLEM: *
* SOLVED DATE: 2012/12/20 *... | ["YES", "NO"] | C++ | NoteIn the first sample you should shift the following lines one position to the right: the 3-rd, the 6-th, the 7-th and the 8-th.In the second sample there is no way you can achieve the goal. | In a single line print "YES" (without the quotes), if we can make the board a proper chessboard and "NO" (without the quotes) otherwise. | The Little Elephant loves chess very much. One day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8 × 8 checkered board, each square is painted either black or white. The Little Elephant and his friend know that a proper chessboard doesn... | [{"input": "WBWBWBWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nBWBWBWBW\r\nWBWBWBWB\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\n", "output": ["YES"]}, {"input": "WBWBWBWB\r\nWBWBWBWB\r\nBBWBWWWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nBWBWBWWW\r\nBWBWBWBW\r\nBWBWBWBW\r\n", "output": ["NO"]}, {"input": "BWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nW... | 100 | 100 | 100 | [{'input': 'BWBWBWBW\r\nBWBWBWBW\r\nWBWBWBWB\r\nWBWBWBWB\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\n', 'output': ['YES']}, {'input': 'BBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\n', 'output': ['NO']}, {'input': 'WBWBWBWB\r\nWBWBWBWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nB... | [{'input': 'BBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nWWWWWWWW\r\nWWWWWWWW\r\nWWWWWWWW\r\nWWWWWWWW\r\n', 'output': ['NO']}, {'input': 'BBBBBBBB\r\nBWBWBWBW\r\nBWBWBWBW\r\nBWBWBWBW\r\nWBWBWBWB\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\n', 'output': ['NO']}, {'input': 'BWBWBWBW\r\nBWBWBWBW\r\nBBWWWBBB\r\nWBBBBBWW\r\nWB... | [{'input': 'BWBWBWBW\r\nBWBBBWWB\r\nWBWBWBWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\n', 'output': ['NO']}, {'input': 'BWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nWBWBWBWB\r\nWBWBWBWB\r\nWBWBWBWB\r\nWBWBWBWB\r\n', 'output': ['YES']}, {'input': 'BBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nBBBBBBBB\r\nW... | [{'input': 'BWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\nWBWBWBWB\r\nWBWBWBWB\r\n', 'output': ['YES']}, {'input': 'WWBWWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\n', 'output': ['NO']}, {'input': 'WWBBWWBB\r\nBWWBBWWB\r\nBWBWBWBW\r\nWWBBWWWB\r\nW... | [{'input': 'WBWBWBWB\r\nWBWBWBWB\r\nBWBWBWBW\r\nBWBWBWBW\r\nBWBWBWBW\r\nBWBWBWBW\r\nWBWBWBWB\r\nBWBWBWBW\r\n', 'output': ['YES']}, {'input': 'WBWBWBWB\r\nWBWBWBWB\r\nWWBBWBBB\r\nWBWBWBWB\r\nWWWWBWWB\r\nWBBBBWWW\r\nBWBWWWBW\r\nWWWBWBBB\r\n', 'output': ['NO']}, {'input': 'BBBBBBBW\r\nBBBBBBBW\r\nBBBBBBBW\r\nBBBBBBBW\r\nB... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 83.33 | 100 | 100 | 100 | 100 | 152 | 100 | 100 | 96.666 |
["5 1", "3 2", "6 3"] | The only line of input contains two integers n and m, separated by a single space (1 ≤ m ≤ n ≤ 109) — the number of participants and the number of teams respectively. | a081d400a5ce22899b91df38ba98eecc | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll inf = LLONG_MAX;
#define rel( i, a, b) for( ll i = a ; i <= b ; i++ )
#define rep( k, a, b) for( ll k = a ; k <= b ; k+=2*k )
#define rev( i, a, b) for( ll i = b ; i >= a ; i-- )
#define M 1000000007
#define pll ... | ["10 10", "1 1", "3 6"] | C++ | NoteIn the first sample all the participants get into one team, so there will be exactly ten pairs of friends.In the second sample at any possible arrangement one team will always have two participants and the other team will always have one participant. Thus, the number of pairs of friends will always be equal to one.... | The only line of the output should contain two integers kmin and kmax — the minimum possible number of pairs of friends and the maximum possible number of pairs of friends respectively. | n participants of the competition were split into m teams in some manner so that each team has at least one participant. After the competition each pair of participants from the same team became friends.Your task is to write a program that will find the minimum and the maximum number of pairs of friends that could have... | [{"input": "5 1\r\n", "output": ["10 10"]}, {"input": "3 2\r\n", "output": ["1 1"]}, {"input": "6 3\r\n", "output": ["3 6"]}, {"input": "5 3\r\n", "output": ["2 3"]}, {"input": "10 2\r\n", "output": ["20 36"]}, {"input": "10 6\r\n", "output": ["4 10"]}, {"input": "1000000000 1\r\n", "output": ["499999999500000000 49999... | 100 | 100 | 100 | [{'input': '1000000000 1000000\r\n', 'output': ['499500000000 499000500499500000']}, {'input': '5 1\r\n', 'output': ['10 10']}, {'input': '5000000 12\r\n', 'output': ['1041664166668 12499942500066']}, {'input': '1000000000 1\r\n', 'output': ['499999999500000000 499999999500000000']}, {'input': '6 3\r\n', 'output': ['3 ... | [{'input': '599222887 298488\r\n', 'output': ['601178656545 179355218158217800']}, {'input': '5000000 12\r\n', 'output': ['1041664166668 12499942500066']}, {'input': '1000000 1000\r\n', 'output': ['499500000 499000999500']}, {'input': '999999999 500000000\r\n', 'output': ['499999999 124999999750000000']}, {'input': '5 ... | [{'input': '3 2\r\n', 'output': ['1 1']}, {'input': '599222887 298488\r\n', 'output': ['601178656545 179355218158217800']}, {'input': '1 1\r\n', 'output': ['0 0']}, {'input': '1000000000 2\r\n', 'output': ['249999999500000000 499999998500000001']}, {'input': '38447 383\r\n', 'output': ['1910550 724453080']}] | [{'input': '1000000 1000\r\n', 'output': ['499500000 499000999500']}, {'input': '1000000000 384842119\r\n', 'output': ['845473643 189209609585784021']}, {'input': '1000000000 1\r\n', 'output': ['499999999500000000 499999999500000000']}, {'input': '1000000000 1000000000\r\n', 'output': ['0 0']}, {'input': '1000000000 99... | [{'input': '1234 1123\r\n', 'output': ['111 6216']}, {'input': '38447 383\r\n', 'output': ['1910550 724453080']}, {'input': '5000000 12\r\n', 'output': ['1041664166668 12499942500066']}, {'input': '1000000000 1000000000\r\n', 'output': ['0 0']}, {'input': '1000000 1000\r\n', 'output': ['499500000 499000999500']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 153 | 100 | 100 | 100 |
["2\n8 8", "4\n3 1 4 1"] | The first line contains one integer $$$n$$$ ($$$2 \leq n \leq 50$$$) — the number of piles. It is guaranteed that $$$n$$$ is an even number. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the number of stones in the piles. | 4b9cf82967aa8441e9af3db3101161e9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N], cnt;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i];
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; ++i)
if (a[i] == a[1]) ++cnt... | ["Bob", "Alice"] | C++ | NoteIn the first example, each player can only remove stones from one pile ($$$\frac{2}{2}=1$$$). Alice loses, since Bob can copy whatever Alice does on the other pile, so Alice will run out of moves first.In the second example, Alice can remove $$$2$$$ stones from the first pile and $$$3$$$ stones from the third pile ... | Print a single string "Alice" if Alice wins; otherwise, print "Bob" (without double quotes). | Alice and Bob are playing a game with $$$n$$$ piles of stones. It is guaranteed that $$$n$$$ is an even number. The $$$i$$$-th pile has $$$a_i$$$ stones.Alice and Bob will play a game alternating turns with Alice going first.On a player's turn, they must choose exactly $$$\frac{n}{2}$$$ nonempty piles and independently... | [{"input": "2\r\n8 8\r\n", "output": ["Bob"]}, {"input": "4\r\n3 1 4 1\r\n", "output": ["Alice"]}, {"input": "4\r\n42 49 42 42\r\n", "output": ["Bob"]}, {"input": "8\r\n11 21 31 41 41 31 21 11\r\n", "output": ["Alice"]}, {"input": "10\r\n21 4 7 21 18 38 12 17 21 13\r\n", "output": ["Alice"]}, {"input": "12\r\n33 26 11 ... | 100 | 100 | 100 | [{'input': '10\r\n21 4 7 21 18 38 12 17 21 13\r\n', 'output': ['Alice']}, {'input': '46\r\n35 37 27 27 27 33 27 34 32 34 32 38 27 50 27 27 29 27 35 45 27 27 27 32 30 27 27 27 47 27 27 27 27 38 33 27 43 49 29 27 31 27 27 27 38 27\r\n', 'output': ['Bob']}, {'input': '6\r\n1 2 2 2 2 2\r\n', 'output': ['Alice']}, {'input':... | [{'input': '6\r\n1 1 2 2 3 3\r\n', 'output': ['Alice']}, {'input': '22\r\n37 35 37 35 39 42 35 35 49 50 42 35 40 36 35 35 35 43 35 35 35 35\r\n', 'output': ['Bob']}, {'input': '14\r\n4 10 7 13 27 28 13 34 16 18 39 26 29 22\r\n', 'output': ['Alice']}, {'input': '8\r\n1 1 1 1 1 2 2 2\r\n', 'output': ['Bob']}, {'input': '... | [{'input': '6\r\n4 4 4 4 4 1\r\n', 'output': ['Alice']}, {'input': '6\r\n1 2 2 2 2 4\r\n', 'output': ['Alice']}, {'input': '40\r\n17 8 23 16 25 37 11 16 16 29 25 38 31 45 14 46 40 24 49 44 21 12 29 18 33 35 7 47 41 48 24 39 8 37 29 13 12 21 44 19\r\n', 'output': ['Alice']}, {'input': '48\r\n13 25 45 45 23 29 11 30 40 1... | [{'input': '44\r\n37 43 3 3 36 45 3 3 30 3 30 29 3 3 3 3 36 34 31 38 3 38 3 48 3 3 3 3 46 49 30 50 3 42 3 3 3 37 3 3 41 3 49 3\r\n', 'output': ['Bob']}, {'input': '18\r\n38 48 13 15 18 16 44 46 17 30 16 33 43 12 9 48 31 37\r\n', 'output': ['Alice']}, {'input': '44\r\n27 40 39 38 27 49 27 33 45 34 27 39 49 27 27 27 27 2... | [{'input': '6\r\n4 4 4 4 4 1\r\n', 'output': ['Alice']}, {'input': '6\r\n1 2 2 2 2 2\r\n', 'output': ['Alice']}, {'input': '4\r\n42 49 42 42\r\n', 'output': ['Bob']}, {'input': '48\r\n33 47 6 10 28 22 41 45 27 19 45 18 29 10 35 18 39 29 8 10 9 1 9 23 10 11 3 14 12 15 35 29 29 18 12 49 27 18 18 45 29 32 15 21 34 1 43 9\... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 154 | 100 | 100 | 100 |
["4\n2 3 1 4", "4\n4 4 4 4", "4\n2 1 4 3"] | The first line of input contains integer n (1 ≤ n ≤ 100) — the number of people in Arpa's land. The second line contains n integers, i-th of them is crushi (1 ≤ crushi ≤ n) — the number of i-th person's crush. | 149221131a978298ac56b58438df46c9 | #include <stdio.h>
int n,par[105];
bool vis[105];
int gcd(int a,int b){
if(b==0)return a;
return gcd(b,a%b);
}
int main(){
int ans=1;
scanf("%i",&n);
for(int i=1;i<=n;i++)scanf("%i",&par[i]);
for(int j=1;j<=n;j++){
if(vis[j])continue;
bool valid=0;
int pos=par[j];
for(int k=1;k<=n+2;k++){
vis[pos]=1;
... | ["3", "-1", "1"] | C++ | NoteIn the first sample suppose t = 3. If the first person starts some round:The first person calls the second person and says "Owwwf", then the second person calls the third person and says "Owwf", then the third person calls the first person and says "Owf", so the first person becomes Joon-Joon of the round. So the c... | If there is no t satisfying the condition, print -1. Otherwise print such smallest t. | As you have noticed, there are lovely girls in Arpa’s land.People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi. Someday Arpa shouted Owf loudly from the top of the palace and a funny game started in Arpa's land. The rules are as follows.T... | [{"input": "4\r\n2 3 1 4\r\n", "output": ["3"]}, {"input": "4\r\n4 4 4 4\r\n", "output": ["-1"]}, {"input": "4\r\n2 1 4 3\r\n", "output": ["1"]}, {"input": "5\r\n2 4 3 1 2\r\n", "output": ["-1"]}, {"input": "5\r\n2 2 4 4 5\r\n", "output": ["-1"]}, {"input": "5\r\n2 4 5 4 2\r\n", "output": ["-1"]}, {"input": "10\r\n8 10... | 100 | 100 | 100 | [{'input': '100\r\n74 71 86 6 75 16 62 25 95 45 29 36 97 5 8 78 26 69 56 57 60 15 55 87 14 23 68 11 31 47 3 24 7 54 49 80 33 76 30 65 4 53 93 20 37 84 35 1 66 40 46 17 12 73 42 96 38 2 32 72 58 51 90 22 99 89 88 21 85 28 63 10 92 18 61 98 27 19 81 48 34 94 50 83 59 77 9 44 79 43 39 100 82 52 70 41 67 13 64 91\r\n', 'ou... | [{'input': '100\r\n98 62 49 47 84 1 77 88 76 85 21 50 2 92 72 66 100 99 78 58 33 83 27 89 71 97 64 94 4 13 17 8 32 20 79 44 12 56 7 9 43 6 26 57 18 23 39 69 30 55 16 96 35 91 11 68 67 31 38 90 40 48 25 41 54 82 15 22 37 51 81 65 60 34 24 14 5 87 74 19 46 3 80 45 61 86 10 28 52 73 29 42 70 53 93 95 63 75 59 36\r\n', 'ou... | [{'input': '100\r\n58 40 98 67 44 23 88 8 63 52 95 42 28 93 6 24 21 12 94 41 95 65 38 77 17 41 94 99 84 8 5 10 90 48 18 7 72 16 91 82 100 30 73 41 15 70 13 23 39 56 15 74 42 69 10 86 21 91 81 15 86 72 56 19 15 48 28 38 81 96 7 8 90 44 13 99 99 9 70 26 95 95 77 83 78 97 2 74 2 76 97 27 65 68 29 20 97 91 58 28\r\n', 'out... | [{'input': '100\r\n35 12 51 32 59 98 65 84 34 83 75 72 35 31 17 55 35 84 6 46 23 74 81 98 61 9 39 40 6 15 44 79 98 3 45 41 64 56 4 27 62 27 68 80 99 21 32 26 60 82 5 1 98 75 49 26 60 25 57 18 69 88 51 64 74 97 81 78 62 32 68 77 48 71 70 64 17 1 77 25 95 68 33 80 11 55 18 42 24 73 51 55 82 72 53 20 99 15 34 54\r\n', 'ou... | [{'input': '100\r\n73 21 39 30 78 79 15 46 18 60 2 1 45 35 74 26 43 49 96 59 89 61 34 50 42 84 16 41 92 31 100 64 25 27 44 98 86 47 29 71 97 11 95 62 48 66 20 53 22 83 76 32 77 63 54 99 87 36 9 70 17 52 72 38 81 19 23 65 82 37 24 10 91 93 56 12 88 58 51 33 4 28 8 3 40 7 67 69 68 6 80 13 5 55 14 85 94 75 90 57\r\n', 'ou... | 100 | 100 | 100 | 100 | 100 | 100 | 91.67 | 100 | 100 | 100 | 100 | 88.89 | 100 | 100 | 100 | 155 | 100 | 98.334 | 97.778 |
["4 4\n....\n.S1.\n....\n....\n10", "7 7\n.......\n.1###2.\n.#...#.\n.#.B.#.\n.3...4.\n..##...\n......S\n100\n100\n100\n100", "7 8\n........\n........\n....1B..\n.S......\n....2...\n3.......\n........\n100\n-100\n100", "1 1\nS"] | The first line contains two integers n and m (1 ≤ n, m ≤ 20) — the sizes of the table. Next n lines each contains m characters — the description of the table. The description means the following: character "B" is a cell with a bomb; character "S" is the starting cell, you can assume that it's empty; digit c (1-8) i... | 624a0d6cf305fcf67d3f1cdc1c5fef8d | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,1,-1};
const int INF=1000000000;
int n,m,sx,sy,tx[10],ty[10],tp[10],tn,bx[10],by[10],bn;
int f[21][21][256][256],pr[256],ans;
int qx[2000010],qy[2000010],qt[2000010],qb[2000010],... | ["2", "364", "0", "0"] | C++ | NoteIn the first example the answer will look as follows. In the second example the answer will look as follows. In the third example you cannot get profit.In the fourth example you cannot get profit as you cannot construct a closed path with more than one cell. | Print a single integer — the maximum possible profit you can get. | You have a map as a rectangle table. Each cell of the table is either an obstacle, or a treasure with a certain price, or a bomb, or an empty cell. Your initial position is also given to you.You can go from one cell of the map to a side-adjacent one. At that, you are not allowed to go beyond the borders of the map, ent... | [{"input": "4 4\r\n....\r\n.S1.\r\n....\r\n....\r\n10\r\n", "output": ["2"]}, {"input": "7 7\r\n.......\r\n.1###2.\r\n.#...#.\r\n.#.B.#.\r\n.3...4.\r\n..##...\r\n......S\r\n100\r\n100\r\n100\r\n100\r\n", "output": ["364"]}, {"input": "7 8\r\n........\r\n........\r\n....1B..\r\n.S......\r\n....2...\r\n3.......\r\n......... | 100 | 100 | 100 | [{'input': '20 20\r\n........#...........\r\n...#.......#.#.....#\r\n....................\r\n.#........#.........\r\n....................\r\n..#....#.3..........\r\n.....#..#......#....\r\n....#..............1\r\n.#.........#.....##.\r\n#2..................\r\n.............#......\r\n..#.................\r\n......8....... | [{'input': '10 11\r\n##.#.###.#.\r\n.1###.#.5##\r\n##.....#.##\r\n#.#.#######\r\n#4#7##.##.#\r\n.###.###.#.\r\n..#S.#.####\r\n..2###.####\r\n.....##..6#\r\n.3##..###..\r\n50\r\n-21\r\n-6\r\n5\r\n29\r\n56\r\n42\r\n', 'output': ['0']}, {'input': '20 20\r\n.............#..#..#\r\n.5..................\r\n.#........#.#B...#... | [{'input': '20 20\r\n....#.#.........#...\r\n..##.#.......#.#....\r\n..#......##.#.#...#.\r\n.S##..#.....##...#..\r\n.#...#.......#B#....\r\n#...#......#...##...\r\n...#..........B.#.#.\r\n...........3.#...##.\r\n............#...B#..\r\n..#..#...#.....1....\r\n.....#......#.......\r\n...#...#...##..#.#..\r\n##........#... | [{'input': '8 8\r\n..#.....\r\n...#....\r\n.4....1#\r\n..3.....\r\n#B....B.\r\n......B.\r\n.#..B.2.\r\n##.S#...\r\n36\r\n9\r\n10\r\n-6\r\n', 'output': ['0']}, {'input': '10 11\r\n.....##.##.\r\n#.#.#.S..#.\r\n....#....##\r\n.3.##.2.7..\r\n.#..#....4#\r\n#.####..#.#\r\n...#....5.#\r\n.6.##...#.#\r\n..##..#..##\r\n.#1##.... | [{'input': '20 20\r\n...##...#..#...3.#..\r\n.......##4#.##.#.##.\r\n...#....#....#....#.\r\n.##...#.#.##.###.#..\r\n.##......5...#....##\r\n.#..#.#.#.#.......1.\r\n##.##..#.##.#..#...S\r\n....#.....#.##......\r\n...2...#........#..#\r\n..8#....#.##...#.#..\r\n.....7.#..#.....#...\r\n.#...##......#.#.6..\r\n......#...#... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 156 | 100 | 100 | 100 |
["2 5", "3 3", "5 4", "13 37"] | The only line contains two integers $$$n$$$ and $$$x$$$ ($$$2 \le n \le 500; 1 \le x \le 500$$$). | 1908d1c8c6b122a4c6633a7af094f17f | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define lr(a) memset(a,0,sizeof(a))
const int N=550,mod=998244353;
int n,x,C[N][N],pw[N][N]; //组合数&幂
int dp[N][N],ans; //dp[n][x]
void init(){
lr(dp),lr(pw),lr(C);
for(int i=0;i<=510;i++)C[i][0]=pw[i][0]=1; //还有这里!i要从0开始,不然C[n][n]就等于... | ["5", "15", "1024", "976890680"] | C++ | null | Print one integer — the number of ways to choose the initial health points for each hero $$$a_i$$$, where $$$1 \le a_i \le x$$$, so that there is no winner of the fight, taken modulo $$$998244353$$$. | There are $$$n$$$ heroes fighting in the arena. Initially, the $$$i$$$-th hero has $$$a_i$$$ health points.The fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals $$$1$$$ damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is less ... | [{"input": "2 5\n", "output": ["5\n", "5 \n", "5", "5\n\n", "5\n", "5 \n\n"]}, {"input": "3 3\n", "output": ["15\n\n", "15 \n\n", "15", "15\n", "15\n", "15 \n"]}, {"input": "5 4\n", "output": ["1024 \n\n", "1024", "1024\n", "1024\n\n", "1024\n", "1024 \n"]}, {"input": "13 37\n", "output": ["976890680\n\n", "976890680\n... | 100 | 100 | 100 | [{'input': '198 236\n', 'output': ['93097976\n\n', '93097976', '93097976\n', '93097976 \n\n', '93097976 \n', '93097976\n']}, {'input': '371 306\n', 'output': ['512015273 \n', '512015273\n\n', '512015273 \n\n', '512015273', '512015273\n', '512015273\n']}, {'input': '224 375\n', 'output': ['555865043 \n', '555865043\n', ... | [{'input': '500 500\n', 'output': ['587613361\n', '587613361', '587613361\n\n', '587613361 \n\n', '587613361\n', '587613361 \n']}, {'input': '13 337\n', 'output': ['434551606 \n\n', '434551606', '434551606\n', '434551606\n', '434551606 \n', '434551606\n\n']}, {'input': '11 345\n', 'output': ['932713620\n', '932713620 \... | [{'input': '246 348\n', 'output': ['875068738\n', '875068738 \n', '875068738\n', '875068738', '875068738\n\n', '875068738 \n\n']}, {'input': '50 500\n', 'output': ['165073862\n\n', '165073862\n', '165073862 \n\n', '165073862 \n', '165073862\n', '165073862']}, {'input': '438 46\n', 'output': ['312807374 \n\n', '31280737... | [{'input': '376 314\n', 'output': ['795015160\n', '795015160\n', '795015160 \n', '795015160', '795015160 \n\n', '795015160\n\n']}, {'input': '99 333\n', 'output': ['897436821\n', '897436821\n\n', '897436821 \n', '897436821', '897436821 \n\n', '897436821\n']}, {'input': '265 181\n', 'output': ['178439722\n', '178439722'... | [{'input': '5 500\n', 'output': ['940552292\n', '940552292 \n\n', '940552292\n\n', '940552292\n', '940552292', '940552292 \n']}, {'input': '71 439\n', 'output': ['299896905 \n\n', '299896905', '299896905\n', '299896905\n', '299896905 \n', '299896905\n\n']}, {'input': '3 500\n', 'output': ['375500 \n', '375500', '375500... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 157 | 100 | 100 | 100 |
["1 1", "2 1", "3 2"] | The first and the only line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^5, 1 \le k \le \min(2^n - 1, 10^9)$$$) — the number of rounds in the tournament and the number of outcomes that sponsors can change. | dc7b887afcc2e95c4e90619ceda63071 | #include <cstdio>
#include <algorithm>
using LL = long long;
const int N = 1e5 + 100, P = 1e9 + 7;
int n, num;
int fac[N], ifac[N];
int ans = 0;
int qpow(int x, int y = P - 2)
{
int res = 1;
for (; y; y >>= 1, x = LL(x) * x % P) if (y & 1) res = LL(x) * res % P;
return res;
}
void adj(int &x){ ... | ["2", "3", "7"] | C++ | NoteIn the first example, there is only one match between players $$$1$$$ and $$$2$$$, so the sponsors can always make player $$$2$$$ wins.The tournament grid from the second example is shown in the picture in the statement. | Print exactly one integer — the minimum number of the winner modulo $$$10^9 + 7$$$ | Madoka decided to entrust the organization of a major computer game tournament "OSU"!In this tournament, matches are held according to the "Olympic system". In other words, there are $$$2^n$$$ participants in the tournament, numbered with integers from $$$1$$$ to $$$2^n$$$. There are $$$n$$$ rounds in total in the tour... | [{"input": "1 1\n", "output": ["2\n", "2 ", "2", "2 \n", "2\n\n", "\n2", "2\n\n", "2\n"]}, {"input": "2 1\n", "output": ["\n3\n", "\n3", "3\n\n", "3 \n", "3\n\n", "3 ", "3\n", "3\n", "3"]}, {"input": "3 2\n", "output": ["7", "7\n\n", "\n7\n", "7\n", "7 ", "7 \n", "7\n\n", "\n7", "7\n"]}, {"input": "5 3\n", "output": ["... | 100 | 100 | 100 | [{'input': '100000 13\n', 'output': ['185515077\n', '\n185515077', '185515077', '185515077\n', '\n185515077\n', '185515077 \n', '185515077 ', '185515077\n\n', '185515077\n\n']}, {'input': '1 1\n', 'output': ['2\n', '2 ', '2', '2 \n', '2\n\n', '\n2', '2\n\n', '2\n']}, {'input': '5 31\n', 'output': ['32 \n', '\n32', '32 ... | [{'input': '99999 3123\n', 'output': ['575224395\n', '575224395\n\n', '575224395 ', '575224395\n', '\n575224395\n', '575224395', '\n575224395', '575224395 \n', '575224395\n\n']}, {'input': '5 5\n', 'output': ['32 \n', '\n32', '32 ', '32\n\n', '32', '32\n', '32\n\n', '32\n']}, {'input': '100000 1\n', 'output': ['100001 ... | [{'input': '5 5\n', 'output': ['32 \n', '\n32', '32 ', '32\n\n', '32', '32\n', '32\n\n', '32\n']}, {'input': '2 1\n', 'output': ['\n3\n', '\n3', '3\n\n', '3 \n', '3\n\n', '3 ', '3\n', '3\n', '3']}, {'input': '5 31\n', 'output': ['32 \n', '\n32', '32 ', '32\n\n', '32', '32\n', '32\n\n', '32\n']}, {'input': '100000 13\n'... | [{'input': '99999 3123\n', 'output': ['575224395\n', '575224395\n\n', '575224395 ', '575224395\n', '\n575224395\n', '575224395', '\n575224395', '575224395 \n', '575224395\n\n']}, {'input': '3 2\n', 'output': ['7', '7\n\n', '\n7\n', '7\n', '7 ', '7 \n', '7\n\n', '\n7', '7\n']}, {'input': '11994 11995\n', 'output': ['685... | [{'input': '2 1\n', 'output': ['\n3\n', '\n3', '3\n\n', '3 \n', '3\n\n', '3 ', '3\n', '3\n', '3']}, {'input': '5 31\n', 'output': ['32 \n', '\n32', '32 ', '32\n\n', '32', '32\n', '32\n\n', '32\n']}, {'input': '87532 32150\n', 'output': ['\n165162987', '165162987\n', '165162987', '165162987 \n', '165162987\n', '\n165162... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 158 | 100 | 100 | 100 |
["12 5", "31 12"] | The only line of the input contains two integers n and m (1 ≤ n, m ≤ 1018). n is the initial value of variable a, and m is the initial value of variable b. | 1f505e430eb930ea2b495ab531274114 | #include<iostream>
using namespace std;
long long n,m;
int main()
{
cin>>n>>m;
while(n&&m)
if(n>=2*m)n%=2*m;
else if(m>=2*n)m%=2*n;
else break;
cout<<n<<' '<<m<<endl;
return 0;
}
| ["0 1", "7 12"] | C++ | NoteExplanations to the samples: a = 12, b = 5 a = 2, b = 5 a = 2, b = 1 a = 0, b = 1; a = 31, b = 12 a = 7, b = 12. | Print two integers — the values of a and b after the end of the process. | You have two variables a and b. Consider the following sequence of actions performed with these variables: If a = 0 or b = 0, end the process. Otherwise, go to step 2; If a ≥ 2·b, then set the value of a to a - 2·b, and repeat step 1. Otherwise, go to step 3; If b ≥ 2·a, then set the value of b to b - 2·a, and repeat s... | [{"input": "12 5\r\n", "output": ["0 1"]}, {"input": "31 12\r\n", "output": ["7 12"]}, {"input": "1000000000000000000 7\r\n", "output": ["8 7"]}, {"input": "31960284556200 8515664064180\r\n", "output": ["14928956427840 8515664064180"]}, {"input": "1000000000000000000 1000000000000000000\r\n", "output": ["10000000000000... | 100 | 100 | 100 | [{'input': '5 6\r\n', 'output': ['5 6']}, {'input': '576460752303423487 288230376151711743\r\n', 'output': ['1 1']}, {'input': '1 2\r\n', 'output': ['1 0']}, {'input': '1000000000000000000 2\r\n', 'output': ['0 2']}, {'input': '1000000000000000000 10000001\r\n', 'output': ['0 1']}] | [{'input': '17174219820754872 61797504734333370\r\n', 'output': ['17174219820754872 27449065092823626']}, {'input': '12 5\r\n', 'output': ['0 1']}, {'input': '1 4\r\n', 'output': ['1 0']}, {'input': '10000000000000000 100000000000000001\r\n', 'output': ['0 1']}, {'input': '5 100000000000001\r\n', 'output': ['1 1']}] | [{'input': '3 1000000000000000000\r\n', 'output': ['3 4']}, {'input': '1000000000000000000 3\r\n', 'output': ['4 3']}, {'input': '499999999999999999 1000000000000000000\r\n', 'output': ['3 2']}, {'input': '9 18917827189272\r\n', 'output': ['9 0']}, {'input': '7 11\r\n', 'output': ['7 11']}] | [{'input': '31 12\r\n', 'output': ['7 12']}, {'input': '1 100000000000000000\r\n', 'output': ['1 0']}, {'input': '345869461223138161 835002744095575440\r\n', 'output': ['1 0']}, {'input': '1 10000000000000000\r\n', 'output': ['1 0']}, {'input': '576460752303423487 2\r\n', 'output': ['3 2']}] | [{'input': '7 1\r\n', 'output': ['1 1']}, {'input': '576460752303423487 288230376151711743\r\n', 'output': ['1 1']}, {'input': '25 12\r\n', 'output': ['1 0']}, {'input': '2 7\r\n', 'output': ['2 3']}, {'input': '576460752303423487 2\r\n', 'output': ['3 2']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 87.5 | 87.5 | 159 | 100 | 100 | 92.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 | /*input
10 3 5 2 3
*/
#include <bits/stdc++.h>
using namespace std;
long long c,wr,wb,hr,hb,ans=0;
long long get(int i){
return i*hr+hb*int((c-i*wr)/wb);
}
int main(){
cin>>c>>hr>>hb>>wr>>wb;
if(hb*wr>hr*wb){
swap(hr,hb);
swap(wr,wb);
}
if(wr>1e4){
for(int i=0;i*wr<=c;++i)
ans=max(ans,get(i));
}
else if... | ["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': '990510345 367358723 146943489 5 2\r\n', 'output': ['72774523091497887']}, {'input': '1000000000 1 1000000000 1 1000000000\r\n', 'output': ['1000000000']}, {'input': '998999 1000 999 1000 999\r\n', 'output': ['998999']}, {'input': '1000000000 1000 999 100 1000000000\r\n', 'output': ['10000000000']}, {'input'... | [{'input': '977983517 29808 22786 52389 40047\r\n', 'output': ['556454318']}, {'input': '976649406 455467553 569334442 4 5\r\n', 'output': ['111208028918928288']}, {'input': '983935533 7105 7056 1015 1008\r\n', 'output': ['6887548731']}, {'input': '100000000 1000000000 1 100000001 1\r\n', 'output': ['100000000']}, {'in... | [{'input': '910943911 38162 31949 67084 56162\r\n', 'output': ['518210503']}, {'input': '934395168 119 105 67 59\r\n', 'output': ['1662906651']}, {'input': '942733698 9180 9072 1020 1008\r\n', 'output': ['8484603228']}, {'input': '934395168 29208 38362 51342 67432\r\n', 'output': ['531576348']}, {'input': '982068341 55... | [{'input': '912494588 389153108 972882772 2 5\r\n', 'output': ['177550052841687584']}, {'input': '934395168 119 105 67 59\r\n', 'output': ['1662906651']}, {'input': '999999997 2 999999997 2 999999997\r\n', 'output': ['999999997']}, {'input': '100000001 3 100000000 3 100000001\r\n', 'output': ['100000000']}, {'input': '... | [{'input': '345415838 13999 13997 13999 13997\r\n', 'output': ['345415838']}, {'input': '1000000000 1 1 1 1\r\n', 'output': ['1000000000']}, {'input': '998999 1000 999 1000 999\r\n', 'output': ['998999']}, {'input': '936111602 154673223 309346447 1 2\r\n', 'output': ['144791399037089047']}, {'input': '999999999 9999999... | 100 | 100 | 100 | 100 | 100 | 64.71 | 88.24 | 88.24 | 76.47 | 100 | 71.43 | 78.57 | 78.57 | 71.43 | 100 | 160 | 100 | 83.532 | 80 |
["3"] | The first line contains a single integer n (0 ≤ n ≤ 1000). | 1a335a9638523ca0315282a67e18eec7 | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int N=1010;
const int MOD=(int)1e6+3;
ll n,dp[N],twoPow[2*N];
void init() {
twoPow[0]=1;
for(int i=1;i<=2*N;i++)
twoPow[i]=(twoPow[i-1]*2)%MOD;
memset(dp,-1,sizeof(dp));
}
ll cookie(ll a) {
return (twoPow[a-1]*(twoPow... | ["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': '69\r\n', 'output': ['327984']}, {'input': '1000\r\n', 'output': ['691074']}, {'input': '1\r\n', 'output': ['1']}, {'input': '589\r\n', 'output': ['889192']}, {'input': '6\r\n', 'output': ['243']}] | [{'input': '298\r\n', 'output': ['999535']}, {'input': '850\r\n', 'output': ['557186']}, {'input': '4\r\n', 'output': ['27']}, {'input': '910\r\n', 'output': ['678945']}, {'input': '69\r\n', 'output': ['327984']}] | [{'input': '1\r\n', 'output': ['1']}, {'input': '823\r\n', 'output': ['858672']}, {'input': '11\r\n', 'output': ['59049']}, {'input': '298\r\n', 'output': ['999535']}, {'input': '617\r\n', 'output': ['247876']}] | [{'input': '7\r\n', 'output': ['729']}, {'input': '3\r\n', 'output': ['9']}, {'input': '850\r\n', 'output': ['557186']}, {'input': '561\r\n', 'output': ['842553']}, {'input': '657\r\n', 'output': ['874011']}] | [{'input': '823\r\n', 'output': ['858672']}, {'input': '0\r\n', 'output': ['1']}, {'input': '4\r\n', 'output': ['27']}, {'input': '2\r\n', 'output': ['3']}, {'input': '298\r\n', 'output': ['999535']}] | 100 | 100 | 100 | 100 | 100 | 95.45 | 95.45 | 95.45 | 95.45 | 100 | 87.5 | 87.5 | 87.5 | 87.5 | 100 | 161 | 100 | 96.36 | 90 |
["3 6 100000", "6 21 100129", "58 787788 50216"] | The only line contains three integers maxn, maxa and q (1 ≤ maxn ≤ 30 000; maxn ≤ maxa ≤ 109; 104 ≤ q ≤ 105 + 129). | aac481d9e5ea3e3d43b324c8750882be | #include <bits/stdc++.h>
using namespace std;
const int p1 = 998244353, p2 = 469762049, Maxn = 1 << 17 | 5;
int maxn, maxa, mod, rev[Maxn];
int tot, l[Maxn];
const long long lcm = p1 * (long long) p2;
void get_rev(int len)
{
for (int i = 0; i < len; i++)
rev[i] = (rev[i >> 1] >> 1) | ((i & 1) * (len >> 1));
}
long ... | ["4", "154", "46009"] | C++ | NoteIn the first example, interesting test cases look as follows: 1 1 1 32 4 6 2 4 6 | Output a single integer — the number of test cases which satisfy the constraints and make both wrong solutions output an incorrect answer, modulo q. | Test data generation is not an easy task! Often, generating big random test cases is not enough to ensure thorough testing of solutions for correctness.For example, consider a problem from an old Codeforces round. Its input format looks roughly as follows:The first line contains a single integer n (1 ≤ n ≤ maxn) — the ... | [{"input": "3 6 100000\r\n", "output": ["4"]}, {"input": "6 21 100129\r\n", "output": ["154"]}, {"input": "58 787788 50216\r\n", "output": ["46009"]}, {"input": "1 1 10000\r\n", "output": ["0"]}, {"input": "1 20 100000\r\n", "output": ["10"]}, {"input": "2 20 100000\r\n", "output": ["10"]}, {"input": "100 12345 100000\... | 100 | 100 | 100 | [{'input': '29804 939519871 100000\r\n', 'output': ['99167']}, {'input': '2 6 100000\r\n', 'output': ['3']}, {'input': '4 7 100000\r\n', 'output': ['4']}, {'input': '6 7 100000\r\n', 'output': ['4']}, {'input': '1000 536870911 100123\r\n', 'output': ['64128']}] | [{'input': '29364 536805295 100128\r\n', 'output': ['55925']}, {'input': '16000 536870911 100123\r\n', 'output': ['57489']}, {'input': '29875 805036031 10002\r\n', 'output': ['3441']}, {'input': '29441 671087487 65535\r\n', 'output': ['40129']}, {'input': '3 6 100000\r\n', 'output': ['4']}] | [{'input': '20 25 100000\r\n', 'output': ['698']}, {'input': '2 2 100000\r\n', 'output': ['1']}, {'input': '16385 1000000000 100129\r\n', 'output': ['498']}, {'input': '30000 60000 10000\r\n', 'output': ['5379']}, {'input': '3 6 100000\r\n', 'output': ['4']}] | [{'input': '5 5 100000\r\n', 'output': ['2']}, {'input': '3 6 100000\r\n', 'output': ['4']}, {'input': '5 5 100000\r\n', 'output': ['2']}, {'input': '30000 1000000000 100123\r\n', 'output': ['21272']}, {'input': '29673 671088479 10000\r\n', 'output': ['67']}] | [{'input': '16385 1000000000 100129\r\n', 'output': ['498']}, {'input': '4 4 100000\r\n', 'output': ['2']}, {'input': '29811 803209213 97343\r\n', 'output': ['75766']}, {'input': '2 6 100000\r\n', 'output': ['3']}, {'input': '3 5 100000\r\n', 'output': ['2']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 162 | 100 | 100 | 100 |
["BBBSSC\n6 4 1\n1 2 3\n4", "BBC\n1 10 1\n1 10 1\n21", "BSC\n1 1 1\n1 1 3\n1000000000000"] | The first line of the input contains a non-empty string that describes the recipe of "Le Hamburger de Polycarpus". The length of the string doesn't exceed 100, the string contains only letters 'B' (uppercase English B), 'S' (uppercase English S) and 'C' (uppercase English C). The second line contains three integers nb,... | 8126a4232188ae7de8e5a7aedea1a97e | #include <iostream>
using namespace std;
string s;
int need[3] = {};
int have[3] = {};
int price[3] = {};
long long r ;
bool solve(long long m)
{
long long p = 0;
for (int i = 0 ; i < 3 ; i++)
{
long long z = m*need[i];
z = z - have[i];
if (z > 0)
{
p = p + z*pr... | ["2", "7", "200000000001"] | C++ | null | Print the maximum number of hamburgers Polycarpus can make. If he can't make any hamburger, print 0. | Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | [{"input": "BBBSSC\r\n6 4 1\r\n1 2 3\r\n4\r\n", "output": ["2"]}, {"input": "BBC\r\n1 10 1\r\n1 10 1\r\n21\r\n", "output": ["7"]}, {"input": "BSC\r\n1 1 1\r\n1 1 3\r\n1000000000000\r\n", "output": ["200000000001"]}, {"input": "B\r\n1 1 1\r\n1 1 1\r\n381\r\n", "output": ["382"]}, {"input": "BSC\r\n3 5 6\r\n7 3 9\r\n100\... | 100 | 100 | 100 | [{'input': 'CSSCBBCCCSBSCBBBCSBBBCBSBCSCBCSCBCBSBCBCSSBBSBBCBBBBSCSBBCCBCCBCBBSBSBCSCSBBSSBBCSSBCSCSCCSSBCBBCBSB\r\n56 34 48\r\n78 6 96\r\n904174875419\r\n', 'output': ['140968956']}, {'input': 'BBBBBBBBBBCCCCCCCCCCCCCCCCCCCCSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\r\n10 20 40\r\n100 100 100\r\n2000\r\n', 'output': ['1... | [{'input': 'BBBCSBSBBSSSSCCCCBBCSBBBBSSBBBCBSCCSSCSSCSBSSSCCCCBSCSSBSSSCCCBBCCCSCBCBBCCSCCCCSBBCCBBBBCCCCCCBSSCB\r\n91 87 17\r\n64 44 43\r\n958532915587\r\n', 'output': ['191668251']}, {'input': 'B\r\n100 100 100\r\n1 1 1\r\n1\r\n', 'output': ['101']}, {'input': 'SSSSSSSSSSBBBBBBBBBCCCCCCCCCCCCCCCCCCCSSSSSSSSSSSSSSSSSS... | [{'input': 'B\r\n100 1 1\r\n1 1 1\r\n1000000000000\r\n', 'output': ['1000000000100']}, {'input': 'CBBCBSBCCSCBSSCCBCSBCSBBSCBBCSCCBSCCSCSBBSSBSBSCBBSBBCSSSSBBBBSBBCBCSBBCBCSSBBCSBSCCSCSBCSCBSCCBBCSC\r\n71 71 52\r\n52 88 3\r\n654400055575\r\n', 'output': ['137826467']}, {'input': 'BBBBBBBBBBCCCCCCCCCCCCCCCCCCCCSSSSSSSSS... | [{'input': 'CBBCBSBCCSCBSSCCBCSBCSBBSCBBCSCCBSCCSCSBBSBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCBBCSC\r\n100 1 1\r\n1 17 23\r\n954400055575\r\n', 'output': ['1355681897']}, {'input': 'BBBBCCCCCCCCCCCCCCCCCCCCSSSSBBBBBBBBSS\r\n100 100 100\r\n1 1 1\r\n3628800\r\n', 'output': ['95502']}, {'input': 'CSSCBBCCCSBSCBBBCSBBBCBSBCSCBCSCBC... | [{'input': 'B\r\n1 1 1\r\n1 1 1\r\n381\r\n', 'output': ['382']}, {'input': 'B\r\n100 100 100\r\n1 1 1\r\n1\r\n', 'output': ['101']}, {'input': 'BBC\r\n1 10 1\r\n1 10 1\r\n21\r\n', 'output': ['7']}, {'input': 'BSC\r\n100 100 100\r\n1 1 1\r\n1000000000000\r\n', 'output': ['333333333433']}, {'input': 'BBBBBBBBBBCCCCCCCCCC... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 163 | 100 | 100 | 100 |
["sumimasen", "ninja", "codeforces"] | The first line of the input contains the string $$$s$$$ consisting of $$$|s|$$$ ($$$1\leq |s|\leq 100$$$) lowercase Latin letters. | a83144ba7d4906b7692456f27b0ef7d4 | #include<bits/stdc++.h>
using namespace std;
string st;
bool pd(int i)
{
return st[i]=='a'||st[i]=='e'||st[i]=='i'||st[i]=='o'||st[i]=='u';
}
int main()
{
cin>>st;
for(int i=0;i<st.size();i++)
{
if(!pd(i)&&!pd(i+1)&&st[i]!='n')
{
cout<<"NO"<<endl;
return 0;
}
}
cout<<"YES"<<endl;
return 0;
}
| ["YES", "YES", "NO"] | C++ | NoteIn the first and second samples, a vowel goes after each consonant except "n", so the word is Berlanese.In the third sample, the consonant "c" goes after the consonant "r", and the consonant "s" stands on the end, so the word is not Berlanese. | Print "YES" (without quotes) if there is a vowel after every consonant except "n", otherwise print "NO". You can print each letter in any case (upper or lower). | Vitya has just started learning Berlanese language. It is known that Berlanese uses the Latin alphabet. Vowel letters are "a", "o", "u", "i", and "e". Other letters are consonant.In Berlanese, there has to be a vowel after every consonant, but there can be any letter after any vowel. The only exception is a consonant "... | [{"input": "sumimasen\r\n", "output": ["YES"]}, {"input": "ninja\r\n", "output": ["YES"]}, {"input": "codeforces\r\n", "output": ["NO"]}, {"input": "auuaoonntanonnuewannnnpuuinniwoonennyolonnnvienonpoujinndinunnenannmuveoiuuhikucuziuhunnnmunzancenen\r\n", "output": ["YES"]}, {"input": "n\r\n", "output": ["YES"]}, {"inp... | 100 | 100 | 100 | [{'input': 'nn\r\n', 'output': ['YES']}, {'input': 'nternn\r\n', 'output': ['NO']}, {'input': 'aaz\r\n', 'output': ['NO']}, {'input': 'naaaaaaaaa\r\n', 'output': ['YES']}, {'input': 'uixinnepnlinqaingieianndeakuniooudidonnnqeaituioeneiroionxuowudiooonayenfeonuino\r\n', 'output': ['NO']}] | [{'input': 'aeo\r\n', 'output': ['YES']}, {'input': 'nternn\r\n', 'output': ['NO']}, {'input': 'aaaaaak\r\n', 'output': ['NO']}, {'input': 'ninja\r\n', 'output': ['YES']}, {'input': 'kini\r\n', 'output': ['YES']}] | [{'input': 'nbaaaaaaaa\r\n', 'output': ['YES']}, {'input': 'ndonneasoiunhomuunnhuitonnntunntoanerekonoupunanuauenu\r\n', 'output': ['YES']}, {'input': 'ninja\r\n', 'output': ['YES']}, {'input': 'necnei\r\n', 'output': ['NO']}, {'input': 'yn\r\n', 'output': ['NO']}] | [{'input': 'm\r\n', 'output': ['NO']}, {'input': 'king\r\n', 'output': ['NO']}, {'input': 'aaab\r\n', 'output': ['NO']}, {'input': 'y\r\n', 'output': ['NO']}, {'input': 'a\r\n', 'output': ['YES']}] | [{'input': 'aucunuohja\r\n', 'output': ['NO']}, {'input': 'ninja\r\n', 'output': ['YES']}, {'input': 'anujemogawautiedoneobninnibonuunaoennnyoorufonxionntinimiboonununnnnnleenqunminzayoutanlalo\r\n', 'output': ['NO']}, {'input': 'codeforces\r\n', 'output': ['NO']}, {'input': 'b\r\n', 'output': ['NO']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 95 | 95 | 100 | 85 | 100 | 164 | 100 | 100 | 95 |
["104 2", "223 4", "7067678 8"] | The first line contains two integers: n (1 ≤ n < 1018) and m (1 ≤ m ≤ 100). | 5eb90c23ffa3794fdddc5670c0373829 | //codeforces 401D Roman and Numbers
#include<bits/stdc++.h>
#define ll long long
const int maxs=(1<<18)+5;
const int maxn=110;
using namespace std;
int cnt=-1,w[20],m;
ll f[maxs][maxn],n;
bool vis[10];
int main(){
for(cin>>n>>m;n;n/=10)
w[++cnt]=n%10;
f[0][0]=1;
for(int s=1;s<1<<cnt+1;s++){
memset(vis,0,sizeof... | ["3", "1", "47"] | C++ | NoteIn the first sample the required numbers are: 104, 140, 410.In the second sample the required number is 232. | In a single line print a single integer — the number of numbers close to number n modulo m. | Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.Number x is considered close to number n modul... | [{"input": "104 2\r\n", "output": ["3"]}, {"input": "223 4\r\n", "output": ["1"]}, {"input": "7067678 8\r\n", "output": ["47"]}, {"input": "202 10\r\n", "output": ["1"]}, {"input": "1306432 9\r\n", "output": ["0"]}, {"input": "9653092 9\r\n", "output": ["0"]}, {"input": "600038 6\r\n", "output": ["0"]}, {"input": "4064... | 100 | 100 | 100 | [{'input': '9003489956983022 37\r\n', 'output': ['399073500']}, {'input': '223 4\r\n', 'output': ['1']}, {'input': '458498549 4\r\n', 'output': ['2100']}, {'input': '9653092 9\r\n', 'output': ['0']}, {'input': '102233445566778899 89\r\n', 'output': ['265391558945']}] | [{'input': '104 2\r\n', 'output': ['3']}, {'input': '848092188917 18\r\n', 'output': ['0']}, {'input': '1 1\r\n', 'output': ['1']}, {'input': '987654321987654321 1\r\n', 'output': ['12504636144000']}, {'input': '63436369526943580 59\r\n', 'output': ['1231321437']}] | [{'input': '450497776413 3\r\n', 'output': ['12196800']}, {'input': '123456789123456789 2\r\n', 'output': ['5557616064000']}, {'input': '3345289321458628 8\r\n', 'output': ['3416212800']}, {'input': '458498549 4\r\n', 'output': ['2100']}, {'input': '36160302795340 2\r\n', 'output': ['485654400']}] | [{'input': '9615722072995774 82\r\n', 'output': ['104605125']}, {'input': '2866933879413767 4\r\n', 'output': ['5448643200']}, {'input': '123456789123456700 100\r\n', 'output': ['163459296000']}, {'input': '1296319391649597 4\r\n', 'output': ['1180539360']}, {'input': '181939172581 23\r\n', 'output': ['216735']}] | [{'input': '7076043389696504 4\r\n', 'output': ['8627018400']}, {'input': '3802128082766215 4\r\n', 'output': ['5340535200']}, {'input': '123456789123456700 100\r\n', 'output': ['163459296000']}, {'input': '8966261 5\r\n', 'output': ['0']}, {'input': '6328128 6\r\n', 'output': ['900']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 165 | 100 | 100 | 100 |
["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<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn = 105;
int n,m;
int mp[maxn];
int a[maxn];
int main()
{
cin>>n>>m;
/*int mp[maxn];
int a[maxn];*/
int cnt;
//memset(mp,0,sizeof(mp));
for(int i=0;i<n;i++)
{
cin>>a[i];
... | ["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': '10 5\r\n99 98 93 97 95 100 92 94 91 96\r\n', 'output': ['5']}, {'input': '100 70\r\n91 82 8 85 26 25 95 97 40 87 81 93 7 73 38 94 64 96 74 18 90 19 65 68 72 61 23 43 36 41 60 88 30 33 71 24 52 39 15 3 16 89 86 79 55 4 9 58 67 44 46 29 6 48 84 69 27 21 78 54 51 57 80 53 76 50 47 77 45 12 34 10 100 0 17 31 56... | [{'input': '100 50\r\n55 36 0 32 81 6 17 43 24 13 30 19 8 59 71 45 15 74 3 41 99 42 86 47 2 94 35 1 66 95 38 49 4 27 96 89 34 44 92 25 51 39 54 28 80 77 20 14 48 40 68 56 31 63 33 78 69 37 18 26 83 70 23 82 91 65 67 52 61 53 7 22 60 21 12 73 72 87 75 100 90 29 64 79 98 85 5 62 93 84 50 46 97 58 57 16 9 10 76 11\r\n', '... | [{'input': '5 3\r\n0 4 5 6 7\r\n', 'output': ['2']}, {'input': '5 0\r\n1 2 3 4 5\r\n', 'output': ['0']}, {'input': '99 33\r\n25 76 41 95 55 20 47 59 58 84 87 92 16 27 35 65 72 63 93 54 36 96 15 86 5 69 24 46 67 73 48 60 40 6 61 74 97 10 100 8 52 26 77 18 7 62 37 2 14 66 11 56 68 91 0 64 75 99 30 21 53 1 89 81 3 98 12 8... | [{'input': '100 70\r\n25 94 66 65 10 99 89 6 70 31 7 40 20 92 64 27 21 72 77 98 17 43 47 44 48 81 38 56 100 39 90 22 88 76 3 83 86 29 33 55 82 79 49 11 2 16 12 78 85 69 32 97 26 15 53 24 23 91 51 67 34 35 52 5 62 50 95 18 71 13 75 8 30 42 93 36 45 60 63 46 57 41 87 0 84 54 74 37 4 58 28 19 96 61 80 9 1 14 73 68\r\n', '... | [{'input': '100 50\r\n95 78 46 92 80 18 79 58 30 72 19 89 39 29 44 65 15 100 59 8 96 9 62 67 41 42 82 14 57 32 71 77 40 5 7 51 28 53 85 23 16 35 3 91 6 11 75 61 17 66 13 47 36 56 10 22 83 60 48 24 26 97 4 33 76 86 70 0 34 64 52 43 21 49 55 74 1 73 81 25 54 63 94 84 20 68 87 12 31 88 38 93 37 90 98 69 99 45 27 2\r\n', '... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 87.5 | 100 | 100 | 100 | 100 | 166 | 100 | 100 | 97.5 |
["2 47", "47 1024"] | The single line contains a pair of integers l and r (1 ≤ l ≤ r ≤ 1018) — the boundaries of the interval. 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. | 9642368dc4ffe2fc6fe6438c7406c1bd | #include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
#define f(i,s,e) for (int i = int(s); i != int(e); i++)
#define ft(i,c) for (typeof((c).begin()) i = (c).begin(); i !... | ["12", "98"] | C++ | NoteIn the first sample the answer includes integers 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44. | On a single line print a single integer — the answer to the problem. | The Little Elephant very much loves sums on intervals.This time he has a pair of integers l and r (l ≤ r). The Little Elephant has to find the number of such integers x (l ≤ x ≤ r), that the first digit of integer x equals the last one (in decimal notation). For example, such numbers as 101, 477474 or 9 will be include... | [{"input": "2 47\r\n", "output": ["12"]}, {"input": "47 1024\r\n", "output": ["98"]}, {"input": "1 1000\r\n", "output": ["108"]}, {"input": "1 10000\r\n", "output": ["1008"]}, {"input": "47 8545\r\n", "output": ["849"]}, {"input": "1000 1000\r\n", "output": ["0"]}, {"input": "47547 4587554587754542\r\n", "output": ["45... | 100 | 100 | 100 | [{'input': '45481484484 848469844684844\r\n', 'output': ['84842436320036']}, {'input': '595754249475458004 615044544745124547\r\n', 'output': ['1929029526966655']}, {'input': '458754 4588754\r\n', 'output': ['413001']}, {'input': '47 74\r\n', 'output': ['2']}, {'input': '84324827171274023 607953653548585226\r\n', 'outp... | [{'input': '2 3\r\n', 'output': ['2']}, {'input': '111 111\r\n', 'output': ['1']}, {'input': '335408916782916802 416495628489807285\r\n', 'output': ['8108671170689049']}, {'input': '11 111111111111111100\r\n', 'output': ['11111111111111109']}, {'input': '1 1000000\r\n', 'output': ['100008']}] | [{'input': '100000000000000000 1000000000000000000\r\n', 'output': ['90000000000000000']}, {'input': '9999999999999987 99999999999999711\r\n', 'output': ['8999999999999973']}, {'input': '7 10\r\n', 'output': ['3']}, {'input': '9754875457700 1000000000000000000\r\n', 'output': ['99999024512454230']}, {'input': '12 10000... | [{'input': '99 102\r\n', 'output': ['2']}, {'input': '7 8\r\n', 'output': ['2']}, {'input': '999999999 10000000000\r\n', 'output': ['900000001']}, {'input': '7 10\r\n', 'output': ['3']}, {'input': '77 77\r\n', 'output': ['1']}] | [{'input': '1312148742261681 277460340506883334\r\n', 'output': ['27614819176462166']}, {'input': '10000 100000\r\n', 'output': ['9000']}, {'input': '8758754570000 999999999999999999\r\n', 'output': ['99999124124543000']}, {'input': '47 74\r\n', 'output': ['2']}, {'input': '10001 10000002\r\n', 'output': ['999001']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 100 | 100 | 100 | 75 | 167 | 100 | 100 | 90 |
["5 1\n10 5", "4 5\n3 3", "1 2\n11 6"] | The first line contains two positive integers not exceeding 100. They are the number of fingers on the Venusian girl's left and right hand correspondingly. The second line contains two integers not exceeding 100. They are the number of fingers on the Marsian boy's left and right hands correspondingly. | 36b7478e162be6e985613b2dad0974dd | #pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfl(x) scanf("%I64d" , &x)
#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)
#define sfi(x) scanf("%d" , &x)
#define sfi2(x, y) scanf("%d%d" , &x,&y)
#define sfd... | ["YES", "YES", "NO"] | C++ | NoteThe boy and the girl don't really care who goes to the left. | Print YES or NO, that is, the answer to Petr Palych's question. | Statistics claims that students sleep no more than three hours a day. But even in the world of their dreams, while they are snoring peacefully, the sense of impending doom is still upon them.A poor student is dreaming that he is sitting the mathematical analysis exam. And he is examined by the most formidable professor... | [{"input": "5 1\r\n10 5\r\n", "output": ["YES"]}, {"input": "4 5\r\n3 3\r\n", "output": ["YES"]}, {"input": "1 2\r\n11 6\r\n", "output": ["NO"]}, {"input": "1 1\r\n1 1\r\n", "output": ["YES"]}, {"input": "2 2\r\n1 1\r\n", "output": ["YES"]}, {"input": "3 3\r\n1 1\r\n", "output": ["NO"]}, {"input": "4 4\r\n1 1\r\n", "ou... | 100 | 100 | 100 | [{'input': '5 1\r\n10 5\r\n', 'output': ['YES']}, {'input': '15 7\r\n15 15\r\n', 'output': ['YES']}, {'input': '65 8\r\n73 25\r\n', 'output': ['NO']}, {'input': '13 23\r\n19 63\r\n', 'output': ['NO']}, {'input': '100 3\r\n4 1\r\n', 'output': ['YES']}] | [{'input': '6 11\r\n2 10\r\n', 'output': ['YES']}, {'input': '5 12\r\n13 11\r\n', 'output': ['YES']}, {'input': '4 4\r\n1 1\r\n', 'output': ['NO']}, {'input': '100 4\r\n1 1\r\n', 'output': ['NO']}, {'input': '100 5\r\n1 1\r\n', 'output': ['NO']}] | [{'input': '25 8\r\n14 24\r\n', 'output': ['YES']}, {'input': '25 9\r\n16 12\r\n', 'output': ['YES']}, {'input': '13 23\r\n19 63\r\n', 'output': ['NO']}, {'input': '2 6\r\n12 12\r\n', 'output': ['YES']}, {'input': '15 1\r\n11 9\r\n', 'output': ['NO']}] | [{'input': '19 4\r\n25 17\r\n', 'output': ['NO']}, {'input': '18 22\r\n22 19\r\n', 'output': ['YES']}, {'input': '5 12\r\n13 11\r\n', 'output': ['YES']}, {'input': '15 7\r\n15 15\r\n', 'output': ['YES']}, {'input': '15 3\r\n12 16\r\n', 'output': ['YES']}] | [{'input': '5 23\r\n12 17\r\n', 'output': ['NO']}, {'input': '100 3\r\n4 1\r\n', 'output': ['YES']}, {'input': '43 100\r\n65 24\r\n', 'output': ['NO']}, {'input': '1 100\r\n5 4\r\n', 'output': ['YES']}, {'input': '11 17\r\n6 4\r\n', 'output': ['NO']}] | 100 | 100 | 100 | 100 | 100 | 86.67 | 60 | 73.33 | 60 | 63.33 | 80 | 50 | 66.67 | 53.33 | 53.33 | 168 | 100 | 68.666 | 60.666 |
["1 1 0", "2 2 0", "1 1 1"] | The first line of the input contains three space-separated integers n, m, g (0 ≤ n, m ≤ 105, n + m ≥ 1, 0 ≤ g ≤ 1). | 066dd9e6091238edf2912a6af4d29e7f | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define p 1e6+7
#define N 10010
#define mc(a,b) memset(a,b,sizeof(a))
#define close std::ios::sync_with_stdio
using namespace std;
using namespace std;
const double eps(1e-8);
typedef long long lint;
const lint mod = 1000000007LL;... | ["2", "4", "0"] | C++ | NoteIn the first sample the beautiful strings are: "01", "10".In the second sample the beautiful strings are: "0011", "1001", "1010", "1100".In the third sample there are no beautiful strings. | Print a single integer — the answer to the problem modulo 1000000007 (109 + 7). | Vasily the Bear loves beautiful strings. String s is beautiful if it meets the following criteria: String s only consists of characters 0 and 1, at that character 0 must occur in string s exactly n times, and character 1 must occur exactly m times. We can obtain character g from string s with some (possibly, zero) n... | [{"input": "1 1 0\r\n", "output": ["2"]}, {"input": "2 2 0\r\n", "output": ["4"]}, {"input": "1 1 1\r\n", "output": ["0"]}, {"input": "100000 0 1\r\n", "output": ["1"]}, {"input": "0 100000 1\r\n", "output": ["0"]}, {"input": "0 100000 0\r\n", "output": ["1"]}, {"input": "100000 100000 0\r\n", "output": ["339533691"]},... | 100 | 100 | 100 | [{'input': '2 0 1\r\n', 'output': ['1']}, {'input': '2500 0 0\r\n', 'output': ['0']}, {'input': '432 432 0\r\n', 'output': ['350813304']}, {'input': '9997 100000 1\r\n', 'output': ['412501755']}, {'input': '0 1 0\r\n', 'output': ['0']}] | [{'input': '100000 100000 1\r\n', 'output': ['539933642']}, {'input': '0 100000 0\r\n', 'output': ['1']}, {'input': '100000 9997 0\r\n', 'output': ['928063171']}, {'input': '100000 1 0\r\n', 'output': ['50000']}, {'input': '9997 99999 0\r\n', 'output': ['287015367']}] | [{'input': '100000 99999 1\r\n', 'output': ['140133614']}, {'input': '9997 9997 0\r\n', 'output': ['844903460']}, {'input': '100000 1 1\r\n', 'output': ['50001']}, {'input': '100000 1 0\r\n', 'output': ['50000']}, {'input': '100000 99999 0\r\n', 'output': ['799600056']}] | [{'input': '0 99999 0\r\n', 'output': ['1']}, {'input': '100000 99999 1\r\n', 'output': ['140133614']}, {'input': '0 2 0\r\n', 'output': ['1']}, {'input': '2 10000 1\r\n', 'output': ['10000']}, {'input': '2500 99999 1\r\n', 'output': ['103989186']}] | [{'input': '0 99999 1\r\n', 'output': ['0']}, {'input': '2 10000 1\r\n', 'output': ['10000']}, {'input': '0 1 1\r\n', 'output': ['1']}, {'input': '9997 1 0\r\n', 'output': ['5000']}, {'input': '99999 1 0\r\n', 'output': ['50001']}] | 100 | 100 | 100 | 100 | 100 | 83.33 | 72.92 | 64.58 | 68.75 | 75 | 64.71 | 61.76 | 52.94 | 47.06 | 64.71 | 169 | 100 | 72.916 | 58.236 |
["7 2 5", "10 3 10"] | The first line contains three integers n, l, r (0 ≤ n < 250, 0 ≤ r - l ≤ 105, r ≥ 1, l ≥ 1) – initial element and the range l to r. It is guaranteed that r is not greater than the length of the final list. | 3ac61b1f8deee7911b1055c243f5eb6a | #include <vector>=
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <... | ["4", "5"] | C++ | NoteConsider first example:Elements on positions from 2-nd to 5-th in list is [1, 1, 1, 1]. The number of ones is 4.For the second example:Elements on positions from 3-rd to 10-th in list is [1, 1, 1, 0, 1, 0, 1, 0]. The number of ones is 5. | Output the total number of 1s in the range l to r in the final sequence. | Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester, so he can return and take the deceased Aemon's place as maester of Castle Black. Jon agrees to Sam's proposal and Sam s... | [{"input": "7 2 5\r\n", "output": ["4"]}, {"input": "10 3 10\r\n", "output": ["5"]}, {"input": "56 18 40\r\n", "output": ["20"]}, {"input": "203 40 124\r\n", "output": ["67"]}, {"input": "903316762502 354723010040 354723105411\r\n", "output": ["78355"]}, {"input": "33534354842198 32529564319236 32529564342569\r\n", "ou... | 100 | 100 | 100 | [{'input': '7 2 5\r\n', 'output': ['4']}, {'input': '3621 237 2637\r\n', 'output': ['2124']}, {'input': '14 7 12\r\n', 'output': ['5']}, {'input': '281474976710656 17179869184 17179869186\r\n', 'output': ['1']}, {'input': '3 2 2\r\n', 'output': ['1']}] | [{'input': '56 18 40\r\n', 'output': ['20']}, {'input': '1125899906842623 1125899906742623 1125899906842623\r\n', 'output': ['100001']}, {'input': '192308932 207804787 207866400\r\n', 'output': ['44142']}, {'input': '903316762502 354723010040 354723105411\r\n', 'output': ['78355']}, {'input': '3740160 1031384 1104236\r... | [{'input': '3740160 1031384 1104236\r\n', 'output': ['64965']}, {'input': '281474976710656 17179869184 17179869186\r\n', 'output': ['1']}, {'input': '62518534961045 50734311240112 50734311287877\r\n', 'output': ['42439']}, {'input': '38658997 35923164 35985664\r\n', 'output': ['36004']}, {'input': '880234 669493 757150... | [{'input': '1000 1 1023\r\n', 'output': ['1000']}, {'input': '542 321 956\r\n', 'output': ['336']}, {'input': '2787326787 3799676481 3799680514\r\n', 'output': ['2618']}, {'input': '14417262581 8527979363 8528075536\r\n', 'output': ['80707']}, {'input': '1 1 1\r\n', 'output': ['1']}] | [{'input': '542 321 956\r\n', 'output': ['336']}, {'input': '244269 149154 244246\r\n', 'output': ['88609']}, {'input': '251772781087 70597428577 70597479816\r\n', 'output': ['46933']}, {'input': '11586121 15337246 15397874\r\n', 'output': ['41868']}, {'input': '880234 669493 757150\r\n', 'output': ['73585']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 170 | 100 | 100 | 100 |
["6\nbaabbb", "10\nooopppssss", "1\nz"] | The first line contains integer $$$n$$$ ($$$1 \le n \le 55$$$) — the length of the encrypted string. The second line of the input contains $$$t$$$ — the result of encryption of some string $$$s$$$. It contains only lowercase Latin letters. The length of $$$t$$$ is exactly $$$n$$$. It is guaranteed that the answer to th... | 08e8c0c37b223f6aae01d5609facdeaf | #include<bits/stdc++.h>
using namespace std;
int i,l,n;
char s[60];
int main()
{
cin>>l>>s;
for(;i<l;i+=n+1,n++)cout<<s[i];
return 0;
} | ["bab", "oops", "z"] | C++ | null | Print such string $$$s$$$ that after encryption it equals $$$t$$$. | Polycarp loves ciphers. He has invented his own cipher called repeating.Repeating cipher is used for strings. To encrypt the string $$$s=s_{1}s_{2} \dots s_{m}$$$ ($$$1 \le m \le 10$$$), Polycarp uses the following algorithm: he writes down $$$s_1$$$ ones, he writes down $$$s_2$$$ twice, he writes down $$$s_3$$$ thr... | [{"input": "6\r\nbaabbb\r\n", "output": ["bab\n", "bab", "bab\r\n"]}, {"input": "10\r\nooopppssss\r\n", "output": ["oops\r\n", "oops\n", "oops"]}, {"input": "1\r\nz\r\n", "output": ["z\n", "z", "z\r\n"]}, {"input": "3\r\nzww\r\n", "output": ["zw", "zw\n", "zw\r\n"]}, {"input": "55\r\ncooooonnnnttttteeeeeeeeeeeeesssssss... | 100 | 100 | 100 | [{'input': '21\r\ncoodddeeeecccccoooooo\r\n', 'output': ['codeco', 'codeco\r\n', 'codeco\n']}, {'input': '36\r\nabbcccddddeeeeeffffffggggggghhhhhhhh\r\n', 'output': ['abcdefgh\n', 'abcdefgh\r\n', 'abcdefgh']}, {'input': '1\r\nz\r\n', 'output': ['z\n', 'z', 'z\r\n']}, {'input': '3\r\nzww\r\n', 'output': ['zw', 'zw\n', '... | [{'input': '3\r\nzww\r\n', 'output': ['zw', 'zw\n', 'zw\r\n']}, {'input': '1\r\nz\r\n', 'output': ['z\n', 'z', 'z\r\n']}, {'input': '10\r\nooopppssss\r\n', 'output': ['oops\r\n', 'oops\n', 'oops']}, {'input': '21\r\ncoodddeeeecccccoooooo\r\n', 'output': ['codeco', 'codeco\r\n', 'codeco\n']}, {'input': '6\r\nbaabbb\r\n'... | [{'input': '55\r\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n', 'output': ['aaaaaaaaaa\r\n', 'aaaaaaaaaa\n', 'aaaaaaaaaa']}, {'input': '36\r\nabbcccddddeeeeeffffffggggggghhhhhhhh\r\n', 'output': ['abcdefgh\n', 'abcdefgh\r\n', 'abcdefgh']}, {'input': '55\r\ncooooonnnnttttteeeeeeeeeeeeessssssssttttttttttt... | [{'input': '3\r\nzww\r\n', 'output': ['zw', 'zw\n', 'zw\r\n']}, {'input': '21\r\ncoodddeeeecccccoooooo\r\n', 'output': ['codeco', 'codeco\r\n', 'codeco\n']}, {'input': '1\r\nz\r\n', 'output': ['z\n', 'z', 'z\r\n']}, {'input': '10\r\nooopppssss\r\n', 'output': ['oops\r\n', 'oops\n', 'oops']}, {'input': '6\r\nbaabbb\r\n'... | [{'input': '36\r\nabbcccddddeeeeeffffffggggggghhhhhhhh\r\n', 'output': ['abcdefgh\n', 'abcdefgh\r\n', 'abcdefgh']}, {'input': '1\r\nz\r\n', 'output': ['z\n', 'z', 'z\r\n']}, {'input': '55\r\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n', 'output': ['aaaaaaaaaa\r\n', 'aaaaaaaaaa\n', 'aaaaaaaaaa']}, {'inpu... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 171 | 100 | 100 | 100 |
["4 3"] | The first and single line contains two integers A and B (1 ≤ A, B ≤ 109, min(A, B) ≤ 12). | 7bf30ceb24b66d91382e97767f9feeb6 | #include <iostream>
#include <algorithm>
using namespace std;
#define int long long
int a , b , cnt = 1;
void cul ( )
{
if ( a > b ) swap ( a , b );
while ( a != 1 ) {
cnt *= a;
a--;
}
}
signed main ( void )
{
cin >> a >> b;
cul ( );
cout << cnt << endl;
return 0;
} | ["6"] | C++ | NoteConsider the sample.4! = 1·2·3·4 = 24. 3! = 1·2·3 = 6. The greatest common divisor of integers 24 and 6 is exactly 6. | Print a single integer denoting the greatest common divisor of integers A! and B!. | Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopolis and move to Pavlopo... | [{"input": "4 3\r\n", "output": ["6"]}, {"input": "10 399603090\r\n", "output": ["3628800"]}, {"input": "6 973151934\r\n", "output": ["720"]}, {"input": "2 841668075\r\n", "output": ["2"]}, {"input": "7 415216919\r\n", "output": ["5040"]}, {"input": "3 283733059\r\n", "output": ["6"]}, {"input": "11 562314608\r\n", "ou... | 100 | 100 | 100 | [{'input': '10 20\r\n', 'output': ['3628800']}, {'input': '1 12\r\n', 'output': ['1']}, {'input': '2 29845\r\n', 'output': ['2']}, {'input': '11 999257105\r\n', 'output': ['39916800']}, {'input': '7 415216919\r\n', 'output': ['5040']}] | [{'input': '12 15\r\n', 'output': ['479001600']}, {'input': '12 20\r\n', 'output': ['479001600']}, {'input': '1213 5\r\n', 'output': ['120']}, {'input': '4 999832660\r\n', 'output': ['24']}, {'input': '6 7\r\n', 'output': ['720']}] | [{'input': '11 859155400\r\n', 'output': ['39916800']}, {'input': '12 20\r\n', 'output': ['479001600']}, {'input': '12 1\r\n', 'output': ['1']}, {'input': '10 20\r\n', 'output': ['3628800']}, {'input': '3 990639260\r\n', 'output': ['6']}] | [{'input': '4 19\r\n', 'output': ['24']}, {'input': '11 562314608\r\n', 'output': ['39916800']}, {'input': '5 5\r\n', 'output': ['120']}, {'input': '3 283733059\r\n', 'output': ['6']}, {'input': '999617047 3\r\n', 'output': ['6']}] | [{'input': '18 3\r\n', 'output': ['6']}, {'input': '7 999228288\r\n', 'output': ['5040']}, {'input': '5 5\r\n', 'output': ['120']}, {'input': '4 19\r\n', 'output': ['24']}, {'input': '2 841668075\r\n', 'output': ['2']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 100 | 100 | 100 | 100 | 172 | 100 | 100 | 95 |
["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<bits/stdc++.h>
#include<cmath>
#define ll long long
#define fr first
#define sc second
#define mod 1000000007
#define pii pair<int,int>
#define pdd pair<double,double>
#define mp make_pair
using namespace std;
struct pt{
double x,y,z;
void read(){
cin>>x>>y>>z;
}
double dis(pt d){
... | ["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': '-1 -9 14\r\n9 8 10\r\n172575 215800 344296 98651 566390 47011\r\n', 'output': ['837616']}, {'input': '573 79 619\r\n36 69 96\r\n955743 245262 675667 699027 275227 783730\r\n', 'output': ['1728019']}, {'input': '37 96 41\r\n27 74 97\r\n747624 148752 730329 406930 814825 993124\r\n', 'output': ['1141876']}, {... | [{'input': '5 5 0\r\n3 1 3\r\n832224 636838 995053 211585 505442 341920\r\n', 'output': ['978758']}, {'input': '58224 94433 40185\r\n55683 99614 33295\r\n137430 61976 671256 929825 499631 90071\r\n', 'output': ['1019896']}, {'input': '722477 814197 501318\r\n670293 164127 180084\r\n665889 389403 663253 449990 909406 24... | [{'input': '5 5 0\r\n3 1 3\r\n832224 636838 995053 211585 505442 341920\r\n', 'output': ['978758']}, {'input': '967 -1346 2551\r\n769 331 28\r\n458319 885170 877010 533360 723416 248230\r\n', 'output': ['1239909']}, {'input': '722477 814197 501318\r\n670293 164127 180084\r\n665889 389403 663253 449990 909406 240043\r\n... | [{'input': '35273 82177 67365\r\n69755 14857 39718\r\n925457 138136 454985 609590 83655 611361\r\n', 'output': ['747726']}, {'input': '0 0 10\r\n3 2 3\r\n1 2 3 4 5 6\r\n', 'output': ['4']}, {'input': '366317 904079 468911\r\n819427 99580 451147\r\n291702 801137 380674 646951 890909 998554\r\n', 'output': ['1448088']}, ... | [{'input': '722477 814197 501318\r\n670293 164127 180084\r\n665889 389403 663253 449990 909406 240043\r\n', 'output': ['1079436']}, {'input': '34271 -17508 -6147\r\n456 567 112\r\n804178 307516 306399 18981 989216 228388\r\n', 'output': ['1338965']}, {'input': '573 79 619\r\n36 69 96\r\n955743 245262 675667 699027 2752... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 92.86 | 85.71 | 78.57 | 100 | 173 | 100 | 100 | 90 |
["xx..\n.oo.\nx...\noox.", "x.ox\nox..\nx.o.\noo.x", "x..x\n..oo\no...\nx.xo", "o.x.\no...\n.x..\nooxx"] | The tic-tac-toe position is given in four lines. Each of these lines contains four characters. Each character is '.' (empty cell), 'x' (lowercase English letter x), or 'o' (lowercase English letter o). It is guaranteed that the position is reachable playing tic-tac-toe, and it is Ilya's turn now (in particular, it mean... | ca4a77fe9718b8bd0b3cc3d956e22917 | #include<bits/stdc++.h>
using namespace std;
char c[10][10];
int main() {
for(int i=0; i<4; i++)
for(int j=0; j<4; j++)
cin>>c[i][j];
bool flag=0;
for(int i=0; i<4; i++) {
for(int j=0; j<4; j++)
if(c[i][j]=='.') {
if(i>0 && i<3 && c[i-1][j]=='x' && c[i+1][j]=='x') flag=1;
else if(j>0 && j<3 && c[i]... | ["YES", "NO", "YES", "NO"] | C++ | NoteIn the first example Ilya had two winning moves: to the empty cell in the left column and to the leftmost empty cell in the first row.In the second example it wasn't possible to win by making single turn.In the third example Ilya could have won by placing X in the last row between two existing Xs.In the fourth exam... | Print single line: "YES" in case Ilya could have won by making single turn, and "NO" otherwise. | Ilya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game when they left it. Determine whether Ilya could have won the game by making... | [{"input": "xx..\r\n.oo.\r\nx...\r\noox.\r\n", "output": ["YES"]}, {"input": "x.ox\r\nox..\r\nx.o.\r\noo.x\r\n", "output": ["NO"]}, {"input": "x..x\r\n..oo\r\no...\r\nx.xo\r\n", "output": ["YES"]}, {"input": "o.x.\r\no...\r\n.x..\r\nooxx\r\n", "output": ["NO"]}, {"input": ".xox\r\no.x.\r\nx.o.\r\n..o.\r\n", "output": [... | 100 | 100 | 100 | [{'input': '....\r\nxo.x\r\n..x.\r\noo..\r\n', 'output': ['NO']}, {'input': '.xxo\r\n...o\r\n..ox\r\nox..\r\n', 'output': ['YES']}, {'input': '.oo.\r\nx...\r\n....\r\n..x.\r\n', 'output': ['YES']}, {'input': 'oo.x\r\nxo.o\r\no.xx\r\n.oxx\r\n', 'output': ['YES']}, {'input': 'x..o\r\no..o\r\no..x\r\nxxox\r\n', 'output': ... | [{'input': 'x..o\r\nxo.x\r\no.xo\r\nxoox\r\n', 'output': ['NO']}, {'input': '....\r\nxo..\r\n..o.\r\nx...\r\n', 'output': ['YES']}, {'input': '..o.\r\n.x..\r\n....\r\no..x\r\n', 'output': ['YES']}, {'input': '.oox\r\n..x.\r\n....\r\n....\r\n', 'output': ['YES']}, {'input': '....\r\nxo.x\r\n..x.\r\noo..\r\n', 'output': ... | [{'input': '.oo.\r\n.x..\r\nx...\r\nox..\r\n', 'output': ['YES']}, {'input': '..xo\r\n....\r\nx.o.\r\n....\r\n', 'output': ['YES']}, {'input': '....\r\n.ox.\r\n.o..\r\nx...\r\n', 'output': ['NO']}, {'input': '.oox\r\n..x.\r\n....\r\n....\r\n', 'output': ['YES']}, {'input': '....\r\n.x.x\r\no.o.\r\n....\r\n', 'output': ... | [{'input': 'o.xx\r\nxo.o\r\n...o\r\n..x.\r\n', 'output': ['YES']}, {'input': '...x\r\no..x\r\n.o..\r\n....\r\n', 'output': ['YES']}, {'input': '..ox\r\n.o..\r\nx..o\r\n.oxx\r\n', 'output': ['NO']}, {'input': '.x.x\r\n.o.o\r\no.xx\r\nx.oo\r\n', 'output': ['YES']}, {'input': '...x\r\n.x.o\r\n.o..\r\n.x.o\r\n', 'output': ... | [{'input': 'xxo.\r\nx..x\r\noo.o\r\noxox\r\n', 'output': ['YES']}, {'input': '.o..\r\n.x..\r\n..o.\r\n.x..\r\n', 'output': ['YES']}, {'input': 'ox..\r\n..oo\r\n..x.\r\nxxo.\r\n', 'output': ['NO']}, {'input': 'x...\r\n.ox.\r\n.oo.\r\n.xox\r\n', 'output': ['NO']}, {'input': '.oxx\r\n..o.\r\n.o.x\r\n.ox.\r\n', 'output': [... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 86.61 | 90.18 | 90.18 | 91.96 | 87.5 | 174 | 100 | 100 | 89.286 |
["3 3 3\n1 1 1\n2 2 3\n3 3 2", "4 10 2\n2 3 8\n3 4 7"] | The first line contains three integers $$$n$$$, $$$h$$$, and $$$m$$$ ($$$1 \leq n,h,m \leq 50$$$) — the number of spots, the maximum height, and the number of restrictions. Each of the next $$$m$$$ lines contains three integers $$$l_i$$$, $$$r_i$$$, and $$$x_i$$$ ($$$1 \leq l_i \leq r_i \leq n$$$, $$$0 \leq x_i \leq h$... | f22b6dab443f63fb8d2d288b702f20ad | #pragma GCC diagnostic error "-std=c++11"
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp"... | ["14", "262"] | C++ | NoteIn the first example, there are $$$3$$$ houses, the maximum height of a house is $$$3$$$, and there are $$$3$$$ restrictions. The first restriction says the tallest house between $$$1$$$ and $$$1$$$ must be at most $$$1$$$. The second restriction says the tallest house between $$$2$$$ and $$$2$$$ must be at most $$... | Print a single integer, the maximum profit you can make. | You are planning to build housing on a street. There are $$$n$$$ spots available on the street on which you can build a house. The spots are labeled from $$$1$$$ to $$$n$$$ from left to right. In each spot, you can build a house with an integer height between $$$0$$$ and $$$h$$$.In each spot, if a house has height $$$a... | [{"input": "3 3 3\r\n1 1 1\r\n2 2 3\r\n3 3 2\r\n", "output": ["14"]}, {"input": "4 10 2\r\n2 3 8\r\n3 4 7\r\n", "output": ["262"]}, {"input": "50 50 1\r\n1 50 0\r\n", "output": ["0"]}, {"input": "50 50 50\r\n17 40 12\r\n33 36 47\r\n8 43 35\r\n25 29 42\r\n18 36 6\r\n25 35 18\r\n36 48 47\r\n17 40 13\r\n20 27 37\r\n32 32 ... | 100 | 100 | 100 | [{'input': '50 50 50\r\n13 24 16\r\n13 46 26\r\n28 37 19\r\n2 22 29\r\n1 2 2\r\n30 31 3\r\n16 23 42\r\n32 44 45\r\n11 44 9\r\n19 35 39\r\n25 44 41\r\n4 35 31\r\n33 38 39\r\n28 35 25\r\n17 26 43\r\n17 49 9\r\n22 40 42\r\n11 44 26\r\n29 48 36\r\n20 30 41\r\n11 32 0\r\n15 31 35\r\n27 30 34\r\n38 47 39\r\n23 24 25\r\n14 20... | [{'input': '50 50 50\r\n14 39 43\r\n22 27 43\r\n9 11 0\r\n23 38 21\r\n13 32 23\r\n19 43 35\r\n27 29 15\r\n6 31 8\r\n19 20 35\r\n36 45 22\r\n20 26 34\r\n13 49 42\r\n13 37 40\r\n37 45 7\r\n16 41 19\r\n27 48 15\r\n15 41 8\r\n33 45 37\r\n6 33 45\r\n10 18 4\r\n12 35 27\r\n15 42 37\r\n25 28 50\r\n19 46 28\r\n7 19 12\r\n12 44... | [{'input': '4 10 2\r\n2 3 8\r\n3 4 7\r\n', 'output': ['262']}, {'input': '50 50 50\r\n7 47 45\r\n22 24 8\r\n31 48 31\r\n36 47 13\r\n7 25 19\r\n2 2 17\r\n34 40 14\r\n27 33 50\r\n31 45 35\r\n4 7 4\r\n27 30 27\r\n4 41 27\r\n34 41 15\r\n2 12 17\r\n2 3 19\r\n25 47 47\r\n6 43 50\r\n4 47 23\r\n5 38 30\r\n12 43 18\r\n8 38 28\r... | [{'input': '4 10 2\r\n2 3 8\r\n3 4 7\r\n', 'output': ['262']}, {'input': '50 50 50\r\n24 50 22\r\n26 27 22\r\n22 27 43\r\n16 48 24\r\n27 46 50\r\n2 34 22\r\n1 4 21\r\n33 48 7\r\n5 14 21\r\n37 43 19\r\n8 39 32\r\n20 21 4\r\n4 34 36\r\n12 23 29\r\n32 47 42\r\n11 32 31\r\n4 49 13\r\n3 16 35\r\n13 44 37\r\n17 29 45\r\n16 2... | [{'input': '50 50 50\r\n15 20 50\r\n11 36 39\r\n1 7 23\r\n11 25 16\r\n2 8 46\r\n44 47 5\r\n7 15 20\r\n6 35 23\r\n21 31 47\r\n14 42 3\r\n22 44 25\r\n7 12 15\r\n5 50 13\r\n29 29 38\r\n4 35 17\r\n1 23 37\r\n22 32 30\r\n17 25 21\r\n17 40 47\r\n5 31 8\r\n46 50 10\r\n21 45 32\r\n7 47 48\r\n9 48 17\r\n4 46 43\r\n20 42 19\r\n2... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 175 | 100 | 100 | 100 |
["2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4", "5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3"] | In first line given a sequence of 24 integers ai (1 ≤ ai ≤ 6), where ai denotes color of i-th square. There are exactly 4 occurrences of all colors in this sequence. | 881a820aa8184d9553278a0002a3b7c4 | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <set>
#include <map>
#include <string>
using namespace std;
int a[25];
int tu[8];
int b[6][8] = { { 22, 21, 18, 17, 5, 6, 14, 13 },
{ 3, 4, 17, 19, 10, 9, 16, 14 },
{ 7, 8, 19, 20, 23, 24, 15, 16 ... | ["NO", "YES"] | C++ | NoteIn first test case cube looks like this: In second test case cube looks like this: It's possible to solve cube by rotating face with squares with numbers 13, 14, 15, 16. | Print «YES» (without quotes) if it's possible to solve cube using one rotation and «NO» (without quotes) otherwise. | During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation o... | [{"input": "2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4\r\n", "output": ["NO", "no"]}, {"input": "5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3\r\n", "output": ["YES", "yes"]}, {"input": "2 6 3 3 5 5 2 6 1 1 6 4 4 4 2 4 6 5 3 1 2 5 3 1\r\n", "output": ["NO", "no"]}, {"input": "3 4 2 3 5 5 6 6 4 5 4 6 5 1 1 1 6 2 ... | 100 | 100 | 100 | [{'input': '5 6 1 1 4 5 6 5 4 6 2 1 4 2 6 5 3 2 3 2 3 1 3 4\r\n', 'output': ['NO', 'no']}, {'input': '4 4 4 5 2 3 4 1 3 3 1 5 6 5 6 6 1 3 6 2 5 2 1 2\r\n', 'output': ['NO', 'no']}, {'input': '1 1 1 1 5 5 3 3 4 4 4 4 3 3 2 2 6 6 5 5 2 2 6 6\r\n', 'output': ['YES', 'yes']}, {'input': '4 6 4 6 6 1 6 1 1 3 1 3 2 2 2 2 5 5 ... | [{'input': '1 1 2 2 3 3 1 1 2 2 3 3 4 4 4 4 5 5 5 5 6 6 6 6\r\n', 'output': ['NO', 'no']}, {'input': '4 4 2 5 3 2 4 2 5 3 6 4 6 5 1 3 1 5 6 3 1 1 6 2\r\n', 'output': ['NO', 'no']}, {'input': '2 6 3 3 5 5 2 6 1 1 6 4 4 4 2 4 6 5 3 1 2 5 3 1\r\n', 'output': ['NO', 'no']}, {'input': '3 3 2 3 6 4 4 4 1 2 1 3 2 5 6 6 1 2 6 ... | [{'input': '4 4 2 5 3 2 4 2 5 3 6 4 6 5 1 3 1 5 6 3 1 1 6 2\r\n', 'output': ['NO', 'no']}, {'input': '3 3 3 3 4 4 5 5 1 1 1 1 2 2 4 4 5 5 6 6 6 6 2 2\r\n', 'output': ['YES', 'yes']}, {'input': '5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3\r\n', 'output': ['YES', 'yes']}, {'input': '2 5 2 5 4 2 4 2 1 4 1 4 6 6 6 6 3 ... | [{'input': '4 4 3 3 5 5 5 5 1 1 6 6 3 6 3 6 4 1 4 1 2 2 2 2\r\n', 'output': ['YES', 'yes']}, {'input': '5 4 6 2 5 6 4 1 6 3 3 1 3 2 4 1 1 6 2 3 5 2 4 5\r\n', 'output': ['NO', 'no']}, {'input': '1 3 5 6 4 4 4 3 5 2 2 2 3 1 5 6 3 4 6 5 1 2 1 6\r\n', 'output': ['NO', 'no']}, {'input': '4 4 4 4 2 2 3 3 1 1 1 1 3 3 6 6 5 5 ... | [{'input': '3 3 3 3 4 4 5 5 1 1 1 1 2 2 4 4 5 5 6 6 6 6 2 2\r\n', 'output': ['YES', 'yes']}, {'input': '2 1 2 1 4 2 4 2 6 4 6 4 5 5 5 5 3 3 3 3 6 1 6 1\r\n', 'output': ['YES', 'yes']}, {'input': '6 6 2 2 3 3 3 3 4 4 5 5 4 6 4 6 5 2 5 2 1 1 1 1\r\n', 'output': ['YES', 'yes']}, {'input': '5 4 6 2 5 6 4 1 6 3 3 1 3 2 4 1 ... | 100 | 100 | 100 | 100 | 100 | 97.87 | 97.87 | 100 | 97.87 | 97.87 | 96.67 | 96.67 | 100 | 96.67 | 96.67 | 176 | 100 | 98.296 | 97.336 |
["0 0 2 0 0 1", "2 3 4 5 6 6", "-1 0 2 0 0 1"] | The first input line contains 6 space-separated integers x1, y1, x2, y2, x3, y3 — coordinates of the triangle's vertices. All the coordinates are integer and don't exceed 100 in absolute value. It's guaranteed that the triangle is nondegenerate, i.e. its total area is not zero. | 8324fa542297c21bda1a4aed0bd45a2d | #include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int x[20];
int ck()
{
int i;
int a,b,c,d;
for (i=1;i<=6;++i) x[i+6]=x[i];
for (i=1;i<6;i+=2)
{
a=x[i]-x[i+2]; b=x[i+1]-x[i+3];
if (a==0&&b==0) return 0;
}
for (i=1;i<6;i+=2)
{
a=x[i]-x[i+2]... | ["RIGHT", "NEITHER", "ALMOST"] | C++ | null | If the given triangle is right-angled, output RIGHT, if it is almost right-angled, output ALMOST, and if it is neither of these, output NEITHER. | At a geometry lesson Bob learnt that a triangle is called right-angled if it is nondegenerate and one of its angles is right. Bob decided to draw such a triangle immediately: on a sheet of paper he drew three points with integer coordinates, and joined them with segments of straight lines, then he showed the triangle t... | [{"input": "0 0 2 0 0 1\r\n", "output": ["RIGHT"]}, {"input": "2 3 4 5 6 6\r\n", "output": ["NEITHER"]}, {"input": "-1 0 2 0 0 1\r\n", "output": ["ALMOST"]}, {"input": "27 74 85 23 100 99\r\n", "output": ["NEITHER"]}, {"input": "-97 -19 17 62 30 -76\r\n", "output": ["NEITHER"]}, {"input": "28 -15 86 32 98 -41\r\n", "ou... | 100 | 100 | 100 | [{'input': '-7 63 78 74 -39 -30\r\n', 'output': ['NEITHER']}, {'input': '-49 -99 7 92 61 -28\r\n', 'output': ['NEITHER']}, {'input': '30 8 49 13 25 27\r\n', 'output': ['RIGHT']}, {'input': '0 0 1 0 2 2\r\n', 'output': ['ALMOST']}, {'input': '-50 0 0 50 0 -49\r\n', 'output': ['ALMOST']}] | [{'input': '-50 0 -1 50 0 -50\r\n', 'output': ['ALMOST']}, {'input': '39 22 95 25 42 -33\r\n', 'output': ['ALMOST']}, {'input': '-67 49 89 -76 -37 87\r\n', 'output': ['NEITHER']}, {'input': '4 -13 4 -49 -24 -13\r\n', 'output': ['RIGHT']}, {'input': '0 0 1 0 100 1\r\n', 'output': ['NEITHER']}] | [{'input': '-45 -87 -34 -79 -60 -62\r\n', 'output': ['NEITHER']}, {'input': '-50 0 0 50 0 -50\r\n', 'output': ['RIGHT']}, {'input': '22 32 -33 -30 -18 68\r\n', 'output': ['NEITHER']}, {'input': '-67 49 89 -76 -37 87\r\n', 'output': ['NEITHER']}, {'input': '-50 0 0 50 -1 -50\r\n', 'output': ['ALMOST']}] | [{'input': '60 4 90 -53 32 -12\r\n', 'output': ['ALMOST']}, {'input': '0 0 1 0 3 1\r\n', 'output': ['ALMOST']}, {'input': '-19 0 -89 -54 25 -57\r\n', 'output': ['NEITHER']}, {'input': '-50 0 0 50 -1 -50\r\n', 'output': ['ALMOST']}, {'input': '-45 -87 -34 -79 -60 -62\r\n', 'output': ['NEITHER']}] | [{'input': '0 0 1 0 2 1\r\n', 'output': ['ALMOST']}, {'input': '27 74 85 23 100 99\r\n', 'output': ['NEITHER']}, {'input': '0 0 1 0 2 2\r\n', 'output': ['ALMOST']}, {'input': '-7 63 78 74 -39 -30\r\n', 'output': ['NEITHER']}, {'input': '0 0 1 0 3 1\r\n', 'output': ['ALMOST']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 94.74 | 94.74 | 100 | 100 | 90.91 | 90.91 | 95.45 | 177 | 100 | 97.896 | 95.454 |
["1 1 1 1 1 1", "1 2 1 2 1 2"] | The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists. | 382475475427f0e76c6b4ac6e7a02e21 | #include <bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f;
int main()
{
cin >> a >> b >> c >> d >> e >> f;
printf("%d\n",(a + b + c) * (a + b + c) - a * a - c * c - e * e);
return 0;
} | ["6", "13"] | C++ | NoteThis is what Gerald's hexagon looks like in the first sample:And that's what it looks like in the second sample: | Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split. | Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.He painte... | [{"input": "1 1 1 1 1 1\r\n", "output": ["6"]}, {"input": "1 2 1 2 1 2\r\n", "output": ["13"]}, {"input": "2 4 5 3 3 6\r\n", "output": ["83"]}, {"input": "45 19 48 18 46 21\r\n", "output": ["6099"]}, {"input": "66 6 65 6 66 5\r\n", "output": ["5832"]}, {"input": "7 5 4 8 4 5\r\n", "output": ["175"]}, {"input": "3 2 1 4... | 100 | 100 | 100 | [{'input': '1 1000 1 1 1000 1\r\n', 'output': ['4002']}, {'input': '7 1 7 3 5 3\r\n', 'output': ['102']}, {'input': '718 466 729 470 714 481\r\n', 'output': ['2102808']}, {'input': '1 6 1 5 2 5\r\n', 'output': ['58']}, {'input': '9 2 9 3 8 3\r\n', 'output': ['174']}] | [{'input': '888 888 888 887 889 887\r\n', 'output': ['4729487']}, {'input': '1000 1 1000 999 2 999\r\n', 'output': ['2003997']}, {'input': '7 1 7 3 5 3\r\n', 'output': ['102']}, {'input': '1000 1000 1 1000 1000 1\r\n', 'output': ['2004000']}, {'input': '1000 1000 1000 1000 1000 1000\r\n', 'output': ['6000000']}] | [{'input': '1000 1000 1 1000 1000 1\r\n', 'output': ['2004000']}, {'input': '45 19 48 18 46 21\r\n', 'output': ['6099']}, {'input': '2 4 5 3 3 6\r\n', 'output': ['83']}, {'input': '50 40 46 38 52 34\r\n', 'output': ['11176']}, {'input': '125 7 128 8 124 11\r\n', 'output': ['20215']}] | [{'input': '1 577 7 576 2 582\r\n', 'output': ['342171']}, {'input': '1 2 1 2 1 2\r\n', 'output': ['13']}, {'input': '718 466 729 470 714 481\r\n', 'output': ['2102808']}, {'input': '3 2 1 4 1 2\r\n', 'output': ['25']}, {'input': '2 4 5 3 3 6\r\n', 'output': ['83']}] | [{'input': '1 1000 1 1 1000 1\r\n', 'output': ['4002']}, {'input': '45 19 48 18 46 21\r\n', 'output': ['6099']}, {'input': '50 40 46 38 52 34\r\n', 'output': ['11176']}, {'input': '7 5 4 8 4 5\r\n', 'output': ['175']}, {'input': '125 7 128 8 124 11\r\n', 'output': ['20215']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 178 | 100 | 100 | 100 |
["7", "8", "9"] | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^9$$$). | 5551742f6ab39fdac3930d866f439e3e | #include <bits/stdc++.h>
using namespace std;
long long n,dem=0;
int main()
{cin>>n;
cout<<n/2+1;
}
| ["4", "5", "5"] | C++ | NoteIn the first sample, there are following possible weights of splits of $$$7$$$:Weight 1: [$$$\textbf 7$$$] Weight 2: [$$$\textbf 3$$$, $$$\textbf 3$$$, 1] Weight 3: [$$$\textbf 2$$$, $$$\textbf 2$$$, $$$\textbf 2$$$, 1] Weight 7: [$$$\textbf 1$$$, $$$\textbf 1$$$, $$$\textbf 1$$$, $$$\textbf 1$$$, $$$\textbf 1$$$, ... | Output one integer — the answer to the problem. | Let's define a split of $$$n$$$ as a nonincreasing sequence of positive integers, the sum of which is $$$n$$$. For example, the following sequences are splits of $$$8$$$: $$$[4, 4]$$$, $$$[3, 3, 2]$$$, $$$[2, 2, 1, 1, 1, 1]$$$, $$$[5, 2, 1]$$$.The following sequences aren't splits of $$$8$$$: $$$[1, 7]$$$, $$$[5, 4]$$$... | [{"input": "7\r\n", "output": ["4"]}, {"input": "8\r\n", "output": ["5"]}, {"input": "9\r\n", "output": ["5"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "286\r\n", "output": ["144"]}, {"input": "48\r\n", "output": ["25"]}, {"input": "941\r\n", "output": ["471"]}, {"input": "45154\r\n", "output": ["22578"]}, {"inp... | 100 | 100 | 100 | [{'input': '123957268\r\n', 'output': ['61978635']}, {'input': '2453786\r\n', 'output': ['1226894']}, {'input': '58288\r\n', 'output': ['29145']}, {'input': '286\r\n', 'output': ['144']}, {'input': '576768825\r\n', 'output': ['288384413']}] | [{'input': '62258\r\n', 'output': ['31130']}, {'input': '7\r\n', 'output': ['4']}, {'input': '7359066\r\n', 'output': ['3679534']}, {'input': '7928871\r\n', 'output': ['3964436']}, {'input': '123957268\r\n', 'output': ['61978635']}] | [{'input': '35668\r\n', 'output': ['17835']}, {'input': '48\r\n', 'output': ['25']}, {'input': '751453521\r\n', 'output': ['375726761']}, {'input': '589992198\r\n', 'output': ['294996100']}, {'input': '439004204\r\n', 'output': ['219502103']}] | [{'input': '7\r\n', 'output': ['4']}, {'input': '45154\r\n', 'output': ['22578']}, {'input': '7263670\r\n', 'output': ['3631836']}, {'input': '79811\r\n', 'output': ['39906']}, {'input': '789954052\r\n', 'output': ['394977027']}] | [{'input': '234149297\r\n', 'output': ['117074649']}, {'input': '35668\r\n', 'output': ['17835']}, {'input': '2453786\r\n', 'output': ['1226894']}, {'input': '2636452\r\n', 'output': ['1318227']}, {'input': '5076901\r\n', 'output': ['2538451']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 179 | 100 | 100 | 100 |
["4", "9"] | The only line contains a single integer x (1 ≤ x ≤ 100) — the required sharpness of the matrix. | 01eccb722b09a0474903b7e5abc4c47a | /*
一个(2*i+1)*(2*i+1)的对称矩阵最多容纳的1的数量=((2*i+1)*(2*i+1)+1)/2
答案就是2*i+1
所以暴力即可。
特别的,当i=3时,由于边长为5的矩阵比较神奇,可以有多种排法,所以特判一下i=3时输出5。
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
int main(){
cin>>n;
if(n==3){puts("5");return 0;}
for(int i=1;;i+=2){
if(i*i+1>>1>=n){printf("%d\n",i... | ["3", "5"] | C++ | NoteThe figure below shows the matrices that correspond to the samples: | Print a single number — the sought value of n. | Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix which is located at the intersection of the i-row and the j-th column as Ai, j.Let... | [{"input": "4\r\n", "output": ["3"]}, {"input": "9\r\n", "output": ["5"]}, {"input": "10\r\n", "output": ["5"]}, {"input": "12\r\n", "output": ["5"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "19\r\n", "output": ["7"]}, {"input": "3\r\n", "output": ["5"]}, {"input": "2\r\n", "output": ["3"]}, {"input": "5\r\n", "... | 100 | 100 | 100 | [{'input': '49\r\n', 'output': ['11']}, {'input': '63\r\n', 'output': ['13']}, {'input': '32\r\n', 'output': ['9']}, {'input': '40\r\n', 'output': ['9']}, {'input': '84\r\n', 'output': ['13']}] | [{'input': '33\r\n', 'output': ['9']}, {'input': '41\r\n', 'output': ['9']}, {'input': '72\r\n', 'output': ['13']}, {'input': '30\r\n', 'output': ['9']}, {'input': '53\r\n', 'output': ['11']}] | [{'input': '67\r\n', 'output': ['13']}, {'input': '98\r\n', 'output': ['15']}, {'input': '80\r\n', 'output': ['13']}, {'input': '48\r\n', 'output': ['11']}, {'input': '92\r\n', 'output': ['15']}] | [{'input': '74\r\n', 'output': ['13']}, {'input': '36\r\n', 'output': ['9']}, {'input': '35\r\n', 'output': ['9']}, {'input': '71\r\n', 'output': ['13']}, {'input': '19\r\n', 'output': ['7']}] | [{'input': '30\r\n', 'output': ['9']}, {'input': '45\r\n', 'output': ['11']}, {'input': '22\r\n', 'output': ['7']}, {'input': '58\r\n', 'output': ['11']}, {'input': '65\r\n', 'output': ['13']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 75 | 75 | 75 | 75 | 180 | 100 | 100 | 75 |
["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<bits/stdc++.h>
#include<stdio.h>
#include<string>
using namespace std;
string str,st="QAQ";
int ans;
void DG(int sum,int x){
if(sum==3){
ans++;
return;
}
for(int i=x+1;i<str.size();i++)
if(str[i]==st[sum]) DG(sum+1,i);
}
int main(){
ios::sync_with_stdio(false);
getline(cin,str);
DG(0,-1);
cout<<an... | ["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': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ\r\n', 'output': ['0']}, {'input': 'RQAWNACASAAKAGAAAAQ\r\n', 'output': ['10']}, {'input': 'QORZOYAQ\r\n', 'output': ['1']}, {'input': 'AMQQAAQAAQAAAAAAQQQBOAAANAAKQJCYQAE\r\n', 'output': ['254']}, {'input': ... | [{'input': 'MAQQWAQOYQMAAAQAQPQZAOAAQAUAQNAAQAAAITQSAQAKAQKAQQWSQAAQQAGUCDQMQWKQUXKWQQAAQQAAQQZQDQQQAABXQUUXQOA\r\n', 'output': ['5422']}, {'input': 'QJAWZAAOAAGIAAAAAOQATASQAEAAAAQFQQHPA\r\n', 'output': ['111']}, {'input': 'QQAAQASGAYAAAAKAKAQIQEAQAIAAIAQQQQQ\r\n', 'output': ['378']}, {'input': 'DBA\r\n', 'output': ['... | [{'input': 'W\r\n', 'output': ['0']}, {'input': 'QCQAQAGAWAQQQAQAVQAQQQQAQAQQQAQAAATQAAVAAAQQQQAAAUUQAQQNQQWQQWAQAAQQKQYAQAAQQQAAQRAQQQWBQQQQAPBAQGQA\r\n', 'output': ['13174']}, {'input': 'QJAWZAAOAAGIAAAAAOQATASQAEAAAAQFQQHPA\r\n', 'output': ['111']}, {'input': 'AQQQQAQAAQQAQAQAAAAAAAAAQAQAAAAAQAQAQQQAQQQAAAQQQAAAAAAA... | [{'input': 'QQKWQAQAAAAAAAAGAAVAQUEQQUMQMAQQQNQLAMAAAUAEAAEMAAA\r\n', 'output': ['411']}, {'input': 'RQAWNACASAAKAGAAAAQ\r\n', 'output': ['10']}, {'input': 'DBA\r\n', 'output': ['0']}, {'input': 'LQMAQQARQAQBJQQQAGAAZQQXALQQAARQAQQQQAAQQAQQQAQQCAQQAQQAYQQQRAAZATQALYQQAAHHAAQHAAAAAAAAQQMAAQNAKQ\r\n', 'output': ['7768']}... | [{'input': 'QQAAQASGAYAAAAKAKAQIQEAQAIAAIAQQQQQ\r\n', 'output': ['378']}, {'input': 'QAQQQZZYNOIWIN\r\n', 'output': ['3']}, {'input': 'AAQXAAQAYQAAAAGAQHVQYAGIVACADFAAQAAAAQZAAQMAKZAADQAQDAAQDAAAMQQOXYAQQQAKQBAAQQKAXQBJZDDLAAHQQ\r\n', 'output': ['2962']}, {'input': 'QTAAQDAQXAQQJQQQGAAAQQQQSBQZKAQQAQQQQEAQNUQBZCQLYQZQE... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 181 | 100 | 100 | 100 |
["100010001", "100"] | In the only line given a non-empty binary string s with length up to 100. | 88364b8d71f2ce2b90bdfaa729eb92ca | #include <cstdio>
#include <cstring>
char S[102] , n;
int main()
{
scanf("%s" , S);
n = strlen(S);
int pozicija_prve_jedinice = -1;
for (int i = 0;i < n;++i) if (S[i] == '1')
{
pozicija_prve_jedinice = i;
break;
}
if (pozicija_prve_jedinice != -1)
{
int broj_nu... | ["yes", "no"] | C++ | NoteIn the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system.You can read more about binary numeral system representation here: https://en.wikipedia.org/wiki/Binary_system | Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise. | Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisibl... | [{"input": "100010001\r\n", "output": ["YES", "yes"]}, {"input": "100\r\n", "output": ["NO", "no"]}, {"input": "0000001000000\r\n", "output": ["YES", "yes"]}, {"input": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\r\n", "output": ["NO", "no"]}, {"input": "1111111... | 100 | 100 | 100 | [{'input': '000000000000000000000000000111111111111111\r\n', 'output': ['NO', 'no']}, {'input': '000000000001\r\n', 'output': ['NO', 'no']}, {'input': '0010101010\r\n', 'output': ['NO', 'no']}, {'input': '100010001\r\n', 'output': ['YES', 'yes']}, {'input': '00000001\r\n', 'output': ['NO', 'no']}] | [{'input': '0001100000\r\n', 'output': ['NO', 'no']}, {'input': '0000000000011\r\n', 'output': ['NO', 'no']}, {'input': '0000000000000000\r\n', 'output': ['NO', 'no']}, {'input': '0010000000000100\r\n', 'output': ['YES', 'yes']}, {'input': '00000000111\r\n', 'output': ['NO', 'no']}] | [{'input': '000000000000000\r\n', 'output': ['NO', 'no']}, {'input': '0000000000011\r\n', 'output': ['NO', 'no']}, {'input': '0000000000000011111111111111111\r\n', 'output': ['NO', 'no']}, {'input': '000000000000000000000\r\n', 'output': ['NO', 'no']}, {'input': '000000011\r\n', 'output': ['NO', 'no']}] | [{'input': '0000000000011\r\n', 'output': ['NO', 'no']}, {'input': '0000100\r\n', 'output': ['NO', 'no']}, {'input': '00000000111\r\n', 'output': ['NO', 'no']}, {'input': '000000000000000000000000000111111111111111\r\n', 'output': ['NO', 'no']}, {'input': '0000001000000\r\n', 'output': ['YES', 'yes']}] | [{'input': '000000000000000\r\n', 'output': ['NO', 'no']}, {'input': '000001000\r\n', 'output': ['NO', 'no']}, {'input': '100000000\r\n', 'output': ['YES', 'yes']}, {'input': '0000000000000000000000000000000000000000000000000\r\n', 'output': ['NO', 'no']}, {'input': '000010000\r\n', 'output': ['NO', 'no']}] | 100 | 100 | 100 | 100 | 100 | 92.31 | 100 | 100 | 92.31 | 100 | 83.33 | 100 | 83.33 | 83.33 | 100 | 182 | 100 | 96.924 | 89.998 |
["2", "3", "20"] | The only line contains single integer k (1 ≤ k ≤ 400). | fda761834f7b5800f540178ac1c79fca | #include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int mo=1e9+7;
int f[500][500],C[500][500],I[500],nI[500];
long long A[500];
int n;
int quick(int k1,int k2){
int k3=1;
while (k2){
if (k2&1) k3=1ll*k3*k1%mo; k2>>=1; k1=1ll*k1*k1%mo;
}
return k3;
}... | ["9", "245", "550384565"] | C++ | NoteThere are 9 paths in the first example (the vertices are numbered on the picture below): 1, 2, 3, 1-2, 2-1, 1-3, 3-1, 2-1-3, 3-1-2. Singer 2-house | Print single integer — the answer for the task modulo 109 + 7. | It is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all its successors, if they are not yet present. Singer 4-house Count the number of non-empty paths in ... | [{"input": "2\r\n", "output": ["9"]}, {"input": "3\r\n", "output": ["245"]}, {"input": "20\r\n", "output": ["550384565"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "4\r\n", "output": ["126565"]}, {"input": "5\r\n", "output": ["54326037"]}, {"input": "6\r\n", "output": ["321837880"]}, {"input": "7\r\n", "output": ... | 100 | 100 | 100 | [{'input': '251\r\n', 'output': ['192479791']}, {'input': '4\r\n', 'output': ['126565']}, {'input': '392\r\n', 'output': ['275683011']}, {'input': '171\r\n', 'output': ['979036950']}, {'input': '121\r\n', 'output': ['631667314']}] | [{'input': '201\r\n', 'output': ['667160634']}, {'input': '291\r\n', 'output': ['850484840']}, {'input': '161\r\n', 'output': ['105884826']}, {'input': '9\r\n', 'output': ['328083248']}, {'input': '392\r\n', 'output': ['275683011']}] | [{'input': '396\r\n', 'output': ['786963365']}, {'input': '281\r\n', 'output': ['781971312']}, {'input': '10\r\n', 'output': ['838314395']}, {'input': '161\r\n', 'output': ['105884826']}, {'input': '399\r\n', 'output': ['174591541']}] | [{'input': '191\r\n', 'output': ['762720192']}, {'input': '81\r\n', 'output': ['784719328']}, {'input': '61\r\n', 'output': ['384672708']}, {'input': '321\r\n', 'output': ['36248116']}, {'input': '341\r\n', 'output': ['502180086']}] | [{'input': '11\r\n', 'output': ['220816781']}, {'input': '301\r\n', 'output': ['484957644']}, {'input': '399\r\n', 'output': ['174591541']}, {'input': '351\r\n', 'output': ['625447969']}, {'input': '31\r\n', 'output': ['810384961']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 183 | 100 | 100 | 100 |
["1 1", "1 2", "2 1"] | The single line contains two integers r, h (1 ≤ r, h ≤ 107). | ae883bf16842c181ea4bd123dee12ef9 | #include <bits/stdc++.h>
using namespace std;
#define reps(i, s, n) for(int i=s; i<n; i++)
#define rep(i, n) reps(i, 0, n)
#define dreps(i, s, n) for(int i=n-1; i>=s; i--)
#define drep(i, n) dreps(i, 0, n)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define foreach(v, c) for(__typeof(... | ["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': '2377906 4774524\r\n', 'output': ['5']}, {'input': '1 10000000\r\n', 'output': ['20000001']}, {'input': '100 50\r\n', 'output': ['2']}, {'input': '5 6\r\n', 'output': ['3']}, {'input': '4 1\r\n', 'output': ['1']}] | [{'input': '10000 38661\r\n', 'output': ['9']}, {'input': '10000 9999\r\n', 'output': ['3']}, {'input': '3 9999999\r\n', 'output': ['6666667']}, {'input': '2000000 1999999\r\n', 'output': ['3']}, {'input': '2 10000000\r\n', 'output': ['10000001']}] | [{'input': '5693778 7001807\r\n', 'output': ['3']}, {'input': '1526002 6904227\r\n', 'output': ['10']}, {'input': '5 5\r\n', 'output': ['3']}, {'input': '2000000 1999999\r\n', 'output': ['3']}, {'input': '100 199\r\n', 'output': ['5']}] | [{'input': '586 5534221\r\n', 'output': ['18889']}, {'input': '1000000 1999999\r\n', 'output': ['5']}, {'input': '5 1\r\n', 'output': ['1']}, {'input': '2377906 4774524\r\n', 'output': ['5']}, {'input': '10000000 866254\r\n', 'output': ['1']}] | [{'input': '8 7\r\n', 'output': ['3']}, {'input': '98 1358794\r\n', 'output': ['27731']}, {'input': '100 49\r\n', 'output': ['1']}, {'input': '4841874 9131511\r\n', 'output': ['5']}, {'input': '1526002 6904227\r\n', 'output': ['10']}] | 100 | 100 | 100 | 100 | 100 | 100 | 90.91 | 100 | 90.91 | 100 | 75 | 75 | 100 | 75 | 100 | 184 | 100 | 96.364 | 85 |
["3 5", "6 66"] | The first line of the input contains integer numbers l, r (1 ≤ l, r ≤ 3·108). | 55a83526c10126ac3a6e6e5154b120d0 | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
//#include<bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>... | ["1", "7"] | C++ | null | In the only line print the number of days on the segment [l, r], which are lucky for Peter and Bob at the same time. | On the math lesson a teacher asked each pupil to come up with his own lucky numbers. As a fan of number theory Peter chose prime numbers. Bob was more original. He said that number t is his lucky number, if it can be represented as: t = a2 + b2, where a, b are arbitrary positive integers.Now, the boys decided to find ... | [{"input": "3 5\r\n", "output": ["1"]}, {"input": "6 66\r\n", "output": ["7"]}, {"input": "15 23\r\n", "output": ["1"]}, {"input": "124124 1235125\r\n", "output": ["41860"]}, {"input": "1 1\r\n", "output": ["0"]}, {"input": "13 13\r\n", "output": ["1"]}, {"input": "7 54321\r\n", "output": ["2749"]}, {"input": "10000000... | 100 | 100 | 100 | [{'input': '4587457 53343959\r\n', 'output': ['1433687']}, {'input': '233333333 300000000\r\n', 'output': ['1718394']}, {'input': '15 23\r\n', 'output': ['1']}, {'input': '457342 225575638\r\n', 'output': ['6186877']}, {'input': '231231231 296373010\r\n', 'output': ['1680139']}] | [{'input': '233333333 300000000\r\n', 'output': ['1718394']}, {'input': '152512 265014995\r\n', 'output': ['7220052']}, {'input': '7 54321\r\n', 'output': ['2749']}, {'input': '666 171304384\r\n', 'output': ['4785310']}, {'input': '13 170334008\r\n', 'output': ['4759800']}] | [{'input': '123123 277416577\r\n', 'output': ['7540625']}, {'input': '100000013 143135280\r\n', 'output': ['1158872']}, {'input': '300000000 300000000\r\n', 'output': ['0']}, {'input': '1457 286080130\r\n', 'output': ['7768743']}, {'input': '123123123 269866764\r\n', 'output': ['3847785']}] | [{'input': '12453 60066316\r\n', 'output': ['1781786']}, {'input': '6000 297577626\r\n', 'output': ['8063442']}, {'input': '7000 114289582\r\n', 'output': ['3266461']}, {'input': '200010000 300000000\r\n', 'output': ['2586636']}, {'input': '300 99050033\r\n', 'output': ['2854733']}] | [{'input': '288888888 300000000\r\n', 'output': ['284683']}, {'input': '400 246187040\r\n', 'output': ['6740466']}, {'input': '444 169128168\r\n', 'output': ['4727892']}, {'input': '13 13\r\n', 'output': ['1']}, {'input': '100000009 113443527\r\n', 'output': ['363753']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 85 | 85 | 85 | 85 | 85 | 185 | 100 | 100 | 85 |
["2", "3", "6"] | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^6$$$) — the length of the permutations. | b2d59b1279d891dba9372a52364bced2 | #include<bits/stdc++.h>
#define MAX 1000000007
#define SIZE 1000005
int dp[SIZE][20][3];
int n;
int fun(int x, int y){
int temp =(1<<x);
if(y)
temp*=3;
return n/temp;
}
int main(){
int i,a,al,b;
scanf("%d",&n);
while((1<<al)<=n)
al++;
al--;
dp[1][al][0]=1;
if((1<<(al-1))*3<=n)
dp[1][al-1][1]=1;
for(... | ["1", "4", "120"] | C++ | NoteConsider the second example: these are the permutations of length $$$3$$$: $$$[1,2,3]$$$, $$$f(p)=1$$$. $$$[1,3,2]$$$, $$$f(p)=1$$$. $$$[2,1,3]$$$, $$$f(p)=2$$$. $$$[2,3,1]$$$, $$$f(p)=2$$$. $$$[3,1,2]$$$, $$$f(p)=2$$$. $$$[3,2,1]$$$, $$$f(p)=2$$$. The maximum value $$$f_{max}(3) = 2$$$, and there are $$$4$$$... | The only line should contain your answer modulo $$$10^9+7$$$. | Let's define a function $$$f(p)$$$ on a permutation $$$p$$$ as follows. Let $$$g_i$$$ be the greatest common divisor (GCD) of elements $$$p_1$$$, $$$p_2$$$, ..., $$$p_i$$$ (in other words, it is the GCD of the prefix of length $$$i$$$). Then $$$f(p)$$$ is the number of distinct elements among $$$g_1$$$, $$$g_2$$$, ...,... | [{"input": "2\r\n", "output": ["1"]}, {"input": "3\r\n", "output": ["4"]}, {"input": "6\r\n", "output": ["120"]}, {"input": "10\r\n", "output": ["15120"]}, {"input": "64\r\n", "output": ["676169815"]}, {"input": "1227\r\n", "output": ["9412302"]}, {"input": "49152\r\n", "output": ["468540828"]}, {"input": "1000000\r\n"... | 100 | 100 | 100 | [{'input': '639\r\n', 'output': ['32577133']}, {'input': '40\r\n', 'output': ['193507326']}, {'input': '1000000\r\n', 'output': ['943169120']}, {'input': '582911\r\n', 'output': ['825030283']}, {'input': '7127\r\n', 'output': ['515942917']}] | [{'input': '28211\r\n', 'output': ['5179894']}, {'input': '8\r\n', 'output': ['240']}, {'input': '2\r\n', 'output': ['1']}, {'input': '175863\r\n', 'output': ['442215433']}, {'input': '16339\r\n', 'output': ['166382218']}] | [{'input': '683\r\n', 'output': ['951224867']}, {'input': '16339\r\n', 'output': ['166382218']}, {'input': '3116\r\n', 'output': ['390594722']}, {'input': '957\r\n', 'output': ['885557037']}, {'input': '847\r\n', 'output': ['206774372']}] | [{'input': '71\r\n', 'output': ['744016814']}, {'input': '42\r\n', 'output': ['270627256']}, {'input': '4\r\n', 'output': ['2']}, {'input': '798412\r\n', 'output': ['47586814']}, {'input': '62544\r\n', 'output': ['554785078']}] | [{'input': '50\r\n', 'output': ['938830187']}, {'input': '957\r\n', 'output': ['885557037']}, {'input': '786431\r\n', 'output': ['973886300']}, {'input': '89\r\n', 'output': ['222320695']}, {'input': '8\r\n', 'output': ['240']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 186 | 100 | 100 | 100 |
["4 6", "9 7", "1 1"] | The only line of input contains two integers r and g, separated by a single space — the number of available red and green blocks respectively (0 ≤ r, g ≤ 2·105, r + g ≥ 1). | 34b6286350e3531c1fbda6b0c184addc | #include <bits/stdc++.h>
using namespace std;
int dp[200010];
const int mod = 1000000007;
int r,g;
int h;
int ans = 0;
int sum;
int main() {
memset (dp,0,sizeof(dp));
cin>>r>>g;
h=sqrt(r+g+r+g);
while(h*(h+1)<=r+g+r+g) h++;
dp[0]= 1;
for(int i=1; i<h; i++) {
for(int j=r; j>=i; j--) {
dp[j] += dp[j-i];
dp[... | ["2", "6", "2"] | C++ | NoteThe image in the problem statement shows all possible red-green towers for the first sample. | Output the only integer — the number of different possible red-green towers of height h modulo 109 + 7. | There are r red and g green blocks for construction of the red-green tower. Red-green tower can be built following next rules: Red-green tower is consisting of some number of levels; Let the red-green tower consist of n levels, then the first level of this tower should consist of n blocks, second level — of n - 1 blo... | [{"input": "4 6\r\n", "output": ["2"]}, {"input": "9 7\r\n", "output": ["6"]}, {"input": "1 1\r\n", "output": ["2"]}, {"input": "3 3\r\n", "output": ["2"]}, {"input": "2 19\r\n", "output": ["1"]}, {"input": "18 3\r\n", "output": ["2"]}, {"input": "100000 1\r\n", "output": ["2"]}, {"input": "1 100000\r\n", "output": ["2... | 100 | 100 | 100 | [{'input': '9 7\r\n', 'output': ['6']}, {'input': '1 100000\r\n', 'output': ['2']}, {'input': '199585 199586\r\n', 'output': ['438320405']}, {'input': '136749 183300\r\n', 'output': ['906576609']}, {'input': '200000 200000\r\n', 'output': ['206874596']}] | [{'input': '199585 199585\r\n', 'output': ['199771918']}, {'input': '78250 121147\r\n', 'output': ['981737243']}, {'input': '1 1\r\n', 'output': ['2']}, {'input': '38 36\r\n', 'output': ['612']}, {'input': '200000 0\r\n', 'output': ['1']}] | [{'input': '38 36\r\n', 'output': ['612']}, {'input': '136749 183300\r\n', 'output': ['906576609']}, {'input': '0 200000\r\n', 'output': ['1']}, {'input': '107344 159729\r\n', 'output': ['849320920']}, {'input': '121146 78249\r\n', 'output': ['832902708']}] | [{'input': '0 1\r\n', 'output': ['1']}, {'input': '200000 0\r\n', 'output': ['1']}, {'input': '199585 199586\r\n', 'output': ['438320405']}, {'input': '2 19\r\n', 'output': ['1']}, {'input': '3 3\r\n', 'output': ['2']}] | [{'input': '0 199397\r\n', 'output': ['1']}, {'input': '100000 1\r\n', 'output': ['2']}, {'input': '200000 199999\r\n', 'output': ['396481680']}, {'input': '121147 78249\r\n', 'output': ['64290784']}, {'input': '199396 0\r\n', 'output': ['1']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 187 | 100 | 100 | 100 |
["3 1", "3 2", "2 0", "2 2"] | The first line contains integers n, k (1 ≤ n ≤ 500; 0 ≤ k ≤ 500). | 111673158df2e37ac6c019bb99225ccb | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)503;
const int MAXS = (int)62503;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
int n, m, pwr[MAXS];
ll dp[MAXN][MAXN], c, t;
int main()
{
scanf("%d %d", &n, &m);
pwr[0] = 1;
for (int i = 1... | ["23", "32", "1", "2"] | C++ | null | In a single line, print the answer to the problem modulo 1000000007 (109 + 7). | Let's assume that set S consists of m distinct intervals [l1, r1], [l2, r2], ..., [lm, rm] (1 ≤ li ≤ ri ≤ n; li, ri are integers).Let's assume that f(S) is the maximum number of intervals that you can choose from the set S, such that every two of them do not intersect. We assume that two intervals, [l1, r1] and [l2, r2... | [{"input": "3 1\r\n", "output": ["23"]}, {"input": "3 2\r\n", "output": ["32"]}, {"input": "2 0\r\n", "output": ["1"]}, {"input": "2 2\r\n", "output": ["2"]}, {"input": "20 10\r\n", "output": ["169364726"]}, {"input": "50 49\r\n", "output": ["560578792"]}, {"input": "50 100\r\n", "output": ["0"]}, {"input": "10 0\r\n",... | 100 | 100 | 100 | [{'input': '3 2\r\n', 'output': ['32']}, {'input': '99 60\r\n', 'output': ['97903617']}, {'input': '50 0\r\n', 'output': ['1']}, {'input': '1 1\r\n', 'output': ['1']}, {'input': '20 10\r\n', 'output': ['169364726']}] | [{'input': '500 499\r\n', 'output': ['582854781']}, {'input': '10 0\r\n', 'output': ['1']}, {'input': '400 500\r\n', 'output': ['0']}, {'input': '3 2\r\n', 'output': ['32']}, {'input': '95 93\r\n', 'output': ['483334618']}] | [{'input': '500 500\r\n', 'output': ['731931766']}, {'input': '500 499\r\n', 'output': ['582854781']}, {'input': '5 3\r\n', 'output': ['14720']}, {'input': '3 1\r\n', 'output': ['23']}, {'input': '100 99\r\n', 'output': ['599757793']}] | [{'input': '95 93\r\n', 'output': ['483334618']}, {'input': '4 4\r\n', 'output': ['64']}, {'input': '400 399\r\n', 'output': ['760864214']}, {'input': '1 100\r\n', 'output': ['0']}, {'input': '3 1\r\n', 'output': ['23']}] | [{'input': '400 500\r\n', 'output': ['0']}, {'input': '3 1\r\n', 'output': ['23']}, {'input': '100 100\r\n', 'output': ['281603733']}, {'input': '10 0\r\n', 'output': ['1']}, {'input': '100 99\r\n', 'output': ['599757793']}] | 100 | 100 | 100 | 100 | 100 | 89.47 | 94.74 | 100 | 89.47 | 89.47 | 75 | 87.5 | 100 | 75 | 75 | 188 | 100 | 92.63 | 82.5 |
["0 0\n4 5", "3 4\n6 1"] | The first line contains two integers x1, y1 ( - 109 ≤ x1, y1 ≤ 109) — the start position of the robot. The second line contains two integers x2, y2 ( - 109 ≤ x2, y2 ≤ 109) — the finish position of the robot. | a6e9405bc3d4847fe962446bc1c457b4 | #include <iostream>
#include<cmath>
using namespace std;
typedef long long ll;
ll x,y,x2,y2,ans;
int main()
{
cin>>x>>y>>x2>>y2;
ans=max(abs(x-x2),abs(y-y2));
cout<<ans<<endl;
return 0;
}
| ["5", "3"] | C++ | NoteIn the first example robot should increase both of its coordinates by one four times, so it will be in position (4, 4). After that robot should simply increase its y coordinate and get the finish position.In the second example robot should simultaneously increase x coordinate and decrease y coordinate by one three ... | Print the only integer d — the minimal number of steps to get the finish position. | Professor GukiZ makes a new robot. The robot are in the point with coordinates (x1, y1) and should go to the point (x2, y2). In a single step the robot can change any of its coordinates (maybe both of them) by one (decrease or increase). So the robot can move in one of the 8 directions. Find the minimal number of steps... | [{"input": "0 0\r\n4 5\r\n", "output": ["5"]}, {"input": "3 4\r\n6 1\r\n", "output": ["3"]}, {"input": "0 0\r\n4 6\r\n", "output": ["6"]}, {"input": "1 1\r\n-3 -5\r\n", "output": ["6"]}, {"input": "-1 -1\r\n-10 100\r\n", "output": ["101"]}, {"input": "1 -1\r\n100 -100\r\n", "output": ["99"]}, {"input": "-1000000000 -10... | 100 | 100 | 100 | [{'input': '1 1\r\n-3 -5\r\n', 'output': ['6']}, {'input': '0 0\r\n0 1\r\n', 'output': ['1']}, {'input': '0 0\r\n3 1\r\n', 'output': ['3']}, {'input': '0 0\r\n1 0\r\n', 'output': ['1']}, {'input': '-9 0\r\n9 9\r\n', 'output': ['18']}] | [{'input': '-637204864 -280290367\r\n-119020929 153679771\r\n', 'output': ['518183935']}, {'input': '0 0\r\n-1 1\r\n', 'output': ['1']}, {'input': '283722202 -902633305\r\n-831696497 -160868946\r\n', 'output': ['1115418699']}, {'input': '0 0\r\n4 0\r\n', 'output': ['4']}, {'input': '207558188 -313753260\r\n-211535387 -... | [{'input': '0 0\r\n4 6\r\n', 'output': ['6']}, {'input': '-1 0\r\n0 0\r\n', 'output': ['1']}, {'input': '0 0\r\n0 -1\r\n', 'output': ['1']}, {'input': '0 0\r\n5 4\r\n', 'output': ['5']}, {'input': '5 6\r\n5 7\r\n', 'output': ['1']}] | [{'input': '1 5\r\n6 4\r\n', 'output': ['5']}, {'input': '-44602634 913365223\r\n-572368780 933284951\r\n', 'output': ['527766146']}, {'input': '958048496 712083589\r\n423286949 810566863\r\n', 'output': ['534761547']}, {'input': '50383856 -596516251\r\n-802950224 -557916272\r\n', 'output': ['853334080']}, {'input': '-... | [{'input': '0 0\r\n-1 -1\r\n', 'output': ['1']}, {'input': '5 6\r\n5 7\r\n', 'output': ['1']}, {'input': '-80625246 708958515\r\n468950878 574646184\r\n', 'output': ['549576124']}, {'input': '-100000000 -100000000\r\n100000000 100000123\r\n', 'output': ['200000123']}, {'input': '-637204864 -280290367\r\n-119020929 1536... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 189 | 100 | 100 | 100 |
["4 6 2", "3 10 3", "3 6 1"] | The only line contain three integers n, m and k (1 ≤ n ≤ m ≤ 109, 1 ≤ k ≤ n) — the number of hobbits, the number of pillows and the number of Frodo's bed. | da9ddd00f46021e8ee9db4a8deed017c | #include<bits/stdc++.h>
using namespace std;
long n,m,k,c=1,s=1;
int main(){
cin>>n>>m>>k;
m-=n;
while(m>0){
if(k-c>=1)s++;
if(k+c<=n)s++;
m-=s;
c++;
}
cout<<c;
return 0;
} | ["2", "4", "3"] | C++ | NoteIn the first example Frodo can have at most two pillows. In this case, he can give two pillows to the hobbit on the first bed, and one pillow to each of the hobbits on the third and the fourth beds.In the second example Frodo can take at most four pillows, giving three pillows to each of the others.In the third exa... | Print single integer — the maximum number of pillows Frodo can have so that no one is hurt. | n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's not always possible to share pillows equally, but any hobbit gets hurt if h... | [{"input": "4 6 2\r\n", "output": ["2"]}, {"input": "3 10 3\r\n", "output": ["4"]}, {"input": "3 6 1\r\n", "output": ["3"]}, {"input": "3 3 3\r\n", "output": ["1"]}, {"input": "1 1 1\r\n", "output": ["1"]}, {"input": "1 1000000000 1\r\n", "output": ["1000000000"]}, {"input": "100 1000000000 20\r\n", "output": ["1000003... | 100 | 100 | 100 | [{'input': '100000000 106296029 98572386\r\n', 'output': ['2510']}, {'input': '40000 40771 22564\r\n', 'output': ['28']}, {'input': '100 999981057 92\r\n', 'output': ['9999852']}, {'input': '1000000000 1000000000 500000000\r\n', 'output': ['1']}, {'input': '1000000000 1000000000 912549504\r\n', 'output': ['1']}] | [{'input': '1000000000 1000000000 481982093\r\n', 'output': ['1']}, {'input': '200 5701 172\r\n', 'output': ['84']}, {'input': '100000000 999834114 93836827\r\n', 'output': ['29998']}, {'input': '3 1000000000 2\r\n', 'output': ['333333334']}, {'input': '2 1000000000 2\r\n', 'output': ['500000000']}] | [{'input': '1000000 194818222 998601\r\n', 'output': ['18389']}, {'input': '40000 999997662 8976\r\n', 'output': ['38038']}, {'input': '3 1000000000 2\r\n', 'output': ['333333334']}, {'input': '100000000 993180275 362942\r\n', 'output': ['29887']}, {'input': '30000 36932 29126\r\n', 'output': ['84']}] | [{'input': '100000000 200020000 54345\r\n', 'output': ['10001']}, {'input': '1 999999999 1\r\n', 'output': ['999999999']}, {'input': '100000000 200020001 54345\r\n', 'output': ['10002']}, {'input': '1000000 194818222 998601\r\n', 'output': ['18389']}, {'input': '1000234 97653890 1\r\n', 'output': ['13904']}] | [{'input': '10000000 10748901 8882081\r\n', 'output': ['866']}, {'input': '30000 999999384 5488\r\n', 'output': ['43849']}, {'input': '100000 149408 74707\r\n', 'output': ['223']}, {'input': '1000 1000 994\r\n', 'output': ['1']}, {'input': '50003 999999649 405\r\n', 'output': ['44320']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 190 | 100 | 100 | 100 |
["05:50\n05:44", "00:00\n01:00", "00:01\n00:00"] | The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" — the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59. | 595c4a628c261104c8eedad767e85775 | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
string s,s1;
int main() {
while(cin>>s) {
int k1,k2;
int a,b,c,d;
cin>>s1;
a=s[0]-'0';
b=s[1]-'0';
c=s[3]-'0';
d=s[4]-'0';
int aa,bb,cc,dd;
aa=s1... | ["00:06", "23:00", "00:01"] | C++ | NoteIn the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect. In the second sample, George went to bed yesterday.In the third sample, George didn't do to bed at all. | In the single line print time p — the time George went to bed in the format similar to the format of the time in the input. | George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t. Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second t... | [{"input": "05:50\r\n05:44\r\n", "output": ["00:06"]}, {"input": "00:00\r\n01:00\r\n", "output": ["23:00"]}, {"input": "00:01\r\n00:00\r\n", "output": ["00:01"]}, {"input": "23:59\r\n23:59\r\n", "output": ["00:00"]}, {"input": "23:44\r\n23:55\r\n", "output": ["23:49"]}, {"input": "00:00\r\n13:12\r\n", "output": ["10:48... | 100 | 100 | 100 | [{'input': '13:04\r\n09:58\r\n', 'output': ['03:06']}, {'input': '05:44\r\n06:00\r\n', 'output': ['23:44']}, {'input': '05:50\r\n05:44\r\n', 'output': ['00:06']}, {'input': '21:30\r\n02:00\r\n', 'output': ['19:30']}, {'input': '23:59\r\n23:59\r\n', 'output': ['00:00']}] | [{'input': '19:30\r\n09:30\r\n', 'output': ['10:00']}, {'input': '05:50\r\n05:44\r\n', 'output': ['00:06']}, {'input': '09:10\r\n00:01\r\n', 'output': ['09:09']}, {'input': '05:44\r\n06:00\r\n', 'output': ['23:44']}, {'input': '21:30\r\n02:00\r\n', 'output': ['19:30']}] | [{'input': '03:23\r\n08:52\r\n', 'output': ['18:31']}, {'input': '19:30\r\n02:00\r\n', 'output': ['17:30']}, {'input': '21:00\r\n01:00\r\n', 'output': ['20:00']}, {'input': '21:30\r\n02:00\r\n', 'output': ['19:30']}, {'input': '12:33\r\n23:33\r\n', 'output': ['13:00']}] | [{'input': '22:22\r\n22:23\r\n', 'output': ['23:59']}, {'input': '12:21\r\n21:12\r\n', 'output': ['15:09']}, {'input': '10:10\r\n01:01\r\n', 'output': ['09:09']}, {'input': '07:55\r\n05:53\r\n', 'output': ['02:02']}, {'input': '19:30\r\n02:00\r\n', 'output': ['17:30']}] | [{'input': '23:44\r\n23:55\r\n', 'output': ['23:49']}, {'input': '00:00\r\n13:12\r\n', 'output': ['10:48']}, {'input': '22:22\r\n22:22\r\n', 'output': ['00:00']}, {'input': '23:59\r\n23:59\r\n', 'output': ['00:00']}, {'input': '12:00\r\n23:59\r\n', 'output': ['12:01']}] | 100 | 100 | 100 | 100 | 100 | 81.4 | 83.72 | 76.74 | 83.72 | 76.74 | 62.5 | 68.75 | 62.5 | 68.75 | 56.25 | 191 | 100 | 80.464 | 63.75 |
["10", "123"] | The first line contains a single integer n (1 ≤ n ≤ 109) — Polycarpus's number. | 0f7f10557602c8c2f2eb80762709ffc4 | #include <iostream>
#include <unordered_set>
using namespace std;
unordered_set <long long int> S;
long long int n, x, y;
void foo(long long int v){
if(v<=0 || v>n) return;
v*=10;
S.insert(v);
foo(v+x);
foo(v+y);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
... | ["10", "113"] | C++ | NoteIn the first test sample all numbers that do not exceed 10 are undoubtedly lucky.In the second sample numbers 102, 103, 104, 105, 106, 107, 108, 109, 120, 123 are not undoubtedly lucky. | Print a single integer that says, how many positive integers that do not exceed n are undoubtedly lucky. | Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 are lucky.Let's call a positive integer a undoubtedly lucky, if there are such ... | [{"input": "10\r\n", "output": ["10"]}, {"input": "123\r\n", "output": ["113"]}, {"input": "1\r\n", "output": ["1"]}, {"input": "2\r\n", "output": ["2"]}, {"input": "1000\r\n", "output": ["352"]}, {"input": "1000000000\r\n", "output": ["40744"]}, {"input": "999999999\r\n", "output": ["40743"]}, {"input": "999999998\r\n... | 100 | 100 | 100 | [{'input': '142498040\r\n', 'output': ['21671']}, {'input': '603356456\r\n', 'output': ['31623']}, {'input': '909090901\r\n', 'output': ['38532']}, {'input': '10\r\n', 'output': ['10']}, {'input': '999999997\r\n', 'output': ['40741']}] | [{'input': '4\r\n', 'output': ['4']}, {'input': '102\r\n', 'output': ['101']}, {'input': '1\r\n', 'output': ['1']}, {'input': '142498040\r\n', 'output': ['21671']}, {'input': '999999997\r\n', 'output': ['40741']}] | [{'input': '820040584\r\n', 'output': ['36407']}, {'input': '142498040\r\n', 'output': ['21671']}, {'input': '72\r\n', 'output': ['72']}, {'input': '642678\r\n', 'output': ['3615']}, {'input': '1000\r\n', 'output': ['352']}] | [{'input': '102\r\n', 'output': ['101']}, {'input': '468390\r\n', 'output': ['3223']}, {'input': '5\r\n', 'output': ['5']}, {'input': '603356456\r\n', 'output': ['31623']}, {'input': '1\r\n', 'output': ['1']}] | [{'input': '10\r\n', 'output': ['10']}, {'input': '102\r\n', 'output': ['101']}, {'input': '784262\r\n', 'output': ['4079']}, {'input': '5\r\n', 'output': ['5']}, {'input': '1000\r\n', 'output': ['352']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 192 | 100 | 100 | 100 |
["e4"] | The only line contains the king's position in the format "cd", where 'c' is the column from 'a' to 'h' and 'd' is the row from '1' to '8'. | 6994331ca6282669cbb7138eb7e55e01 | #include<bits/stdc++.h>
using namespace std;
char a,b;
bool chess[10][10];
int x,y,ans = 8;
int main() {
cin>>a>>b;
x=a-'a';
y=b-'0';
x++;
for(int i=0; i<=9; i++) {
for(int j=0; j<=9; j++) {
if(i==0||i==9) {
chess[i][j] = 1;
continue;
} else {
if(j==0||j==9)chess[i][j]=1;
}
}
}
if(chess... | ["8"] | C++ | null | Print the only integer x — the number of moves permitted for the king. | The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king.Check the king's moves here https://en.wikipedia.org/wiki/King_(chess). King moves from the position e4 | [{"input": "e4\r\n", "output": ["8"]}, {"input": "a1\r\n", "output": ["3"]}, {"input": "h8\r\n", "output": ["3"]}, {"input": "a4\r\n", "output": ["5"]}, {"input": "g7\r\n", "output": ["8"]}, {"input": "e1\r\n", "output": ["5"]}, {"input": "b2\r\n", "output": ["8"]}, {"input": "c7\r\n", "output": ["8"]}, {"input": "h6\r... | 100 | 100 | 100 | [{'input': 'g8\r\n', 'output': ['5']}, {'input': 'e8\r\n', 'output': ['5']}, {'input': 'c7\r\n', 'output': ['8']}, {'input': 'e1\r\n', 'output': ['5']}, {'input': 'f8\r\n', 'output': ['5']}] | [{'input': 'h4\r\n', 'output': ['5']}, {'input': 'b2\r\n', 'output': ['8']}, {'input': 'a8\r\n', 'output': ['3']}, {'input': 'b8\r\n', 'output': ['5']}, {'input': 'e8\r\n', 'output': ['5']}] | [{'input': 'c7\r\n', 'output': ['8']}, {'input': 'h4\r\n', 'output': ['5']}, {'input': 'f2\r\n', 'output': ['8']}, {'input': 'a4\r\n', 'output': ['5']}, {'input': 'h8\r\n', 'output': ['3']}] | [{'input': 'c7\r\n', 'output': ['8']}, {'input': 'h4\r\n', 'output': ['5']}, {'input': 'h2\r\n', 'output': ['5']}, {'input': 'b1\r\n', 'output': ['5']}, {'input': 'h5\r\n', 'output': ['5']}] | [{'input': 'h8\r\n', 'output': ['3']}, {'input': 'f8\r\n', 'output': ['5']}, {'input': 'g7\r\n', 'output': ['8']}, {'input': 'a8\r\n', 'output': ['3']}, {'input': 'h2\r\n', 'output': ['5']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 92.86 | 96.43 | 96.43 | 89.29 | 96.43 | 193 | 100 | 100 | 94.288 |
["2 2\n5 8", "1 2\n7 1", "1 2\n4 4", "1 4\n2 2 1 2"] | The first line contains two integers n and k (1 ≤ n ≤ 10000, 1 ≤ k ≤ 100) — the number of rows and the number of groups of soldiers, respectively. The second line contains k integers a1, a2, a3, ..., ak (1 ≤ ai ≤ 10000), where ai denotes the number of soldiers in the i-th group. It is guaranteed that a1 + a2 + ... + ak... | d1f88a97714d6c13309c88fcf7d86821 | //zhr
#include<bits/stdc++.h>
using namespace std;
int n,k;
int x[16384],rest;
int a,b,c;
int main(){
cin>>n>>k;
a=n;
b=2*n;
int N;
for(int i=1;i<=k;++i){
cin>>x[i];
}
for(int i=1;i<=k;++i){
rest+=x[i]%2;
x[i]=x[i]/2;
}
for(int i=1;i<=k;++i){
if(!a) break;
N=min(a,x[i]/2);
a-=N;
x[i]-=N*2;
}
... | ["YES", "NO", "YES", "YES"] | C++ | NoteIn the first sample, Daenerys can place the soldiers like in the figure below: In the second sample, there is no way to place the soldiers in the plane since the second group soldier will always have a seat neighboring to someone from the first group.In the third example Daenerys can place the first group on seats... | If we can place the soldiers in the airplane print "YES" (without quotes). Otherwise print "NO" (without quotes). You can choose the case (lower or upper) for each letter arbitrary. | Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army through the sea. The airplane has n rows, each of them has 8 seats. We call two s... | [{"input": "2 2\r\n5 8\r\n", "output": ["YES"]}, {"input": "1 2\r\n7 1\r\n", "output": ["NO"]}, {"input": "1 2\r\n4 4\r\n", "output": ["YES"]}, {"input": "1 4\r\n2 2 1 2\r\n", "output": ["YES"]}, {"input": "10000 100\r\n749 2244 949 2439 2703 44 2394 124 285 3694 3609 717 1413 155 974 1778 1448 1327 1487 3458 319 1395 ... | 100 | 100 | 100 | [{'input': '1 2\r\n7 1\r\n', 'output': ['NO']}, {'input': '1 3\r\n3 2 2\r\n', 'output': ['YES']}, {'input': '10000 91\r\n2351 1402 1137 2629 4718 1138 1839 1339 2184 2387 165 370 918 1476 2717 879 1152 5367 3940 608 941 766 1256 656 2768 916 4176 489 1989 1633 2725 2329 2795 1970 667 340 1275 120 870 488 225 59 64 255 ... | [{'input': '3403 59\r\n1269 1612 453 795 1216 941 19 44 1796 324 2019 1397 651 382 841 2003 3013 638 1007 1001 351 95 394 149 125 13 116 183 20 78 208 19 152 10 151 177 16 23 17 22 8 1 3 2 6 1 5 3 13 1 8 4 3 4 4 4 2 2 3378\r\n', 'output': ['YES']}, {'input': '3 12\r\n2 1 2 2 2 1 2 2 2 1 2 2\r\n', 'output': ['YES']}, {'... | [{'input': '5691 91\r\n6573 1666 2158 2591 4636 886 263 4217 389 29 1513 1172 617 2012 1855 798 1588 979 152 37 890 375 1091 839 385 382 1 255 117 289 119 224 182 69 19 71 115 13 4 22 35 2 60 12 6 12 19 9 3 2 2 6 5 1 7 7 3 1 5 1 7 1 4 1 1 3 2 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5631\r\n', 'output': ['NO']}, {... | [{'input': '1 1\r\n2\r\n', 'output': ['YES']}, {'input': '1 2\r\n4 4\r\n', 'output': ['YES']}, {'input': '2 6\r\n4 1 3 1 1 3\r\n', 'output': ['NO']}, {'input': '5 15\r\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\r\n', 'output': ['YES']}, {'input': '1 2\r\n6 2\r\n', 'output': ['YES']}] | [{'input': '2 6\r\n5 2 2 2 2 2\r\n', 'output': ['YES']}, {'input': '3 8\r\n8 2 2 2 2 2 2 2\r\n', 'output': ['YES']}, {'input': '3 12\r\n2 1 2 2 2 1 2 2 2 1 2 2\r\n', 'output': ['YES']}, {'input': '1 4\r\n1 1 2 2\r\n', 'output': ['YES']}, {'input': '2 2\r\n5 8\r\n', 'output': ['YES']}] | 100 | 100 | 100 | 100 | 100 | 95.92 | 95.92 | 95.92 | 95.92 | 91.84 | 85.71 | 85.71 | 89.29 | 89.29 | 78.57 | 194 | 100 | 95.104 | 85.714 |
["tour", "Codeforces", "aBAcAba"] | The first line represents input string of Petya's program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive. | db9520e85b3e9186dd3a09ff8d1e8c1b | #include<cstdio>
#include<cstring>
char str[101];
int main()
{
scanf("%s", str);
int len = strlen(str);
for (int i = 0; i < len; ++i)
{
if (str[i] < 'a')
str[i] += 32;
if (str[i] != 'a' && str[i] != 'e' && str[i] != 'i' && str[i] != 'o' && str[i] !... | [".t.r", ".c.d.f.r.c.s", ".b.c.b"] | C++ | null | Print the resulting string. It is guaranteed that this string is not empty. | Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it: deletes all the vowels, inserts a character "." before each consonant, replaces all upp... | [{"input": "tour\r\n", "output": [".t.r"]}, {"input": "Codeforces\r\n", "output": [".c.d.f.r.c.s"]}, {"input": "aBAcAba\r\n", "output": [".b.c.b"]}, {"input": "obn\r\n", "output": [".b.n"]}, {"input": "wpwl\r\n", "output": [".w.p.w.l"]}, {"input": "ggdvq\r\n", "output": [".g.g.d.v.q"]}, {"input": "pumesz\r\n", "output"... | 100 | 100 | 100 | [{'input': 'Ab\r\n', 'output': ['.b']}, {'input': 'YB\r\n', 'output': ['.b']}, {'input': 'jvvzcdcxjstbbksmqjsngxkgtttdxrljjxtwptgwwqzpvqchvgrkqlzxmptzblxhhsmrkmzzmgdfskhtmmnqzzflpmqdctvrfgtx\r\n', 'output': ['.j.v.v.z.c.d.c.x.j.s.t.b.b.k.s.m.q.j.s.n.g.x.k.g.t.t.t.d.x.r.l.j.j.x.t.w.p.t.g.w.w.q.z.p.v.q.c.h.v.g.r.k.q.l.z.... | [{'input': 'pumesz\r\n', 'output': ['.p.m.s.z']}, {'input': 'iioyoaayeuyoolyiyoeuouiayiiuyTueyiaoiueyioiouyuauouayyiaeoeiiigmioiououeieeeyuyyaYyioiiooaiuouyoeoeg\r\n', 'output': ['.l.t.g.m.g']}, {'input': 'jfmtbejyilxcec\r\n', 'output': ['.j.f.m.t.b.j.l.x.c.c']}, {'input': 'SDTFZPLMKFLZGTRPLMQVHTMCDFWPKZNZMHQDSWZKBZFFW... | [{'input': 'bA\r\n', 'output': ['.b']}, {'input': 'D\r\n', 'output': ['.d']}, {'input': 'YB\r\n', 'output': ['.b']}, {'input': 'ktajqhpqsvhw\r\n', 'output': ['.k.t.j.q.h.p.q.s.v.h.w']}, {'input': 'QKFSVTNJRDJGLWTHXHWRNVFHFSCSGWTCNBVBXVWDBMZPLGWFKXNLJMGTGFHQJTZZRBVSZDTHZWJSFWRNZV\r\n', 'output': ['.q.k.f.s.v.t.n.j.r.d.j... | [{'input': 'MFZHRXPFZCQWHKGJLBDNGWWNGSQJNSCGPSPJSLDXZZGPPVKBZGNSKGLJHCKVFNJGNHPPLFBZMPHFSRXMPHBN\r\n', 'output': ['.m.f.z.h.r.x.p.f.z.c.q.w.h.k.g.j.l.b.d.n.g.w.w.n.g.s.q.j.n.s.c.g.p.s.p.j.s.l.d.x.z.z.g.p.p.v.k.b.z.g.n.s.k.g.l.j.h.c.k.v.f.n.j.g.n.h.p.p.l.f.b.z.m.p.h.f.s.r.x.m.p.h.b.n']}, {'input': 'obn\r\n', 'output': [... | [{'input': 'obn\r\n', 'output': ['.b.n']}, {'input': 'Codeforces\r\n', 'output': ['.c.d.f.r.c.s']}, {'input': 'Ab\r\n', 'output': ['.b']}, {'input': 'SDTFZPLMKFLZGTRPLMQVHTMCDFWPKZNZMHQDSWZKBZFFWZVJKGNDHRBGTVGKNCQRVFCXPSNBVVBGQNVN\r\n', 'output': ['.s.d.t.f.z.p.l.m.k.f.l.z.g.t.r.p.l.m.q.v.h.t.m.c.d.f.w.p.k.z.n.z.m.h.q.... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 75 | 100 | 75 | 75 | 81.25 | 195 | 100 | 100 | 81.25 |
["4\n6 5\n16 13\n61690850361 24777622630\n34 33"] | The first line contains a number $$$t$$$ ($$$1 \leq t \leq 5$$$) — the number of test cases. Each of the next $$$t$$$ lines describes the $$$i$$$-th test case. It contains two integers $$$a$$$ and $$$b~(1 \leq b < a \leq 10^{11})$$$ — the side length of Alice's square and the side length of the square that Bob wants... | 5a052e4e6c64333d94c83df890b1183c | #include<bits/stdc++.h>
using namespace std;
int T;
long long a,b;
/*long long cf(long long x,long long n,long long p)
{
if(!n) return 1;
long long ans=cf(x,n/2,p);
ans=(ans%p)*(ans%p);
if(n%2) ans=((ans%p)*(x%p))%p;
return ans%p;
}
bool miller_rabin(long long n)
{
long long i,j,aa,x,y,t,u,s=10;... | ["YES\nNO\nNO\nYES"] | C++ | NoteThe figure below depicts the first test case. The blue part corresponds to the piece which belongs to Bob, and the red part is the piece that Alice keeps for herself. The area of the red part is $$$6^2 - 5^2 = 36 - 25 = 11$$$, which is prime, so the answer is "YES". In the second case, the area is $$$16^2 - 13^2 =... | Print $$$t$$$ lines, where the $$$i$$$-th line is the answer to the $$$i$$$-th test case. Print "YES" (without quotes) if the area of the remaining piece of cloth is prime, otherwise print "NO". You can print each letter in an arbitrary case (upper or lower). | Alice has a lovely piece of cloth. It has the shape of a square with a side of length $$$a$$$ centimeters. Bob also wants such piece of cloth. He would prefer a square with a side of length $$$b$$$ centimeters (where $$$b < a$$$). Alice wanted to make Bob happy, so she cut the needed square out of the corner of her ... | [{"input": "4\r\n6 5\r\n16 13\r\n61690850361 24777622630\r\n34 33\r\n", "output": ["yes\r\nno\r\nno\r\nyes", "YES\r\nNO\r\nNO\r\nYES"]}, {"input": "5\r\n160 159\r\n223 222\r\n480 479\r\n357 356\r\n345 344\r\n", "output": ["NO\r\nNO\r\nNO\r\nNO\r\nNO", "no\r\nno\r\nno\r\nno\r\nno"]}, {"input": "5\r\n631 582\r\n201 106\r... | 100 | 100 | 100 | [{'input': '5\r\n62903604396 24274903133\r\n37198 37197\r\n16929 16928\r\n38325 38324\r\n49905 33035\r\n', 'output': ['no\r\nno\r\nyes\r\nyes\r\nno', 'NO\r\nNO\r\nYES\r\nYES\r\nNO']}, {'input': '5\r\n81271189833 16089352976\r\n98451628984 76827432884\r\n19327420986 19327420985\r\n15702367716 15702367715\r\n49419997643 ... | [{'input': '1\r\n84777676971 84777676970\r\n', 'output': ['NO', 'no']}, {'input': '5\r\n5242157731 5242157730\r\n12345 45\r\n5011907031 5011907030\r\n20207223564 20207223563\r\n61 60\r\n', 'output': ['NO\r\nNO\r\nNO\r\nNO\r\nNO', 'no\r\nno\r\nno\r\nno\r\nno']}, {'input': '5\r\n160 159\r\n223 222\r\n480 479\r\n357 356\r... | [{'input': '1\r\n7 6\r\n', 'output': ['YES', 'yes']}, {'input': '1\r\n500000041 500000040\r\n', 'output': ['NO', 'no']}, {'input': '5\r\n631 582\r\n201 106\r\n780 735\r\n608 528\r\n470 452\r\n', 'output': ['NO\r\nNO\r\nNO\r\nNO\r\nNO', 'no\r\nno\r\nno\r\nno\r\nno']}, {'input': '5\r\n2187 2186\r\n517 516\r\n3235 3234\r\... | [{'input': '1\r\n5928189385 5928189384\r\n', 'output': ['NO', 'no']}, {'input': '1\r\n160489044 125525827\r\n', 'output': ['NO', 'no']}, {'input': '4\r\n6 5\r\n16 13\r\n61690850361 24777622630\r\n34 33\r\n', 'output': ['yes\r\nno\r\nno\r\nyes', 'YES\r\nNO\r\nNO\r\nYES']}, {'input': '5\r\n497334 497333\r\n437006 437005\... | [{'input': '5\r\n5242157731 5242157730\r\n12345 45\r\n5011907031 5011907030\r\n20207223564 20207223563\r\n61 60\r\n', 'output': ['NO\r\nNO\r\nNO\r\nNO\r\nNO', 'no\r\nno\r\nno\r\nno\r\nno']}, {'input': '5\r\n24095027715 9551467282\r\n34945375 34945374\r\n16603803 16603802\r\n58997777 26551505\r\n39762660 39762659\r\n', ... | 100 | 100 | 100 | 100 | 100 | 100 | 92.31 | 100 | 100 | 100 | 100 | 80 | 100 | 100 | 100 | 196 | 100 | 98.462 | 96 |
["0 0 0\n0 1 0", "1 1 0\n0 1 0", "0 0 0\n1 1 1"] | The first line contains three space-separated integers (0 or 1) — the coordinates of the first fly, the second line analogously contains the coordinates of the second fly. | 91c9dbbceb467d5fd420e92c2919ecb6 | #include<iostream>
using namespace std;
int a[10][10],f;
int main()
{
for(int i=1;i<=2;i++)
for(int j=1;j<=3;j++)
cin>>a[i][j];
for(int i=1;i<=3;i++)
if(a[1][i]==a[2][i]){f=1;break;}
cout<<(f?"YES\n":"NO\n");
return 0;
} | ["YES", "YES", "NO"] | C++ | null | Output "YES" (without quotes) if the flies see each other. Otherwise, output "NO". | You can find anything whatsoever in our Galaxy! A cubical planet goes round an icosahedral star. Let us introduce a system of axes so that the edges of the cubical planet are parallel to the coordinate axes and two opposite vertices lay in the points (0, 0, 0) and (1, 1, 1). Two flies live on the planet. At the moment ... | [{"input": "0 0 0\r\n0 1 0\r\n", "output": ["YES"]}, {"input": "1 1 0\r\n0 1 0\r\n", "output": ["YES"]}, {"input": "0 0 0\r\n1 1 1\r\n", "output": ["No", "NO"]}, {"input": "0 0 0\r\n1 0 0\r\n", "output": ["YES"]}, {"input": "0 0 0\r\n0 1 0\r\n", "output": ["YES"]}, {"input": "0 0 0\r\n1 1 0\r\n", "output": ["YES"]}, {"... | 100 | 100 | 100 | [{'input': '1 1 1\r\n0 1 0\r\n', 'output': ['YES']}, {'input': '0 1 1\r\n1 0 0\r\n', 'output': ['No', 'NO']}, {'input': '0 1 1\r\n0 0 1\r\n', 'output': ['YES']}, {'input': '1 1 0\r\n1 0 0\r\n', 'output': ['YES']}, {'input': '1 1 1\r\n0 0 0\r\n', 'output': ['No', 'NO']}] | [{'input': '1 1 1\r\n0 1 0\r\n', 'output': ['YES']}, {'input': '0 1 1\r\n1 1 0\r\n', 'output': ['YES']}, {'input': '0 1 0\r\n0 0 1\r\n', 'output': ['YES']}, {'input': '0 0 0\r\n1 0 0\r\n', 'output': ['YES']}, {'input': '0 1 0\r\n1 1 0\r\n', 'output': ['YES']}] | [{'input': '1 0 0\r\n0 1 0\r\n', 'output': ['YES']}, {'input': '1 0 1\r\n1 1 0\r\n', 'output': ['YES']}, {'input': '0 1 0\r\n1 1 0\r\n', 'output': ['YES']}, {'input': '1 1 1\r\n1 0 1\r\n', 'output': ['YES']}, {'input': '1 0 0\r\n0 1 1\r\n', 'output': ['No', 'NO']}] | [{'input': '1 0 1\r\n0 0 0\r\n', 'output': ['YES']}, {'input': '0 0 0\r\n0 1 1\r\n', 'output': ['YES']}, {'input': '0 0 0\r\n1 0 1\r\n', 'output': ['YES']}, {'input': '0 1 1\r\n1 0 0\r\n', 'output': ['No', 'NO']}, {'input': '1 0 0\r\n1 1 1\r\n', 'output': ['YES']}] | [{'input': '1 0 1\r\n1 0 0\r\n', 'output': ['YES']}, {'input': '1 1 1\r\n1 1 0\r\n', 'output': ['YES']}, {'input': '0 1 0\r\n0 0 0\r\n', 'output': ['YES']}, {'input': '0 0 1\r\n0 1 0\r\n', 'output': ['YES']}, {'input': '0 0 1\r\n1 1 0\r\n', 'output': ['No', 'NO']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 80 | 100 | 100 | 100 | 197 | 100 | 100 | 96 |
["1 1 6 1\n1 0 6 0\n6 0 6 1\n1 1 1 0", "0 0 0 3\n2 0 0 0\n2 2 2 0\n0 2 2 2"] | The input data contain four lines. Each of these lines contains four integers x1, y1, x2, y2 ( - 109 ≤ x1, y1, x2, y2 ≤ 109) — coordinates of segment's beginning and end positions. The given segments can degenerate into points. | ad105c08f63e9761fe90f69630628027 | #include <bits/stdc++.h>
using namespace std;
int n, sx[10], id[10], sy[10], fx[10], fy[10], SX[10], SY[10], FX[10], FY[10];
int main() {
for (int i = 1; i <= 4; i ++) {
scanf("%d %d %d %d", &SX[i], &SY[i], &FX[i], &FY[i]);
id[i] = i;
}
bool flag = 0;
do {
for (int i = 1; i <= 4; i +... | ["YES", "NO"] | C++ | null | Output the word «YES», if the given four segments form the required rectangle, otherwise output «NO». | Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr... | [{"input": "1 1 6 1\r\n1 0 6 0\r\n6 0 6 1\r\n1 1 1 0\r\n", "output": ["YES"]}, {"input": "0 0 0 3\r\n2 0 0 0\r\n2 2 2 0\r\n0 2 2 2\r\n", "output": ["NO"]}, {"input": "0 0 0 2\r\n2 0 0 0\r\n2 2 2 0\r\n0 2 2 2\r\n", "output": ["YES"]}, {"input": "0 0 10 0\r\n0 0 10 0\r\n0 0 0 5\r\n0 0 0 -5\r\n", "output": ["NO"]}, {"inpu... | 100 | 100 | 100 | [{'input': '-3 0 -3 3\r\n0 0 0 3\r\n3 3 -3 3\r\n3 0 -3 0\r\n', 'output': ['NO']}, {'input': '0 -3 0 -1\r\n1 -1 1 -1\r\n0 -1 1 -2\r\n0 -2 -2 -3\r\n', 'output': ['NO']}, {'input': '0 0 0 2\r\n2 0 0 0\r\n2 2 2 0\r\n0 2 2 2\r\n', 'output': ['YES']}, {'input': '0 0 0 0\r\n0 0 0 1\r\n0 0 0 1\r\n0 0 0 0\r\n', 'output': ['NO']... | [{'input': '2 -1 0 -2\r\n-3 -2 -3 3\r\n2 -2 2 -2\r\n0 3 -3 -2\r\n', 'output': ['NO']}, {'input': '-3 2 -2 1\r\n0 2 0 -3\r\n0 -3 -2 1\r\n0 1 -3 -3\r\n', 'output': ['NO']}, {'input': '375089524 -852468724 -952575952 -852468724\r\n-952575952 -852468724 -952575952 -883150295\r\n-952575952 -883150295 375089524 -883150295\r\... | [{'input': '1 2 1 2\r\n-2 2 1 2\r\n1 -2 -2 2\r\n-2 -2 1 -2\r\n', 'output': ['NO']}, {'input': '-969490772 476931470 -969490772 929999730\r\n-426216863 929999730 -969490772 929999730\r\n-426216863 929999730 -426216863 476931470\r\n-969490772 476931470 -426216863 476931470\r\n', 'output': ['YES']}, {'input': '-3 3 2 3\r\... | [{'input': '1 2 1 2\r\n1 -1 1 -1\r\n1 -1 1 -1\r\n1 -1 1 -1\r\n', 'output': ['NO']}, {'input': '1 1 6 1\r\n1 0 6 0\r\n6 0 6 1\r\n1 1 1 0\r\n', 'output': ['YES']}, {'input': '0 0 0 2\r\n2 0 2 2\r\n0 2 0 0\r\n2 2 2 0\r\n', 'output': ['NO']}, {'input': '264411509 -329579381 264411509 -329579381\r\n-726758913 -329579381 264... | [{'input': '747591 5158024 -837871358 5158024\r\n-837871358 -874026904 747591 -874026904\r\n747591 -874026904 747591 5158024\r\n-837871358 -874026904 -837871358 5158024\r\n', 'output': ['YES']}, {'input': '1 0 1 0\r\n1 0 1 0\r\n1 0 0 0\r\n1 0 1 0\r\n', 'output': ['NO']}, {'input': '0 0 0 0\r\n5 5 5 5\r\n5 0 5 5\r\n0 5 ... | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 88.64 | 84.09 | 86.36 | 88.64 | 93.18 | 198 | 100 | 100 | 88.182 |
["3 3\n1", "3 3\n2", "1 1\n1"] | The first line contains integers n and m (1 ≤ n, m ≤ 5000). The second line contains integer x (1 ≤ x ≤ 109). | fa1ef5f9bceeb7266cc597ba8f2161cb | /// B : Coded by Choe Kwang
#include <bits/stdc++.h>
using namespace std;
int n, m, x;
int calc(int x) {
return (max(0, n - 2 * x) * max(0, m - 2 * x) + 1) / 2;
}
int main() {
scanf("%d %d %d", &n, &m, &x);
printf("%d\n", calc(x - 1) - calc(x));
return 0;
}
| ["4", "1", "1"] | C++ | null | Print how many squares will be painted exactly x times. | A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted i - 1 (all such squares are repainted simultaneously). This process continues a... | [{"input": "3 3\r\n1\r\n", "output": ["4"]}, {"input": "3 3\r\n2\r\n", "output": ["1"]}, {"input": "1 1\r\n1\r\n", "output": ["1"]}, {"input": "8 8\r\n8\r\n", "output": ["0"]}, {"input": "9 10\r\n1\r\n", "output": ["17"]}, {"input": "9 9\r\n3\r\n", "output": ["8"]}, {"input": "10 9\r\n4\r\n", "output": ["5"]}, {"input"... | 100 | 100 | 100 | [{'input': '892 3996\r\n288\r\n', 'output': ['3738']}, {'input': '1595 2881\r\n710\r\n', 'output': ['1638']}, {'input': '293 2183\r\n60\r\n', 'output': ['2238']}, {'input': '3122 1850\r\n201\r\n', 'output': ['4170']}, {'input': '4339 2062\r\n462\r\n', 'output': ['4555']}] | [{'input': '188 3759\r\n53\r\n', 'output': ['3737']}, {'input': '9 10\r\n1\r\n', 'output': ['17']}, {'input': '4847 2143\r\n827\r\n', 'output': ['3684']}, {'input': '3250 2992\r\n127\r\n', 'output': ['5736']}, {'input': '1 1\r\n1\r\n', 'output': ['1']}] | [{'input': '3595 448\r\n110\r\n', 'output': ['3605']}, {'input': '2504 973\r\n201\r\n', 'output': ['2675']}, {'input': '3990 1800\r\n171\r\n', 'output': ['5108']}, {'input': '4999 1\r\n7\r\n', 'output': ['0']}, {'input': '9 9\r\n3\r\n', 'output': ['8']}] | [{'input': '1 1\r\n200\r\n', 'output': ['0']}, {'input': '1353 2988\r\n589\r\n', 'output': ['1987']}, {'input': '2793 4840\r\n901\r\n', 'output': ['4031']}, {'input': '2089 955\r\n476\r\n', 'output': ['1142']}, {'input': '3122 1850\r\n201\r\n', 'output': ['4170']}] | [{'input': '10 10\r\n3\r\n', 'output': ['10']}, {'input': '3990 1800\r\n171\r\n', 'output': ['5108']}, {'input': '1 1\r\n200\r\n', 'output': ['0']}, {'input': '3552 3036\r\n199\r\n', 'output': ['5794']}, {'input': '1 4999\r\n1000000\r\n', 'output': ['0']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 199 | 100 | 100 | 100 |
["2 7 1 8 2 8", "20 30 40 50 0 100", "31 41 59 26 17 43"] | First line of the input will contain 6 integers, separated by spaces: p1, p2, p3, p4, a, b (1 ≤ p1, p2, p3, p4 ≤ 1000, 0 ≤ a ≤ b ≤ 31415). It is guaranteed that numbers p1, p2, p3, p4 will be pairwise distinct. | 63b9dc70e6ad83d89a487ffebe007b0a | #include<cstdio>
using namespace std;
int p1,p2,p3,p4,n,m,sum=0;
int main()
{
scanf("%d%d%d%d%d%d",&p1,&p2,&p3,&p4,&n,&m);
for(int i=n;i<=m;i++)
{
if(i%p1!=i) continue;
if(i%p2!=i) continue;
if(i%p3!=i) continue;
if(i%p4!=i) continue;
sum++;
}
printf("%d",sum);
return 0;
} | ["0", "20", "9"] | C++ | null | Output the number of integers in the given range that have the given property. | Little Petya was given this problem for homework:You are given function (here represents the operation of taking the remainder). His task is to count the number of integers x in range [a;b] with property f(x) = x.It is a pity that Petya forgot the order in which the remainders should be taken and wrote down only 4 nu... | [{"input": "2 7 1 8 2 8\r\n", "output": ["0"]}, {"input": "20 30 40 50 0 100\r\n", "output": ["20"]}, {"input": "31 41 59 26 17 43\r\n", "output": ["9"]}, {"input": "1 2 3 4 0 0\r\n", "output": ["1"]}, {"input": "1 2 3 4 1 1\r\n", "output": ["0"]}, {"input": "1 2 999 1000 30 40\r\n", "output": ["0"]}, {"input": "17 18 ... | 100 | 100 | 100 | [{'input': '735 794 942 991 419 490\r\n', 'output': ['72']}, {'input': '291 303 656 660 126 704\r\n', 'output': ['165']}, {'input': '20 30 40 50 0 100\r\n', 'output': ['20']}, {'input': '100 101 102 103 10 20\r\n', 'output': ['11']}, {'input': '17 847 715 732 502 778\r\n', 'output': ['0']}] | [{'input': '1 2 999 1000 30 40\r\n', 'output': ['0']}, {'input': '760 773 638 655 111 196\r\n', 'output': ['86']}, {'input': '956 800 909 916 89 194\r\n', 'output': ['106']}, {'input': '17 847 715 732 778 27529\r\n', 'output': ['0']}, {'input': '1 2 3 4 0 31415\r\n', 'output': ['1']}] | [{'input': '998 834 706 722 277 475\r\n', 'output': ['199']}, {'input': '956 800 909 916 89 194\r\n', 'output': ['106']}, {'input': '1 2 3 4 0 31415\r\n', 'output': ['1']}, {'input': '100 101 102 103 10 20\r\n', 'output': ['11']}, {'input': '642 273 18 885 675 788\r\n', 'output': ['0']}] | [{'input': '2 7 1 8 2 8\r\n', 'output': ['0']}, {'input': '225 862 522 617 630 725\r\n', 'output': ['0']}, {'input': '956 800 909 916 89 194\r\n', 'output': ['106']}, {'input': '442 705 757 527 1869 19912\r\n', 'output': ['0']}, {'input': '998 834 706 722 277 475\r\n', 'output': ['199']}] | [{'input': '997 998 999 1000 0 31415\r\n', 'output': ['997']}, {'input': '41 449 328 474 150 709\r\n', 'output': ['0']}, {'input': '823 431 359 590 153 3902\r\n', 'output': ['206']}, {'input': '1 2 3 4 1 1\r\n', 'output': ['0']}, {'input': '442 705 757 527 868 893\r\n', 'output': ['0']}] | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 70 | 70 | 70 | 70 | 90 | 200 | 100 | 100 | 74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.