prob_desc_description stringlengths 63 3.8k | prob_desc_output_spec stringlengths 17 1.47k β | lang_cluster stringclasses 2
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | lang stringclasses 7
values | prob_desc_output_to stringclasses 3
values | prob_desc_memory_limit stringclasses 19
values | file_name stringclasses 111
values | tags listlengths 0 11 | prob_desc_created_at stringlengths 10 10 | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_notes stringlengths 4 3k β | exec_outcome stringclasses 1
value | difficulty int64 -1 3.5k β | prob_desc_input_from stringclasses 3
values | prob_desc_time_limit stringclasses 27
values | prob_desc_input_spec stringlengths 28 2.42k β | prob_desc_sample_outputs stringlengths 2 796 | source_code stringlengths 42 65.5k | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 0301a5005548ac3b6a1296d3bb23c559 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | // http://codeforces.com/problemset/problem/426/B
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
short n, m; // n -> rows & m -> columns
short minRows;
void cheak( unsigned long long arr[n][2] )
{
short i;
bool flag;
if( minRows % 2 == 1 )
{
return;
}
flag = 1;
for... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | cb2f89a3992248c531c05e4d69b76144 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
#include<stdlib.h>
//int m;
int flag=0;
int main(){
int i,j,n,m;
scanf("%d %d",&n,&m);
int a[n][m];
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%d",&a[i][j]);
}}
while(1){
if(n%2==1){
printf("%d\n",n);
return 0;
}
else{
for(i=0;i<n/2;i++){
for(j=0;j<m;j++){
... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 092a1b3dc5b650d1c959ce09046f22ce | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: alulab14
*
* Created on 13 de mayo de 2017, 12:34 PM
*/
#include <stdio.h>
#include <stdlib.h>
#d... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 3b23d72a249c8820a002faafd6d4a0bc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: alulab14
*
* Created on 13 de mayo de 2017, 12:34 PM
*/
#include <stdio.h>
#include <stdlib.h>
#d... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 9587923349ef406b30bff8baac8c417c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int Mat[100][100];
int M;
int Judge(int N)
{
int i, j, k;
for(i=0, j=N-1; i<(N>>1); ++i, --j)
{
for(k=0; k<M; ++k)
{
if(Mat[i][k] != Mat[j][k])
{
return 0;
}
}
}
return 1;
}
int main()
{
int N, i, j... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 24373a18408e4a532ffe29a751805925 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int n,m;
int main()
{
int i,j,a;
int jz[100][100];
int judege(int [][100]);
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
scanf("%d",&jz[i][j]);
}
for(;;)
{
a = judege(jz);
if(a==0)
break;
}
printf... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 592310728d9538655d1cb0c03b77f2ff | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int main()
{
int m,n,i,a[1000],t,j;
while(scanf("%d%d",&n,&m)!=EOF){
memset(a,0,sizeof(a));
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%d",&t);
if(t==0)
a[i]=a[i]<<1;
else
a[i]=... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 49e1b48c724524e5c9e34fd9574fcc0e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int check(char **a,int n)
{
if(n%2==1)
{
// printf("one\n");
return n;
}
else
{
int i=0,j=n-1;
while(i<j)
{
if(strcmp(&a[i][0],&a[j][0])!=0)
{
//printf("two");
... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | fc5af2e4a9a6540cd78b88a890726fab | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int main()
{
int a,b,c,i,j,k,f=0;
int s[110][110];
scanf("%d %d",&a,&b);
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
scanf("%d",&s[i][j]);
}
}
if(a%2!=0) printf("%d",a);
else {
while(a){
c=a;
a=a/2;
for(i=a,j... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 4140b376238a8ceda5ccfa6d522a9148 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int a[100][100];
int s(int * n,int m){
if(*n%2)return 0;
int l=0,g=*n-1,x;
while(l<g){
for(x=0;x<m;x++)
if(a[l][x]!=a[g][x])return 0;
l++,g--;
}
*n/=2;
return 1;
}
int main(){
int n,m;
scanf("%d%d",&n,&m);
int y,x;
for(y=0;y<n;y++){
for(x=0;x<m;x++)
scanf("%d",&a[y][x]);
}
wh... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | e420fb39cbcf7b0df1915e2b0a2ad3c1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <string.h>
int main()
{
int n,m,i,j,flag,ans;
int a[105][105];
scanf("%d %d",&n,&m);
memset(a,0,sizeof(a));
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
scanf("%d",&a[i][j]);
ans=n;
do
{
if (ans%2==1) break;
ans=ans/2;
flag=1;
... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 47887708bfabcc4444aa9fff53c42d7f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<ctype.h>
#include<string.h>
int main()
{
int n,m;
scanf("%d%d",&n,&m);
int arr[n][m],i,j;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&arr[i][j]);
if(n%2!=0)
printf("%d\n",n);
else{
int rows=n... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | df0133a9845b16cb6c5efe63442e4e3f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int A[101][101];
int main()
{
int n,m,i,j,k,a,p,tem,t;
scanf("%d%d",&n,&m);
for(i=1; i<=n; i++)
for(j=1; j<=m; j++)
scanf("%d",&A[i][j]);
a=n;
if(a==1)
{
printf("%d\n",1);
return 0;
}
for(i=1; i<=n; i++)
{
t=0;
if(a%2!=0)
{
printf("%d\n",a);
break;
}
else
... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | bfaef7110e1c8598b2cb8dfc64eabc9e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int n,m,k,i,t,j,s,arr[1000][1000];
int main(){
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&arr[i][j]);
if(n%2){printf("%d",n); return 0;}
while(1){
t=0;
if(n%2||!n){
printf("%d",n);
return 0;
}
for(i=0;i<n/2;i++)
for(j=0;j<m;j++)
if(arr[i][j]!=ar... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | fcce41342d627540b24dcf4933f38def | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int ar[102][102];
void call(int n,int m)
{
if(n&1)
{ printf("%d",n);
return;
}
int p=0,i,j;
for(i=0;i<n/2;i++)
{
for(j=0;j<m;j++)
{
if(ar[i][j]!=ar[n-i-1][j])
{
p=-1;
break;
}
... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 2cdc6fb55a8a5aa5dab42c6c8e2b15ca | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int matrix[101][101];
int check(int a[],int b[],int length)
{
int i;
for(i=0;i<length;i++)
{
if(a[i]!=b[i])
return 0;
}
return 1;
}
int fun(int start,int length,int columns)
{
int i;
if(length%2)
return 0;
for(i=0;i<length/2;i++)
{
if(!check(matrix[i],matrix[length-1-i],columns))
... | |
Let's assume that we are given a matrix b of size xβΓβy, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2xβΓβy matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem β the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 92c7dedb7f8cda4ddd226916009b26f1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2βΓβ3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1ββ€βn,βmββ€β100). Each of the next n lines contains m integers β the elements of matrix a. The i-th line contains integers ai1,βai2,β...,βaim (0ββ€βaijββ€β1) β the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
int a[110][110];
char c[110][110];
int main()
{
int n,m,i,j,ans,ok;
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
scanf("%d",&a[i][j]);
ok=1;
do
{
if(n%2==1&&n>2) {printf("%d\n",n); return 0;}
... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | bca70dfef64b64459ee1c9479054a196 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | #include <stdio.h>
long long int six[14], three[19];
int main(){
int n, j;
long long int num;
six[0] = 1;
int flag = 0;
for(int i = 0; i < 13; i ++)
six[i + 1] = six[i] * 6;
three[0] = 1;
for(int i = 0; i < 18; i ++)
three[i + 1] = three[i] * 3;
scanf("%d", &n);
for(int i = 0; i < n; i ++){
scanf("%lld... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | a2c6bc923dd2e2c2aa4a20dabc1657bd | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | main() {
int t, n1, n2, n;
scanf("%d", &t);
while(t--) {
n1 = n2 = 0;
scanf("%d", &n);
if(n == 1) printf("0\n");
else {
while(n % 2 == 0) {
n /= 2;
++n1;
}
while(n % 3 == 0) {
n /= 3;
++n2;
}
if(n != 1) printf("-1\n");
else if(n1 > n2) printf("... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | f61f16c685d1e7fc36cec0d4b758d44c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | main() {
int t, n1, n2, n;
scanf("%d", &t);
while(t--) {
n1 = n2 = 0;
scanf("%d", &n);
if(n == 1) printf("0\n");
else {
while(n % 2 == 0) {
n /= 2;
++n1;
}
while(n % 3 == 0) {
n /= 3;
... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | 3a2bcc52f0a2c4b3686c0d4372507748 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
for(t=t;t>0;t--)
{
int n,count=0;
scanf("%d",&n);
for(n=n;n>1;)
{
if(n%6==0)
{
n=n/6;
}
else
{
n=n*2;
if(n%6!=0)
... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | a989c14fe78dd60516d6d9cc19628cfe | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | #include"stdio.h"
#include"conio.h"
int main()
{
int t,c,n;
scanf("%d",&t);
while(t--)
{
c=0;
scanf("%d",&n);
while(n!=1)
{
if(n%6==0)
{
c+=1;
n=n/6;
}
else
{
if(... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | 10ab260613d3ca11ab0135bedffbf007 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | #include<stdio.h>
#include<math.h>
#include<malloc.h>
int main()
{
int rem,cases,k=2,z,count3=0,count2=0,num;
//long double x,n;
int *arr;int i;
scanf("%d",&cases);
arr=(int*)malloc(cases*sizeof(int));
for(i=0;i<cases;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<cases;i++)
{
... | |
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$... | For each test case, print the answer β the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$. | C | 3ae468c425c7b156983414372fd35ab8 | ffdd66d71d213406a4170dbe01e28949 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1593354900 | ["7\n1\n2\n3\n12\n12345\n15116544\n387420489"] | NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$). | ["0\n-1\n2\n-1\n-1\n12\n36"] | #include <stdio.h>
int main(){
int t,n,p,k=0,r=0,c=0;
scanf("%d",&t);
while(t>0)
{
c=0;
r=0;
k=0;
scanf("%d",&n);
if(n==1)
{
printf("%d\n",0);
}
else if (!(n%3==0))
{
printf("%d\n",-1);
}
else... | |
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | C | d9bd63e03bf51ed87ba73cd15e8ce58d | 44cf4602b648698e32ebcdf9687012a9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"binary search",
"math"
] | 1532617500 | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | PASSED | 1,500 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$)Β β number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$)Β β weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | ["10.0000000000", "-1", "85.4800000000"] | #include <stdio.h>
int main ()
{
int n, m, i;
double c = 1.0, x;
scanf ("%d%d", &n, &m);
for (i = 0; i < n * 2; i++)
{
scanf ("%lf", &x);
c *= 1 - 1 / x;
}
printf ("%.10f\n", c > 0 ? m / c - m : -1);
return 0;
}
| |
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | C | d9bd63e03bf51ed87ba73cd15e8ce58d | 25505ad7df84e87b3c917adf8842f031 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"binary search",
"math"
] | 1532617500 | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | PASSED | 1,500 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$)Β β number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$)Β β weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | ["10.0000000000", "-1", "85.4800000000"] | #include <stdio.h>
int main(void) {
// your code goes here
long int n,m;
scanf("%ld %ld",&n,&m);
long int a[n];
long int b[n];
for (int i=0;i<n;i++){
scanf("%ld",&a[i]);
if (a[i]==1){
printf("-1");
return 0;
}
}
for (int i=0;i<n;i++){
scanf("%ld",&b[i]);
... | |
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | C | d9bd63e03bf51ed87ba73cd15e8ce58d | 76745621016d898b658973bd47d1bd26 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"binary search",
"math"
] | 1532617500 | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | PASSED | 1,500 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$)Β β number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$)Β β weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | ["10.0000000000", "-1", "85.4800000000"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
double f,dumbv=1;
int nump,i,rocw8;
scanf("%d ",&nump);
scanf("%d ",&rocw8);
int tol[2*nump];
for(i=0;i<2*nump;i++)
{
scanf("%d",&tol[i]);
}
for(i=0;i<2*nump;i++)
{
dumbv=dumbv*(tol[i]-1)/tol[i];
}
if... | |
Someone gave Alyona an array containing n positive integers a1,βa2,β...,βan. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than the current one. Alyona can repeat this operation as many times as she wants. In particular, she may not ... | Print one positive integerΒ β the maximum possible value of mex of the array after Alyona applies some (possibly none) operations. | C | 482b3ebbbadd583301f047181c988114 | efb52cb5762f79c4ee5ee1e148075178 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings"
] | 1466181300 | ["5\n1 3 3 3 6", "2\n2 1"] | NoteIn the first sample case if one will decrease the second element value to 2 and the fifth element value to 4 then the mex value of resulting array 1 2 3 3 4 will be equal to 5.To reach the answer to the second sample case one must not decrease any of the array elements. | PASSED | 1,200 | standard input | 1 second | The first line of the input contains a single integer n (1ββ€βnββ€β100β000)Β β the number of elements in the Alyona's array. The second line of the input contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β109)Β β the elements of the array. | ["5", "3"] | #include<stdio.h>
#include<stdlib.h>
int cmpfunc (const void * a, const void * b)
{
return ( *(long long int*)a - *(long long int*)b );
}
int main()
{
long long arr[200005]={0},i,j,num=1,n;
scanf("%lld",&n);
for(i=0;i<n;i++)
scanf("%lld",&arr[i]);
qsort(arr,n,sizeof(long long int),cmpfunc);
f... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6f6b68d57b12f622ec69a9919aa07712 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
int i, j, n, one = 0, two = 0, three = 0, a;
scanf("%d", &n);
for(i = 0; i <n; i++){
scanf("%d", &a);
if(a==1){
one++;
}
else if(a==2){
two++;
}
else{
three++;
}
}
if(three>= t... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6f3669ee0bfebefd2048c37aef7a6380 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],k=0,l=0,m=0,i;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
if(a[i]==1){
k++;
}
if(a[i]==2){
l++;
}
if(a[i]==3){
m++;
}
}
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 814877f25a7e7ee0038913d9a543ac32 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int max(int a, int b, int c)
{
int m = a;
if (b > m) m = b;
if (c > m) m = c;
return m;
}
int main()
{
int n, x, i;
int a[3] = {0};
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
a[x - 1]++;
}
printf("%d\n", a[0] + a[1] + a[... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 896c5eb13cdcdb23093960774e3853b7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main(void) {
// your code goes here
int n,j;
scanf("%d",&n);
int i,a=0,b=0,c=0;
for(i=0;i<n;i++)
{
scanf("%d",&j);
if(j==1)a++;
if(j==2)b++;
if(j==3)c++;
}
int max=0;
if(a>=b && a>=c)
max=a;
if(b>=a && b>=c)
max=b;
if(c>=a && c>=b) max=c;
printf("\n%d... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 602285cc87ffcf0c38614596b1d2a49a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
long long int n,a,i,p=0,q=0,r=0;
scanf("%I64d",&n);
for(i=0;i<n;i++)
{
scanf("%I64d",&a);
if(a==1) p++;
else if(a==2) q++;
else if(a==3) r++;
}
if(p>=q&&p>=r) printf("%I64d ",q+r);
else if(q>=p&&q>=r) printf("%I64d ",p+r);
el... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 023d908ab76c579d5c0a7da81a01de0c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n,i,on=0,tw=0,th=0,a;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a==1)
on++;
else if(a==2)
tw++;
else
th++;
}
if(on>=tw && on>=th)
printf("%d",n-on);
else if(tw>=on && tw>=th)
printf... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 4a94627e529e862badf3db9e15dcb0ea | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main(){
int n, x, ans;
int ct[4];
ct[1] = ct[2] = ct[3] = 0;
scanf("%d", &n );
while( n-- ){
scanf("%d", &x );
ct[x]++;
}
ans = ct[1] + ct[2];
if( ct[1]+ct[3] < ans ) ans = ct[1] + ct[3];
if( ct[2]+ct[3]... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | f012dfddde158470408b1d2f6ab77342 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | /*
Badhan Sen
Student of C.S.E
jessore University of Science & Technology
Mail: galaxybd9@gmail.com
*/
#include <stdio.h>
int array[10000000];
int main ()
{
int n, i, a=0, b=0, c=0;
scanf ("%d", &n);
for... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 110ef01cd40390f564922c5de13f395a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
#include<math.h>
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
int main()
{
long long n,i,x,a[3]={0};
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("%lld",&x);
x--;
a[x]++;
}
printf("%d",n-(MAX(a[0],MAX(a[1],a[2]))));
return 0;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 66b307c3d04c1a35eb6fd6ace47c7288 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int a,n,i,p=0,q=0,r=0;
scanf("%d",&n);
//while(n!=0)
for(i=1;i<=n;i++) {
scanf("%d",&a);
if(a==1){
p++;
}
else if(a==2) {
q++;
}
else {
r++;
}
//n--;
}
if(p>=q&&p>=r... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | d1b187ff1838236eb4211169a891d1bc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main(){
int n, x, a[3];
a[0] = 0;
a[1] = 0;
a[2] = 0;
scanf("%d", &n);
for(; n > 0; n--){
scanf("%d", &x);
(a[x - 1])++;
}
if((a[0] <= a[2]) && (a[1] <= a[2])){
printf("%d\n", a[0] + a[1]);
}else if((a[1] <= a[0]) && (a[2] <= a[0])){
printf("%d\n", a[1] + a[2]);... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 77a8a02ca603e9d0d1337dd4fc87daf9 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,a[4]={0},s=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int x;
scanf("%d",&x);
a[x]++;
}
for(int i=1;i<=3;i++)
{
if(a[i]>s)
s=a[i];
}
printf("%d",n-s);
return 0;
} | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 80dc9045303f86d7d92529783e06510d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
#define For(X,Y,Z) for(int X=Y;X<Z;X++)
int max(int x,int y)
{
if(x>y) return x;
else return y;
}
int main()
{
int a[4]={0},n,m;
scanf("%d",&n);
a[1]=a[2]=a[3]=0;
For(i,0,n)
scanf("%d",&m),a[m]++;
n=a[1]+a[2]+a[3];
printf("%d\n",n-max(a[1],max(a[2],a[3])));
return 0;
} | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | ac2d0414558b3fb97ddaea1e335034bf | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main(){
int n,c = 0;
scanf("%d",&n);
int a[3];
int i;
for(i = 0; i < 3; i++ ) a[i] = 0;
for ( i = 0; i < n ; i++){
int x;
scanf("%d", &x);
if(x == 1) a[0]++;
else if(x == 2) a[1]++;
else a[2]++;
}
int max = 0;
if(a[0] >= a[1] && a[0] >= a[2]) max = 0;
else ... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 719b6910af4743a048fb2ff1cd508404 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
int n,a,i,ara[1000005],max;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&ara[i]);
}
int count1=0,count2=0,count3=0;
for(i=0;i<n;i++){
if(ara[i]==1){
count1++;
}
else if(ara[i]==2){
count2++;
}
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | d2ec6e77e0fcf72c5d19054ac32b1130 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int n , a , i , j , k, num[4] ;
int main()
{
scanf("%d", &n ) ;
while( ++i <= n )
{
scanf("%d", &a ) ;
num[a]++ ;
}
for( i = 1 ; i < 4 ;i++) if ( k < num[i] ) k = num[i] ;
printf("%d", n - k ) ;
return 0 ;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | b6b67daf1da92b76f77566037ccb4701 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
int n,a=0,b=0,c=0,x,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x);
if(x==1)a++;
else if(x==2)b++;
else c++;
}
if(a>b&&a>c)printf("%d",b+c);
else if(b>c&&b>a)printf("%d",a+c);
else if(c>a&&c>b)printf("%d",a+b);
else if... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 3957edd037ef7b78c617bcfaa8378470 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
long int n,i,count1=0,count2=0,count3=0;
long int max,replace;
int a;
scanf("%ld",&n);
//printf("%ld",n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a==1)
count1++;
else if(a==2)
count2++;
else count3++;
}
max=count1;
replace=count2+count3;
if(count2>max)
{
max=count2;
replace=count1+count3;
}... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 56ca3355bb494235a7f8d39bda8c5fe5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n,count1=0,count2=0,count3=0,X=0,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]==1) count1++;
if(a[i]==2) count2++;
if(a[i]==3) count3++;
X=max(count1,count2,count3);
}
printf("%d",n-X);
return 0;
}
int max(int a,int b,int c)
{
int ... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 5db4456bd03a22e1a81c1fdcb5a82657 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main() {
int n,a,big,i,arr[4]={0};
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
arr[a]++;
}
big=arr[1];
for(i=1;i<=3;i++)
if(big<arr[i])
big=arr[i];
printf("%d",n-big);
return 0;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6e89a2023c7908530ebb729d2633a9be | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
long long int n,i,c1=0,c2=0,c3=0,s1,s2,s3,max,a;
scanf("%lld", &n);
for (i=0;i<n;i++)
{
scanf("%lld", &a);
if (a==1) c1++;
if (a==2) c2++;
if (a==3) c3++;
}
if (c1>c2) max=c1;
else max=c2;
if (c3>max) max=c3;
if (max==c1) printf("%lld", c2+c3);
else if (max==c2) printf("... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 8e02ced36102363b378a3b1548c21b35 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main (void) {
int n, i, a=0, b=0, c=0;
scanf("%d", &n);
int ar[n];
for( i=0; i<n; i++) {
scanf("%d", &ar[i]);
if(ar[i]==1) a++;
if(ar[i]==2) b++;
if(ar[i]==3) c++;
}
if(b>=c && b>=a) printf("%d\n", n-b);
else if(c>=b && c>=a) printf("... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 067ca55954fc8778e448c575808b1b81 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int m,n,count=0,ara[1000000],i,o,j,l,cu=0,as=0;
//int ara[1000000];
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%d",&ara[i]);
}
for(i=0,1<=n<=1000000;i<n;i++) {
if(ara[i]==1) {
count++;
}
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | af2939a6147222bc395afb7ccef870e5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
long long n;
scanf("%I64d",&n);
int s[n];
long a=0,b=0,c=0;
long long i;
for (i=0;i<n;i++)
{
scanf("%d",&s[i]);
if (s[i]!=2) b++;
if (s[i]!=1) a++;
if (s[i]!=3) c++;
}
long d=(a<b) ?(a<c) ? a : c : (b<c) ? b :c ;
pri... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 56fa0c9ffaadc15789c302d43fb1d230 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
main(){
int n,i;
scanf("%d",&n);
int a[n],o=0,t=0,tr=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]==1) o++;
if(a[i]==2) t++;
if(a[i]==3) tr++;
}
int max=o;
if(max<t) max=t;
if(max<tr) max=tr;
printf("%d",n-max);
return 0;
} | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 30ebd501d10f71dd2708308bdc3715f9 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int a;
long n,a1=0,a2=0,a3=0;
scanf("%ld",&n);
while(n--)
{
scanf("%d",&a);
if(a==1)
a1++;
else if(a==2)
a2++;
else a3++;
}
if(a3>=a1&&a3>=a2)
printf("%ld",a1+a2);
else if(a2>=a1&&a2>=a3)
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 53fdac89ee01c4babdced3d32e82fed3 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
int n, n1, n2, n3, c;
scanf("%d\n", &n);
n1 = n2 = 0; n3 = n;
while (n3--) {
c = getchar();
if (c == '1') ++n1;
if (c == '2') ++n2;
getchar();
}
n3 = n-n1-n2;
if (n1 < n2) n1 = n2;
if (n1 < n3) n1 = n3;
printf("%d\n", n-n1);
return 0;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | e4f8b6d93d23e3d317b34d45bfa54ace | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int n, n1, n2, n3, c;
int main()
{
scanf("%d\n", &n);
n3 = n;
while (n3--) {
c = getchar();
if (c == '1') ++n1;
if (c == '2') ++n2;
getchar();
}
n3 = n-n1-n2;
if (n1 < n2) n1 = n2;
if (n1 < n3) n1 = n3;
printf("%d\n", n-n1);
return 0;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6c1e71acf1e37ccdfc3e4c534db91af5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n,i,max,x=0,y=0,z=0;
char a[1000000];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]==1)
x++;
else if(a[i]==2)
y++;
else
z++;
}
if(x>y)
max=x;
else
max=y;
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 8ed4ab86c72b597e811b04f4b32be071 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n,a;
scanf("%d",&n);
long int i,arr[3]={0};
for(i=0;i<n;i++)
{
scanf("%d",&a);
arr[a-1]++;
}
long max=0;
for(i=0;i<3;i++) if(max<arr[i]) max=arr[i];
printf("%ld",n-max);
return 0;
} | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | c67749709ff8f37dd871c4829d32fea7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
int n,a=0,b=0,c=0,x,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x);
if(x==1)a++;
else if(x==2)b++;
else c++;
}
if(a>b&&a>c)printf("%d",b+c);
else if(b>c&&b>a)printf("%d",a+c);
else if(c>a&&c>b)printf("%d",a+b);
else if... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 49c4490a7ba007c86878ee8f8f692cc1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main(){
long int n;
scanf("%ld",&n);
int a=0,b=0,c=0,x;
while(n--){
scanf("%d",&x);
if (x==1){
a++;
}
else if (x==2){
b++;
}
else
c++;
}
int min=a+b;
if (min>b+c){
min=b+c;
}
if (min>c+a){
min=c+a;
}
printf("%d",mi... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 05d4c4cb988dc1793029dc4715fa0987 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <assert.h>
#include <stdio.h>
int max(int a, int b, int c) {
if (a >= b && a >= c)
return a;
else if (b >= a && b >= c)
return b;
else
return c;
}
/*
* http://codeforces.com/problemset/problem/52/A
* A. 123-sequence
*/
int main(void) {
int ok, n, x, uno, dos, tres, ... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 847931aa5f7bfbbc6b74d0301749eff2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <conio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int main (void){
unsigned long int n,i,c1=0,c2=0,c3=0,z,max;
int num;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&num);
if(num==1)
c1++;
else if (num==2)
c2++;... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 44127321a432da0f8cc38b275fe3d449 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main(){
unsigned int n, i, a, max, numbers[] = {0, 0, 0, 0};
scanf("%u", &n);
for(i=0; i < n; i++){
scanf("%d", &a);
numbers[a]++;
}
max = numbers[1] > numbers[2] ? numbers[1] : numbers[2];
max = numbers[3] > max ? numbers[3] : max;
printf("%u\n", ... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6f887972039f6ca30adabb1d5878f985 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i;scanf("%d",&n);long long int a[n],p,k,x,y,z,ma;x=y=z=0;
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
for(i=0;i<n;i++)
{
if(a[i]==1)
x++;
else if(a[i]==2)
y++;
else
z++;
}
if... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | e06e3c96320b78742f3c5f9c2350704f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n;
int a,x=0,y=0,z=0;
scanf("%d",&n);
while(n--){
scanf("%d",&a);
if(a==1) x++;
else if(a==2) y++;
else z++;
}
if(x>=y&&x>=z) printf("%d",y+z);
else if(y>=x&&y>=z) printf("%d",x+z);
else printf("%d",x+y);
return 0;... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 056c10a9735d5559578811cc449d75f6 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
//#include<conio.h>
int main()
{
long int n,s=0,a,i,w=0,x=0,y=0,z;
scanf("%ld",&n);
for(i=1;i<=n;i++)
{ scanf("%ld",&a);
if(a==1) w++; else if(a==2) x++; else y++; }
z=(w>x?(w>y?w:y):(x>y?x:y));
printf("%ld",w+x+y-z);
// getch();
return(0);
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | f1a72c6da59e7e892a44d3a6aa1914f6 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
long long int i,j=0,k=0,m=0,n,rem,div,val,big;
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("%lld",&val);
if(val==1) j++; else if(val==2) k++;else m++; //so j,k,m counts the number of 1,2,3 re... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | ce1929dafc75c3fae835b466068db1ed | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main(int argc, char *argv[])
{
unsigned long n,i=0;
unsigned long count[3];
int num;
count[0]=count[1]=count[2]=0;
scanf("%ld", &n);
for(i=0; i<n; i++){
scanf("%d", &num); count[num-1]++;
}
if(count[0]>=count[1] && count[0]>=count[2])
printf("%ld", count[1]+count[2]);
else if(coun... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 975b13e94a37f9e28bee1d5b83837d5c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i,n,a=0,b=0,c=0,d;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&d);
if (d==1) a++;
if (d==2) b++;
if (d==3) c++;
}
if (a>=b && a>=c) {printf("%d",b+c); return 0;}
if (b>=a && b>=c) {printf("%d",a+c); ... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | fce71c1cf2fabcf20071e7b08db3b967 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],i,x=0,y=0,z=0;
for(i=1;i<=n;i++){
scanf("%d",&a[i]);
if(a[i]==1)x++;
if(a[i]==2)y++;
if(a[i]==3)z++;
}
if(x>=y&&x>=z)printf("%d",n-x);
else if(y>=z&&y>=x)printf("%d",n-y);
else if(z>=x&&z>=y)pr... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | c45aa828969ce43ec1c3f58215f673ea | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int min(int a, int b)
{
return a<b ? a : b;
}
int main()
{
int t[3] = {0, 0, 0}, n, m;
scanf("%d", &n);
while (n--) scanf("%d", &m), t[m-1]++;
int a = t[0]+t[1], b = t[2]+t[1], c = t[0]+t[2];
printf("%d\n", min(min(a, b), c));
return 0;
} | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6b06bb95afdff002860706e230843032 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int arr[4];
int main(){
int n,d,maxi,in,i,sum=0;
scanf("%d",&n);
while(n--){
scanf("%d",&d);
arr[d]++;
}
maxi=arr[1];
in = 1;
for(i=1;i<=3;i++){
if(arr[i]>maxi){
maxi=arr[i];
in = i;
}
}
for(i=1;i<=3;i++)
if(i!=in) sum+=arr... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | f0cb4d52db2e928258f0c5e501bdab0d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{long int i,n,d=0,b=0,c=0,min; int a;
scanf("%ld",&n);
for(i=0;i<n;i++)
{scanf("%d",&a);
if(a!=1) b++;
if(a!=2) c++;
if(a!=3) d++;
}
min=d;
if(b<d && b<=c) min=b;
if(c<d && c<=b) min=c;
printf("%ld",min);
return 0;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 142d6f8957f195ddf34c92e1559e345b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#define min(x,y) ((x)<(y)?(x):(y))
int main(void) {
int n, x[3] = {0, 0, 0};
scanf("%d", &n);
while (n--) {
getchar();
x[getchar() - '1']++;
}
printf("%d", min(x[0] + x[1], min(x[1] + x[2], x[0] + x[2])));
return 0;
} | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 7937a00ec2deaf7a5729eda5977e61ec | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,one=0,two=0,three=0;
scanf("%d",&n);
int ara[n];
for(i=0;i<n;i++)
{
scanf("%d",&ara[i]);
if(ara[i]==1)
one++;
else if(ara[i]==2)
two++;
else
three++;
}
if(one>=two... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | cabfaf5d7e33e245c785bab4fb231651 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
long long int n,i,s1,s2,s3,mx,one=0,two=0,three=0;
scanf("%I64d",&n);
int a;
for(i=0;i<n;i++) {
scanf("%d",&a);
if(a==1)
one++;
if(a==2)
two++;
if(a==3)
three++;
}
s1 = one+two;
s2 = two+t... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 66566d8b2639caaee248a46a62fee0ee | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,no,i,count_1=0,count_2=0,count_3=0;
scanf("%d",&n);
// int *a=(int *)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
{
scanf("%d",&no);
if(no==1)
count_1++;
else if(no==2)
count_2++;
else
count_3++;
}
if(count_1+count_2<=count_2+count_3 && count_1+c... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | a89be6a746a019e42ff40c2b77c62a11 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
main()
{
long long int a[1000000],i,j,n,c=0,c1=0,c2=0;
scanf("%I64d",&n);
for(i=1;i<=n;i++)
{
scanf("%I64d",&a[i]);
if(a[i]==1) c++;
if(a[i]==2) c1++;
if(a[i]==3) c2++;}
if(c>=c1&&c>=c2) printf("%I64d",n-c);
else if(c1>=c&&c1>=c2) printf(... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6dce4046ef3bd74c060e242db3041fd0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
#include <string.h>
int min(int a, int b) {
return a < b ? a : b;
}
int main() {
int n; scanf("%d", &n);
int i, c[3];
memset(c, 0, sizeof(c));
for (i = 0; i < n; i++) {
int a; scanf("%d", &a); a--;
c[a]++;
}
printf("%d\n", min(c[0]+c[1], min(c[0]+c[2], c[1]+c[2])));
return 0;
}
| |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 198b787069af1cec2bed04a8203a6817 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int n,a[1000005],i,max;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
int p=0,q=0,r=0;
for(i=0; i<n; i++)
{
if(a[i]==1)
p++;
else if(a[i]==2)
q++;
else r++;
}
if(p>q)
{
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 08dea06f7d1485bc9f7aa1169d91a7b1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include <stdio.h>
int main()
{
int n,a,i,ara[1000005],max;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&ara[i]);
}
int count1=0,count2=0,count3=0;
for(i=0;i<n;i++){
if(ara[i]==1){
count1++;
}
else if(ara[i]==2){
count2++;
}
... | |
There is a given sequence of integers a1,βa2,β...,βan, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other. | Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. | C | fcb6a715dfe302d7ae5a6695ca8976aa | 3d7e7145af0f1e3abe63fd9c4cd4fe8e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1294160400 | ["9\n1 3 2 2 2 1 1 2 3"] | NoteIn the example all the numbers equal to 1 and 3 should be replaced by 2. | PASSED | 900 | standard input | 2 seconds | The first line contains an integer n (1ββ€βnββ€β106). The second line contains a sequence of integers a1,βa2,β...,βan (1ββ€βaiββ€β3). | ["5"] | #include<stdio.h>
int main()
{
int a,i,p=0,q=0,r,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a==1) p++;
else if(a==2) q++;
}
r=n-(p+q);
if(p<q) p=q;
if(p<r) p=r;
printf("\n%d",n-p);
return(0);
}
| |
Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type "diβββti", that means "replace all digits di in string s with substrings equal to ti". For example, if sβ=β123123, then query "2βββ00" transforms s to 10031003, and query "3βββ" ("rep... | Print a single integer β remainder of division of the resulting number by 1000000007Β (109β+β7). | C | c315870f5798dfd75ddfc76c7e3f6fa5 | 87dc24d58ca1557c25ac96b47ebcec0b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp"
] | 1410103800 | ["123123\n1\n2->00", "123123\n1\n3->", "222\n2\n2->0\n0->7", "1000000008\n0"] | NoteNote that the leading zeroes are not removed from string s after the replacement (you can see it in the third sample). | PASSED | 2,100 | standard input | 1 second | The first line contains string s (1ββ€β|s|ββ€β105), consisting of digitsΒ β the string before processing all the requests. The second line contains a single integer n (0ββ€βnββ€β105)Β β the number of queries. The next n lines contain the descriptions of the queries. The i-th query is described by string "di->ti", where di... | ["10031003", "1212", "777", "1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define long long long
#define NN 501010
#define mod ((long)1e9 + 7)
int n;
char s[NN], t[NN], c[NN], * b[NN];
long p[10], len[10];
long mpow(long base, long m) {
long ans = 1;
for (; m > 0; m >>= 1) {
if (m & 1) ans = (ans * base) % mod;
... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | 4bd80997888d7d014b2719f41b0ac053 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include<stdio.h>
#include<string.h>
int main()
{
int k,i,j,n,lm,l;
char mes[1010];
scanf("%s",mes);
scanf("%d",&k);
l=strlen(mes);
if(l%k!=0)
{
printf("NO");
return 0;
}
lm=l/k;
for(i=0;i<k;i++)
{
for(j=i*lm,n=((i+1)*(lm-1)+i);j<((i+1)*lm)/2,n>=(i*lm)... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | 4d2e3a64287f31001f885705bb7004d8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include <stdio.h>
#include <string.h>
int main()
{
char s[1010];
int n,l,i,j;
gets(s);
scanf("%d",&n);
if (strlen(s)% n > 0)
{
printf("NO\n");
return 0;
}
l = strlen(s) / n;
for (i = 0; i < n; i++)
for (j = 0; j < l / 2; j++)
if (s[j + i * l] !... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | f19fa801f81190e87b64b6beead6b6ab | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include <stdio.h>
#include <string.h>
int main()
{
int i,n,a=0,l,b,k,wl,j,m,cmp,count=0,g;
char str[1001],temp[1001],temp2[1001];
scanf("%s%d",str,&k);
l=strlen(str);
wl=l/k;
if((k>l)||(wl*k!=l))
{
printf("NO");
return 0;
}
for(i=0;i<l;i++)
{
for(j=0;j<w... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | 8bbb5a0a17b985935de0a73427144036 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include<stdio.h>
#include<string.h>
int main()
{
char str[1002];
gets(str);
int n,l,x,sum=0,i=0,j,k,count=0;
scanf("%d",&n);
l=strlen(str);
x=l/n;
char ara1[x+1],ara2[x+1];
if((l%n)==0)
{
for(;str[i]!='\0';)
{
for(j=0,k=x-1;j<x,k>=0;j++,k--,i++... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | 81ce18833e23069106ce214fca86592e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include<stdio.h>
#include<string.h>
int main()
{
int a,i,j,m,n,f,l,k,d,r;
char c[10000];
gets(c);
scanf(" %d", &n);
m=strlen(c);
f=0;
l=m/n;
r=l;
d=0;
if(m%n==0)
{
for(k=0; k<n; k++)
{
for(i=f,j=l-1; i<(f+l)/2; i++,j--)
{
... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | deba19ffe28e4a0c05091674de9b87e9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include <stdio.h>
int main()
{
int count = 0, check = 0, j = 0, k, lop, len = 0, t;
char str[1000];
scanf("%s", str);
scanf("%d", &t);
int i;
for(i = 0; str[i] != '\0'; i++) {
len++;
}
if(len%t != 0) {
check++;
}
lop = len/t;
k = j+lop-1;
for(i = 1; i <=... | |
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | C | 43bb8fec6b0636d88ce30f23b61be39f | 5b7eb772c8ed6e51b65cdf739108f791 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"strings"
] | 1432658100 | ["saba\n2", "saddastavvat\n2"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | PASSED | 1,100 | standard input | 1 second | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | ["NO", "YES"] | #include <stdio.h>
#include <string.h>
#include<stdlib.h>
int main()
{
int length,j=0,q,i,k,n=0,p,w=1,x,l=0,m;
char s[1002], word[1002],s2[1002];
scanf("%s",&s);
scanf("%d",&k);
m=k;
length=strlen(s);
p=length/k;
q=p*w;
i=0;
j=0;
if(length%k!=0)
{
n=1;
}
f... | |
You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go through the infamous Biridian Forest.The forestThe Biridian Forest is a two-dimensional grid consisting of r rows and c columns. Each cell in Biridian Forest may contain a tree, or may be vacant. A v... | A single line denoted the minimum possible number of mikemon battles that you have to participate in if you pick a strategy that minimize this number. | C | 6e9c2236e24336fcca0723e656e664cc | 236e458b3b6c106aa0805825d48f3db9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dfs and similar",
"shortest paths"
] | 1374327000 | ["5 7\n000E0T3\nT0TT0T0\n010T0T0\n2T0T0T0\n0T0S000", "1 4\nSE23"] | NoteThe following picture illustrates the first example. The blue line denotes a possible sequence of moves that you should post in your blog: The three breeders on the left side of the map will be able to battle you β the lone breeder can simply stay in his place until you come while the other two breeders can move t... | PASSED | 1,500 | standard input | 2 seconds | The first line consists of two integers: r and c (1ββ€βr,βcββ€β1000), denoting the number of rows and the number of columns in Biridian Forest. The next r rows will each depict a row of the map, where each character represents the content of a single cell: 'T': A cell occupied by a tree. 'S': An empty cell, and your ... | ["3", "2"] | /* practice with Dukkha */
#include <stdio.h>
#include <string.h>
#define N 1000
#define M 1000
#define INF 0x3f3f3f3f
char cc[N][M + 1];
int dd[N][M], n, m;
int parse(int i, int j) {
char c;
if (i < 0 || i >= n || j < 0 || j >= m || dd[i][j] != INF)
return -1;
c = cc[i][j];
return c >= '0' && c <= '9' ? c - ... | |
You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go through the infamous Biridian Forest.The forestThe Biridian Forest is a two-dimensional grid consisting of r rows and c columns. Each cell in Biridian Forest may contain a tree, or may be vacant. A v... | A single line denoted the minimum possible number of mikemon battles that you have to participate in if you pick a strategy that minimize this number. | C | 6e9c2236e24336fcca0723e656e664cc | 85c6aa247c05a865263bf4e9b3113195 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dfs and similar",
"shortest paths"
] | 1374327000 | ["5 7\n000E0T3\nT0TT0T0\n010T0T0\n2T0T0T0\n0T0S000", "1 4\nSE23"] | NoteThe following picture illustrates the first example. The blue line denotes a possible sequence of moves that you should post in your blog: The three breeders on the left side of the map will be able to battle you β the lone breeder can simply stay in his place until you come while the other two breeders can move t... | PASSED | 1,500 | standard input | 2 seconds | The first line consists of two integers: r and c (1ββ€βr,βcββ€β1000), denoting the number of rows and the number of columns in Biridian Forest. The next r rows will each depict a row of the map, where each character represents the content of a single cell: 'T': A cell occupied by a tree. 'S': An empty cell, and your ... | ["3", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
struct forest
{
char status;//'0'~'9' is breaders_num, 'T' is tree,'S is startpos ,'E' is exit
}Forest[1010][1010];//init 1000 * 1000
struct queue
{
int row;
int col;
int step;
struct queue *next;
};
int create_path(int... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | e6b3042c931e40150555bc45c7b8ab39 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include<stdio.h>
int main()
{
int q,n,k,a,b,i,o=0,t[200001],j=0;
scanf("%d",&q);
while(q--)
{
scanf("%d%d",&n,&k);
for(i=0; i<n; i++)
{
scanf("%d",&a);
if(a&1)
o++,t[j++]=i+1;
}
if(o<k||((k+o)&1))
printf("NO\n")... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | 6daeabeaed22d6d32b75ddae564ed837 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include<stdio.h>
int main()
{
int x,y;
scanf("%d",&x);
for(y=1;y<=x;y++){
int a,b,s=0,i;
scanf("%d %d",&a,&b);
int aa[a];
for(i=0;i<a;i++)
{
scanf("%d",&aa[i]);
if(aa[i]%2==1)
{
s++;
}
}
if(s<b || (s-b)%2==1)
{
printf("NO\n... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | 9c65172a2f25ac57daab867ddd3fdef8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include<stdio.h>
#define TAM 200001
int main(){
int q, n, k, a, cont, impar[TAM];
scanf("%d", &q);
while(q--){
scanf("%d%d", &n, &k);
cont = 0;
for(int i=1; i<=n; i++){
scanf("%d", &a);
if(a%2)
impar[cont++] = i;
}
if(cont<k||(k%2 && cont%2==0)||(k%2==0 && cont%2)){
printf("NO\n");
con... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | d97e74ac21e49a1e609305775a6b9467 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include <stdio.h>
void main()
{
int q,n,k,r[200000],i,j,b,s;
scanf("%d",&q);
for(;q>0;q--)
{
s = 0;
j = 1;
scanf("%d %d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&b);
s += b%2;
if (j < k && s % 2 == 1)
{
r[j-1] = i+1;
j++;
s = 0;
}
}
if (j < k || (j == k && s % 2 == 0))
pri... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | 2704ac30cd60818fb25385f2274394f3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include <stdio.h>
int main(void) {
int i,j,q,n,k;
int index[200001],count=0,a;
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d %d",&n,&k);
count=0;
for(j=0;j<n;j++){
scanf("%d",&a);
if(a%2==1){
index[count++]=j+1;
}
}
index[count-1]=n;
if(count<k || (count-k)%2==1) printf("NO\n");
else{
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | 056eb32c4ec06b36cd12e04c3f93d9c1 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
unsigned long int q;
scanf("%ld",&q);
for (unsigned long int i = 0; i < q; ++i)
{
unsigned long int count_odd = 0;
unsigned long int indexer = 0;
unsigned long int n,k;
scanf("%ld %ld",&n,&k);
unsigned long long int arr[n];
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | b2a16063c0b7139a2ab06d9e4a051b6d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,k,od=0;
scanf("%d%d",&n,&k);
int ar[n];
for(int i=0;i<n;i++)
{
scanf("%d",&ar[i]);
if(ar[i]%2!=0)
od++;
}
if(k==1)
{
if(od%2!=0)
printf("YES\n%d\n",n);
else
printf("NO\n"... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.βe. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to... | For each query, print the answer to it. If it is impossible to divide the initial array into exactly $$$k$$$ subsegments in such a way that each of them will have odd sum of elements, print "NO" in the first line. Otherwise, print "YES" in the first line and any possible division of the array in the second line. The di... | C | 7f5269f3357827b9d8682d70befd3de1 | 891b940bf276ada2e80d3ad672e383c3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"math"
] | 1563978900 | ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2"] | null | PASSED | 1,200 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) β the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) β the number of elements in the array and the number of subsegments, respectivel... | ["YES\n1 3 5\nNO\nNO"] | #include<stdio.h>
int main()
{
int q,i;
scanf("%d",&q);
for(i=0;i<q;i++)
{
int n,j,k;
scanf("%d %d",&n,&k);
int a[n],even=0,x=0;
for(j=0;j<n;j++)
{
scanf("%d",&a[j]);
if(a[j]%2==0)
{
even++;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.