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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
You are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace < by the bracket {, but you can't replace it by ) or >.The following defin... | If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s. | C | 4147fef7a151c52e92c010915b12c06b | dcac09377788ee7f1e51eefd042696ee | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"math",
"expression parsing"
] | 1451055600 | ["[<}){}", "{()}[]", "]]"] | null | PASSED | 1,400 | standard input | 1 second | The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106. | ["2", "0", "Impossible"] | #include <stdio.h>
#include <string.h>
#define N 1000000
char symb0[] = { '[', '(', '{', '<' };
char symb1[] = { ']', ')', '}', '>' };
int ind0(char c) {
int i;
for (i = 0; i < 4; i++)
if (symb0[i] == c)
return i;
return -1;
}
int ind1(char c) {
int i;
for (i = 0; i < 4; i++)
if (symb1[i] == c)
ret... | |
You are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace < by the bracket {, but you can't replace it by ) or >.The following defin... | If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s. | C | 4147fef7a151c52e92c010915b12c06b | a022f514a71b6a53153ff681b139c25b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"math",
"expression parsing"
] | 1451055600 | ["[<}){}", "{()}[]", "]]"] | null | PASSED | 1,400 | standard input | 1 second | The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106. | ["2", "0", "Impossible"] | #include <stdio.h>
#include <string.h>
#define N 1000000
char symb0[] = { '[', '(', '{', '<' };
char symb1[] = { ']', ')', '}', '>' };
int ind0(char c) {
int i;
for (i = 0; i < 4; i++)
if (symb0[i] == c)
return i;
return -1;
}
int ind1(char c) {
int i;
for (i = 0; i < 4; i++)
if (symb1[i] == c)
ret... | |
You are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace < by the bracket {, but you can't replace it by ) or >.The following defin... | If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s. | C | 4147fef7a151c52e92c010915b12c06b | 395eea7f1e9b4385b251bf8ab0302226 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"math",
"expression parsing"
] | 1451055600 | ["[<}){}", "{()}[]", "]]"] | null | PASSED | 1,400 | standard input | 1 second | The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106. | ["2", "0", "Impossible"] | #include <stdio.h>
#include <stdlib.h>
char open[1000000];
char s[1000000]="0";
int change=0,i=0,k=-1;
int main()
{
scanf("%s",s);
for(;s[i]!='\0';i++)
{
if(s[i]=='{'){k++;open[k]=s[i];}
else if(s[i]=='('){k++;open[k]=s[i];}
else if(s[i]=='['){k++;open[k]=s[i];}
else if(s[i]=='<'){k++;open[k]=s[i];}
... | |
You are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace < by the bracket {, but you can't replace it by ) or >.The following defin... | If it's impossible to get RBS from s print Impossible. Otherwise print the least number of replaces needed to get RBS from s. | C | 4147fef7a151c52e92c010915b12c06b | b5a46f9455b30e3a156fc714ea0aa099 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"math",
"expression parsing"
] | 1451055600 | ["[<}){}", "{()}[]", "]]"] | null | PASSED | 1,400 | standard input | 1 second | The only line contains a non empty string s, consisting of only opening and closing brackets of four kinds. The length of s does not exceed 106. | ["2", "0", "Impossible"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX 1000000
typedef struct i{
char n;
struct i *prox;
}link;
typedef struct{
link *top;
int size;
}stack;
link * createLink(char value, link *prox){
link *a;
a = (link *) malloc(sizeof(link));
a->n = value;
a->prox = prox;... | |
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er... | Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$). | C | 5de66fbb594bb317654366fd2290c4d3 | 6b269e96ce34deb108ee9251e92d8bb9 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1581518100 | ["3\n010011\n0\n1111000"] | NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111). | PASSED | 800 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1. | ["2\n0\n0"] | #include <stdio.h>
#include<string.h>
int main()
{ int j,t,m;
scanf("%d\n",&m);
for(t=0;t<m;t++){
int i,c,l,count=0;
char str[100];
gets(str);
l=strlen(str);
j=0;
for(i=0;i<l;i++)
{
if(str[i]=='1')
{ if(i==l-1)
break;
j=i+1;
while(str[j]!='1')
{
if(j==l-1)
... | |
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er... | Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$). | C | 5de66fbb594bb317654366fd2290c4d3 | fbf07ebe0f558b5a72881c544d5afd56 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1581518100 | ["3\n010011\n0\n1111000"] | NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111). | PASSED | 800 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1. | ["2\n0\n0"] | #include<stdio.h>
#include<string.h>
int main()
{
int z,n,i,j,count;
scanf("%d\n",&z);
while(z>0)
{
char s[100];
scanf("%s",s);
n=strlen(s);
for(i=0;i<n&&s[i]!='1';++i);
for(j=n-1;j>0&&s[j]!='1';--j);
for(count=0;i<=j;++i)
if(s[i]=='0')
... | |
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er... | Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$). | C | 5de66fbb594bb317654366fd2290c4d3 | c2b787c27532f819e3db16ddf8f8531c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1581518100 | ["3\n010011\n0\n1111000"] | NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111). | PASSED | 800 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1. | ["2\n0\n0"] | #include <stdio.h>
#include <string.h>
int main()
{
int N,t,sum,i;
char s[105];
scanf("%d",&N);
scanf("%c",&s[0]);
while(N--)
{
sum=0;
t=0;
gets(s);
for(i=0;s[i]=='0'&&i<strlen(s);i++);
for(;i<strlen(s);i++)
{
if(s[i]=='0')
... | |
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er... | Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$). | C | 5de66fbb594bb317654366fd2290c4d3 | c7b1a8b315a4a0b55b54656954404700 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1581518100 | ["3\n010011\n0\n1111000"] | NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111). | PASSED | 800 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1. | ["2\n0\n0"] | #include<stdio.h>
#include<string.h>
int main()
{
int t,n,i,j,l;
char arr[2000];
scanf("%d",&t );
while(t--)
{
scanf("%s",arr);
int count=0,count1=0,sum=0,m=-1,n=-1;
l=strlen(arr);
for(i=0 ; i<l ;i++)
{
if(... | |
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er... | Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$). | C | 5de66fbb594bb317654366fd2290c4d3 | aff17591e2f43156acaa82b1a5470a58 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1581518100 | ["3\n010011\n0\n1111000"] | NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111). | PASSED | 800 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1. | ["2\n0\n0"] | #include<stdio.h>
#include<string.h>
void CountDeletedZeros(char * str , int len)
{
int lastpos = len;
int firstpos = 0;
int count = 0;
for(int i = len - 1; i > -1 ;i--)
{
int ASCII_str = str[i];
if(ASCII_str == 48)
lastpos--;
else
break; ... | |
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er... | Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$). | C | 5de66fbb594bb317654366fd2290c4d3 | c72753cb322330b0f72e861462fdac48 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1581518100 | ["3\n010011\n0\n1111000"] | NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111). | PASSED | 800 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1. | ["2\n0\n0"] | #include <stdio.h>
#include <string.h>
int main (){
int t;
scanf("%d", &t);
getchar();
for (int i = 0 ; i < t; i++){
char a[105];
int flag = 0, count = 0, sum = 0;
int pertama = 0, terakhir = 0;
scanf("%s", &a);
getchar();
int len = strlen (a);
for (int j = 0; j < len; j++){
if (flag == 0 && a[j]... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | bef2fa1af7193cf15dbe1588f9fe67d0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<string.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#include<errno.h>
int main()
{
int i,j,n,t ;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=n ;i>=1; i--)
{
printf("%d ",i);
}
}
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 4ac1656719abd36de6cbb8b9224c1db5 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main()
{
int i,t,j;
scanf("%d",&t);
while(t){
scanf("%d",&i);
for(j=1;j<=i;j++){
printf("%d ",j);
}
if(t!=1){
printf("\n");
}
t--;
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 3e736883b9a2e78bfb4cd0bea759ec81 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int t,n,i;
scanf("%d",&t);
while(t>0)
{
scanf("%d",&n);
for(i=0; i<n; i++)
printf("%d ",i+1);
printf("\n");
t--;
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | c4aa81d08baf901638803e2decd0f734 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
#include<conio.h>
int main()
{
int t,i,n,j;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&n);
for(j=1;j<n;j++){
printf("%d ",j);
}
printf("%d\n",n);
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | a4423cb13881086e5a5a5c3126e53298 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main(){
int a,i,j,b;
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d",&b);
for(j=1;j<=b;j++){
printf("%d ",j);
}
printf("\n");
}
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | a14ee3b0f047d8cec460707a6d90f0b5 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
printf("%d ",i);
printf("\n");
}
return 0;
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 6d54c164a3f3347f5e47ef3115595383 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main(void) {
int t;
scanf("%d", &t);
while(t--){
int n;
scanf("%d", &n);
for(int i=1; i<=n; i++) printf("%d ", i);
printf("\n");
}
return 0;
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | fffbb59e80cfea045c97275d9cd7265b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long long int t;
scanf("%lld", &t);
while ( t != 0 )
{
long long int n;
scanf("%lld", &n);
long long int i;
for ( i = n; i >= 1; --i )
{
printf("%lld ", i);
}
printf("\n");
--t;
}
// system("pause");
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | d79815b71ec38db32562ce57b0c0bf80 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main()
{
int n, i, t, j;
scanf("%d", &t);
for (j = 0; j < t; j ++)
{
scanf("%d", &n);
for (i = n; i >= 2; i --)
{
printf("%d ", i);
}
printf("1\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 06245bb42d53dc42bf88d2ef51615d91 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main(void) {
int n;
scanf("%d",&n);
while(n--)
{
int ar[100000],a,i,c;
scanf("%d",&a);
c=a;
for(i=0;i<a;i++)
{
ar[i]=c;
printf("%d ",ar[i]);
c--;
}
printf("\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 8abc4dbd1732fcc319bfce5209524f39 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
#define N 100
/*
int or(int a, int b, int perm[]) {
int res = perm[a];
for(int i = a + 1; i <= b; i++)
res = res | perm[i];
return res;
}
void print_sub_perm(int a, int b, int perm[]) {
for (int i = a; i <= b; i++)
printf("%d ", perm[i]);
}
int is_good(int a, int b, int perm[]) {
... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 982b324dbd575c363c18e358c2b21a91 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
#include<string.h>
int main()
{
int i,j,test,a[10000],n,j1;
scanf("%d",&test);
for(i=0;i<test;i++)
{
scanf("%d",&n);
int x=n;
for(j=1;j<=n;j++)
{
a[j]=x;
x--;
}
for(j1=1;j1<=n;j1++)
{
printf("%d... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 06fdd5dd58d8ea3621b1d010c8634f00 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int T,n,i,j;
scanf("%d",&T);
for(i=0;i<T;i++)
{
scanf("%d",&n);
for(j=1;j<=n;j++)
printf("%d ",j);
printf("\n");
}
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 0d4ac572bed061cfb8ee0fc7253a0894 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
for (int i=1; i<=t;i++){
int n;
scanf("%d",&n);
for (int j=1; j<=n; j++){
printf("%d ",j);
}
printf("\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 121fcef4a116608f48db0543c2df5d52 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
#include<math.h>
int main()
{
int a[101],i,j,k;
int t;
scanf("%d",&t);
for(i=1 ;i<=t ;i++)
{
scanf("%d",&j);
for(k=1 ;k<=j;k++){ printf("%d ",k);}
printf("\n");
}
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 58002098fa3dab0162c33811915ea88e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main(){
int t;
scanf("%d", &t);
while(t--){
int n;
scanf("%d", &n);
for(int i=1; i<=n; ++i){
printf("%d ",i);
}
puts("");
}
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 42fdae02440f0baec582dd0dfbe1a033 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int i,cout=0,n, test;
scanf("%d",&test);
while(test--)
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(cout>0)
printf(" ");
printf("%d",i);
cout++;
} ... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | ac098616de1d10afcd9fd6fd51f7fc15 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
while (t--){
int i, n;
scanf("%d", &n);
for (i = 1; i <= n; i++){
printf("%d ", i);
}
printf("\n");
}
return 0;
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | b08f7aaa0a526056c613ebf501e724c9 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
for(int i=1; i<=n;i++){
printf("%d ",i);
}
printf("\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 48a2faea722b84d24dbecc42dcc0eefe | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
long long a,b,c,d,e,f,g,h,i,j,k,l;
scanf("%lli",&a);
for(;a;a--)
{
scanf("%lli",&b);
for(c=1;c<=b;c++)printf("%lli ",c);
printf("\n");
}
return 0;
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | cd354157aafdf711575515bda0594d1a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | /* AUTHOR: AKASH JAIN
* EMAIL: akash19jain@gmail.com
* ID: akash19jain
* DATE: 09-08-2020 22:48:03
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x) ... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 06958de43f605380a34b4d8d7cb36911 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | # include<stdio.h>
int main()
{
int t, n;
scanf("%d", &t);
while(t--){
scanf("%d", &n);
for(int i = 1; i <= n; i++){
printf("%d ",i);
}
printf("\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 561aadfd535e294715c8d9710df43950 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main(){
int t, n;
scanf(" %d", &t);
for(int i=0; i < t; i++){
scanf(" %d", &n);
for(int j = 1; j <= n; ++j)
printf("%d ", j);
printf("\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 7ecc71f4951ad865c1b75df6600512ea | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d ",i);
}
printf("\n");
}
return 0;
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | edfc909f8fc3d52d7cc2b6b895fd63ca | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main ()
{
int t,n,i;
scanf ("%d",&n);
while (n>0)
{
scanf ("%d",&t);
for (i=1;i<=t;i++)
{
printf ("%d ", i);
}
printf (" \n");
n--;
}
return 0;
} | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | c976393c34e2ecb6b549861573fb8d1b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int t,i,j,n;
scanf("%d",&t);
for(i=1 ; i<=t ; i++)
{
scanf("%d",&n);
for(j=1 ; j<=n ; j++)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
| |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | d0e4da1ef26350862846f7e54f3aa842 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include<stdio.h>
int main()
{
int N,i,j,T;
scanf("%d", &T);
for(i=1; i<=T; i++)
{
scanf("%d", &N);
int A[N];
for(j=0; j<N; j++)
{
A[j]=j+1;
}
for(j=0; j<N; j++)
{
printf("%d ", A[j]);
}
printf("\n");
... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 681835139216be04ab4f5120332d1538 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | #include <stdio.h>
int main()
{
int i,t;
scanf("%d",&i);
for(t=0;t<i;t++)
{
int n,m;
scanf("%d",&n);
for(m=1;m<=n;m++)
{
printf("%d",m);
if(m!=n)
printf(" ");
}
if(t!=i-1)
printf("\n");
}
return 0... | |
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is... | For every test, output any good permutation of length $$$n$$$ on a separate line. | C | 1b3ac752bc9c0b5e20a76f028d4b3c15 | 0a7980d7a422fd18261c4fb09d2a8aaa | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"math"
] | 1596983700 | ["3\n1\n3\n7"] | NoteFor $$$n = 3$$$, $$$[3,1,2]$$$ is a good permutation. Some of the subarrays are listed below. $$$3\text{ OR }1 = 3 \geq 2$$$ $$$(i = 1,j = 2)$$$ $$$3\text{ OR }1\text{ OR }2 = 3 \geq 3$$$ $$$(i = 1,j = 3)$$$ $$$1\text{ OR }2 = 3 \geq 2$$$ $$$(i = 2,j = 3)$$$ $$$1 \geq 1$$$ $$$(i = 2,j = 2)$$$ Similarly, you ca... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$). | ["1\n3 1 2\n4 3 5 2 7 1 6"] | //set many funcs template
//Ver.20190820
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<assert.h>
#include <math.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int main(){
int t;
scanf("%d",&t)... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | d134aafa5c0af6e3dd662661023c0306 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
int main()
{ int t,n,i,c,d,p;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
mergeSort(a,0,n-1);
c=frequency(a,n);
d=distinct(a,n);
p=min(n/2,c,d);
/* if(p!=0||p==0 && n==1)
printf("%d %d\n",p);
e... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 6f2c989a42435e62f8ab3e9a85ba3d1f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
#include<stdlib.h>
#define loop(i,a,b) for(int i=a; i<b; i++)
int max(int a,int b)
{
return a > b ? a : b;
}
int min(int a,int b)
{
return a < b ? a : b;
}
int main()
{
//freopen("input.txt", "r", stdin);
int t;
scanf("%d", &t);
while(t--)
{
int n,x,*cnt,d... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 62d39d9b6769fd54e2341fbe51beca8a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
int main()
{
long long int t, cnt2,cnt3,n, s, i, p;
scanf("%lli", &t) ;
while(t--)
{
long long int a[200010]={},cnt[200010]={};
cnt2=0;
cnt3=0;
p=0;
scanf("%lli", &n) ;
for(i=0;i<n;i++)
{
scanf("%lli", &a[i]) ;
cnt[a[i]]+=1;
}
... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 93afdd573b9a87ff436fd7319fccadee | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | //BISMILLAHIR-RAHMANIR-RAHIM
#include <stdio.h>
int main()
{
int t;
scanf("%d", &t);
while(t--){
long long n;
scanf("%lld", &n);
long long ara[n + 1];
long long i, num[n], max = 0;
for(i = 0; i <= n; i++) ara[i] = 0;
for(i = 0; i < n; i++){
s... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 9c81caa991844976854956e8c9f7a532 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b)
{
return *(int*)a-*(int*)b;
}
int max(int a,int b)
{
if(a>=b)
return a;
else
return b;
}
int main()
{
int t,n,a[200005];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=0;i<n... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 333ab7e92fc014af71ea8ee4c4cf8550 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
void mergesort(int arr[], int l, int r)
{
if (l < r)
{
int m = l+(r-l)/2;
mergesort(arr, l, m);
mergesort(arr, m+1,r);
merge(arr, l, m, r);
}
}
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
fo... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 2d1d14e9100333014803bc4673e9eaec | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
#include<string.h>
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
int main() {
unsigned long dis,t, n, i, ans,x, max=0;
unsigned long a[200001] = {0};
scanf("%lu",&t);
while(t--) {
max = 0;
dis=0;
memset(a,0,200001);
scanf("%lu",&n);
if(n==1) {
scanf("%lu",&x);
printf("0\n");
conti... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 5d90ba883d3e56fb1d4e3c75c3f9dd78 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
#include<string.h>
int c[200002];
int main()
{
int t,n,num,max,index;
scanf("%d", &t);
while (t--) {
max = 1;
num = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &index);
c[index]++;
}
for (int i = 1; i <= n; i++) {
if (c[i]) num++;
max = max > c[i] ? max : c... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | fd5d8d0e404416a0bdd576ddf3e2930c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,i,unq=0,max=0;
scanf("%d",&n);
int *arr=(int*)calloc(n+2,sizeof(int));
int *val=(int*)calloc(n+2,sizeof(int));
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 8a5f241d3219cbba74e0290488ecc0c0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include <stdio.h>
int main(){
int t, n, max, m, i;
int a[200000];
int s[200001] = {0};
scanf("%d", &t);
while(t--){
max = 0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
s[a[i]]++;
if(s[a[i]] > max){
max = s[a[i]];
}
}
//printf("%d\n", max);
m = 0;
for(i = 1; i ... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 9ff862b336eadc6dc4f2b0083eb4ebed | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int sig[200010];
int main()
{
int t;
scanf("%d",&t);
int n,ans;
while(t--)
{
memset(sig,0,sizeof(sig));
scanf("%d",&n);
int i=0,x;int dinum=0,sanum=0;
for(i=0;i<n;i++)
{
scanf("%d",&x);
if(sig[x]==0)
{
... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | af66ae55875986111caa59bca4a2087d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | //░░░
// ░ anzim bin nasir
// ░
#include<stdio.h>
int main()
{
int t,n,i;
scanf("%d",&t);
while(t--)
{
int num=0,max=0,a,b[200005]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
b[a]+=1;
}
for(i=1;i<=n;i++)
{
... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 75c4478f15ab659e07b321c9d4e0394f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
int main()
{
int a,T,i,j,N,num,max;
scanf("%d",&T);
for(i=0;i<T;i++)
{
int arr1[200000]={0};
num=0;
max=0;
scanf("%d",&N);
for(j=0;j<N;j++)
{
scanf("%d",&a);
arr1[a-1]=arr1[a-1]+1;
}
for(j=0;j<N;j++... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | c830857810710ab368da797e7095ecbc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include <stdio.h>
void merge(int a[],int l,int m,int r)
{
int i,j,k,d1,d2;
d1=m-l+1;
d2=r-m;
long long int le[d1],ri[d2];
for(i=0; i<d1; i++)
{
le[i]=a[l+i];
}
for(i=0; i<d2; i++)
{
ri[i]=a[m+i+1];
}
i=j=0;
k=l;
while(i<d1&&j<d2)
{
if(le[i... | |
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills).So, about the teams. Firstly, these two teams s... | For each test case, print the answer — the maximum possible size $$$x$$$ for which it is possible to compose a valid pair of teams, where each team size is $$$x$$$. | C | a1951e7d11b504273765fc9fb2f18a5e | 41a3f69a15888b57d722710276fd1a27 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"binary search",
"implementation",
"greedy"
] | 1586788500 | ["4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3"] | NoteIn the first test case of the example, it is possible to construct two teams of size $$$3$$$: the first team is $$$[1, 2, 4]$$$ and the second team is $$$[4, 4, 4]$$$. Note, that there are some other ways to construct two valid teams of size $$$3$$$. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of students. The second line of the test case contains $$$n$$$ integers... | ["3\n1\n0\n2"] | #include<stdio.h>
int min(int a1,int a2,int a3)
{
if(a1<a2 && a1<a3)
return a1;
else if(a2<a1 && a2<a3)
return a2;
else if(a3<a1 && a3<a2)
return a3;
else if(a2==a1)
return --a2;
else if(a1==a3 || a2==a3)
return a3;
... | |
You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | C | 0accc8b26d7d684aa6e60e58545914a8 | c5dd3360b7fec0e52343ac0f9ba848ec | GNU C | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"implementation",
"sortings"
] | 1387893600 | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers n and m (1 ≤ n, m ≤ 5000). Next n lines contain m characters each — matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | ["1", "2", "2"] | #include<stdio.h>
#include<string.h>
char s[5003][5003];
int r[5003][5003];
int c[5003];
int main()
{
int i,j,n,m;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++) scanf("%s",s[i]);
for(i=0;i<n;i++)
{
r[i][m]=0;
for(j=m-1;j>=0;j--)
if(s[i][j]=='1')
r[i][j]=r[i][j+1]+... | |
You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | C | 0accc8b26d7d684aa6e60e58545914a8 | 06b3277d20cc4053f698a3bd501bf527 | GNU C | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"implementation",
"sortings"
] | 1387893600 | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers n and m (1 ≤ n, m ≤ 5000). Next n lines contain m characters each — matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | ["1", "2", "2"] | #include <stdio.h>
int max(a, b) {return a < b ? b : a;}
char a[5000][5010];
int z[5000], z1[5000], l[5000];
int main() {
int n, m, i, j, res=0, zn, z0;
scanf("%d %d\n", &n, &m);
for (i=0; i<n; i++) gets(a[i]);
for (i=0; i<n; i++) z[i] = i;
for (i=m-1; i>=0; i--) {
zn = z0 = 0;
for (j=0; j<n; j++) {
if (... | |
You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | C | 0accc8b26d7d684aa6e60e58545914a8 | f59a09f8a5f65fa48d22b1aa424ea210 | GNU C | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"implementation",
"sortings"
] | 1387893600 | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers n and m (1 ≤ n, m ≤ 5000). Next n lines contain m characters each — matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | ["1", "2", "2"] | #include <stdio.h>
char mat[5005][5005];
int max[5005][5005];
int col[5005];
int main(void) {
int n, m;
int i, j;
int res;
int aux;
scanf(" %d %d", &n, &m);
for (i = 1; i <= m; i++) {
col[i] = 0;
}
while((getchar()) != '\n') {
;
}
for (i = 1; i <= n; i++) {
... | |
You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | C | 0accc8b26d7d684aa6e60e58545914a8 | 86cb7e4c076fd8b23af2667d7bb73ecc | GNU C | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"implementation",
"sortings"
] | 1387893600 | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers n and m (1 ≤ n, m ≤ 5000). Next n lines contain m characters each — matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | ["1", "2", "2"] | #include<stdio.h>
#include<string.h>
char grid[5002][5002];
int row[5002];
int count[5002];
int max(int a,int b)
{
return a>b?a:b;
}
int main()
{
int n,m,i,j,ans=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%s",grid[i]);
}
for(j=0;j<m;j++)
{
memset(count,0,sizeof(co... | |
You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | C | 0accc8b26d7d684aa6e60e58545914a8 | 80bff13900515051e78f878089a35825 | GNU C | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"implementation",
"sortings"
] | 1387893600 | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers n and m (1 ≤ n, m ≤ 5000). Next n lines contain m characters each — matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | ["1", "2", "2"] | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#define MOD 1000000007
int CMP(const void * a,const void * b) {
return(*(int *) a - *(int *) b);
}
int MAX(int a,int b) {
return(a > b ? a : b);
}
int MIN(int a,int b) {
return(a < b ? a : b);
}
int GCD(int a,int b)... | |
You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | Print a single integer — the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | C | 0accc8b26d7d684aa6e60e58545914a8 | eaac432ae3c5692eddc66c9f1e984b28 | GNU C | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"implementation",
"sortings"
] | 1387893600 | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers n and m (1 ≤ n, m ≤ 5000). Next n lines contain m characters each — matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | ["1", "2", "2"] | #include<stdio.h>
int a[5000][5000],r[5010];
char s[5010];
main()
{
int i,j,mr,n,m,ans,c,val;
scanf("%d %d",&n,&m);
ans=0;
for(i=0;i<n;i++)
{
scanf("%s",s);
c=0;
for(j=0;j<m;j++)
{
if(s[j]=='1')
c++;
else
c=0;
a[i][j]=c;
}
}
for(j=0;j<m;j++)
{
for(i=0;i<... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 60291b465bd43407ca1d40046081f779 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
long long int plus[300010];
long long int minus[300010];
int main(){
char a[300010];
int n;
scanf("%d", &n);
long long int zero= 0;
for (int i = 0; i < n; ++i)
{
int f1, f2;
f1= f2= 0;
int diff= 0;
int highest= 0;
scanf("%s", &a);
int time... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 742db055031f66747715300c26e9d3dc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include <stdio.h>
#define MAX 300010
#define ll long long
#define MIN(a,b) (a>b?b:a)
ll L[MAX], R[MAX],B, N,i,ans,tmp,l,r;
int main(){char str[MAX];
for(scanf("%I64d", &N);N--;ans=tmp=l=r=0){scanf("%s", str);
for(i=0;str[i];i++){
if(str[i]=='(') tmp++;
else tmp--;
if(tmp... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 448527a42a390e2f6d1cb85e3842ac7d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include <stdio.h>
typedef long long int int64;
int SequenceValue(char seq[], int *min_val)
{
int value = 0;
*min_val = 0;
char *it = seq;
while (*it != '\0' && *it != '\n') {
value += (*it == '(') ? 1 : -1;
if (value < *min_val) {
*min_val = value;
}
it +=... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 59bef2f5dcd686380e754c9a04a8e370 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include <stdio.h>
#include <string.h>
#define mian main
#define MAXN 300005
#define ll long long
char s[MAXN];
ll num[2][MAXN];
int mian (void) {
int n, i, j;
scanf("%d", &n);
ll ans = 0;
for (i = 0; i < n; ++i) {
scanf("%s", s);
int len = strlen(s);
int l = 0, r = 0;
fo... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 9a2332cf5d2d705b50cc362e805bd3f3 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include<stdio.h>
#include<string.h>
int l[300005], r[300005], neither;
char str[300005];
int main(){
int n, i, j; scanf("%d", &n);
for(i = 1; i <= n; i ++){
int left = 0, right = 0;
scanf("%s", str+1); int len = strlen(str + 1);
for(j = 1; j <= len; j ++){
if(str[j] == '(') left++;
else if(left == 0) r... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 3eaa0c853d922a67961f206e65cff0f8 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include <stdio.h>
#include <string.h>
#define N 300000
#define L 300000
int main() {
static int kk[L + 1], ll[L + 1];
int n, a;
long long ans;
scanf("%d", &n);
while (n--) {
static char cc[L + 1];
int l, min, a, i;
scanf("%s", cc);
l = strlen(cc);
min = a = 0;
for (i = 0; i < l; i++) {
a += cc[... | |
A bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regul... | In the single line print a single integer — the number of pairs $$$i, j \, (1 \le i, j \le n)$$$ such that the bracket sequence $$$s_i + s_j$$$ is a regular bracket sequence. | C | f5f163198fbde6a5c15c50733cfd9176 | 235877a948deade59682b63da5adcae5 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1528625100 | ["3\n)\n()\n(", "2\n()\n()"] | NoteIn the first example, suitable pairs are $$$(3, 1)$$$ and $$$(2, 2)$$$.In the second example, any pair is suitable, namely $$$(1, 1), (1, 2), (2, 1), (2, 2)$$$. | PASSED | 1,500 | standard input | 2 seconds | The first line contains one integer $$$n \, (1 \le n \le 3 \cdot 10^5)$$$ — the number of bracket sequences. The following $$$n$$$ lines contain bracket sequences — non-empty strings consisting only of characters "(" and ")". The sum of lengths of all bracket sequences does not exceed $$$3 \cdot 10^5$$$. | ["2", "4"] | #include <stdio.h>
#include <string.h>
#define L 300000
int main() {
static char s[L + 1];
static int kkpos[L + 1], kkneg[L + 1];
int n, l, i, x, a, k;
long long ans;
scanf("%d", &n);
k = 0;
while (n--) {
scanf("%s", s), l = strlen(s);
a = l + 1;
x = 0;
for (i = 0; i < l; i++) {
x = s[i] == '(' ? x... | |
Amugae has a sentence consisting of $$$n$$$ words. He want to compress this sentence into one word. Amugae doesn't like repetitions, so when he merges two words into one word, he removes the longest prefix of the second word that coincides with a suffix of the first word. For example, he merges "sample" and "please" in... | In the only line output the compressed word after the merging process ends as described in the problem. | C | 586341bdd33b1dc3ab8e7f9865b5f6f6 | fd949f93a54dd49fb43db413a96b6690 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"hashing",
"string suffix structures",
"implementation",
"brute force",
"strings"
] | 1565526900 | ["5\nI want to order pizza", "5\nsample please ease in out"] | null | PASSED | 2,000 | standard input | 1 second | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$), the number of the words in Amugae's sentence. The second line contains $$$n$$$ words separated by single space. Each words is non-empty and consists of uppercase and lowercase English letters and digits ('A', 'B', ..., 'Z', 'a', 'b', ..., 'z', '0', '1... | ["Iwantorderpizza", "sampleaseinout"] | #include<stdio.h>
#include<string.h>
#define SZ 1000005
#define MAX(a,b) (a > b ? a : b)
long tbl[SZ*2];
char ret[SZ];
char tmp[SZ*2];
char word[SZ];
int MaxPrefixFind(char *p, int sz) {
int mlen = 0;
tbl[mlen] = mlen;
for (int i = 1; i < sz; i++) {
if (p[i] == p[mlen]) {
mlen++;
tbl[i] = mlen;
} els... | |
Amugae has a sentence consisting of $$$n$$$ words. He want to compress this sentence into one word. Amugae doesn't like repetitions, so when he merges two words into one word, he removes the longest prefix of the second word that coincides with a suffix of the first word. For example, he merges "sample" and "please" in... | In the only line output the compressed word after the merging process ends as described in the problem. | C | 586341bdd33b1dc3ab8e7f9865b5f6f6 | 69c9f16d67a3eb034092d26ba5283957 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"hashing",
"string suffix structures",
"implementation",
"brute force",
"strings"
] | 1565526900 | ["5\nI want to order pizza", "5\nsample please ease in out"] | null | PASSED | 2,000 | standard input | 1 second | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$), the number of the words in Amugae's sentence. The second line contains $$$n$$$ words separated by single space. Each words is non-empty and consists of uppercase and lowercase English letters and digits ('A', 'B', ..., 'Z', 'a', 'b', ..., 'z', '0', '1... | ["Iwantorderpizza", "sampleaseinout"] | #include <stdio.h>
#include <string.h>
#define MAXN 1000005
int pi[MAXN];
char s[MAXN], t[MAXN];
int sl;
void init(char s[], int l) {
pi[1] = 0;
for (int i = 1, k = 0; i < l; i ++) {
while (k && s[i] != s[k]) k = pi[k];
if (s[i] == s[k]) k ++;
pi[i+1] = k;
}
}
int main() {
int n;
scanf("%d", &... | |
Amugae has a sentence consisting of $$$n$$$ words. He want to compress this sentence into one word. Amugae doesn't like repetitions, so when he merges two words into one word, he removes the longest prefix of the second word that coincides with a suffix of the first word. For example, he merges "sample" and "please" in... | In the only line output the compressed word after the merging process ends as described in the problem. | C | 586341bdd33b1dc3ab8e7f9865b5f6f6 | fe30de479bb66f0a1591b1abec709d1c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"hashing",
"string suffix structures",
"implementation",
"brute force",
"strings"
] | 1565526900 | ["5\nI want to order pizza", "5\nsample please ease in out"] | null | PASSED | 2,000 | standard input | 1 second | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$), the number of the words in Amugae's sentence. The second line contains $$$n$$$ words separated by single space. Each words is non-empty and consists of uppercase and lowercase English letters and digits ('A', 'B', ..., 'Z', 'a', 'b', ..., 'z', '0', '1... | ["Iwantorderpizza", "sampleaseinout"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define N 1000000
#define MD 0x7fffffff
int rand_(int n) {
return (rand() * 76543LL + rand()) % n;
}
int px[N + 1], py[N + 1], X, Y;
void srand_() {
struct timeval tv;
int i;
gettimeofday(&tv, NULL);
srand(tv.tv_sec ^ tv.tv_usec)... | |
Amugae has a sentence consisting of $$$n$$$ words. He want to compress this sentence into one word. Amugae doesn't like repetitions, so when he merges two words into one word, he removes the longest prefix of the second word that coincides with a suffix of the first word. For example, he merges "sample" and "please" in... | In the only line output the compressed word after the merging process ends as described in the problem. | C | 586341bdd33b1dc3ab8e7f9865b5f6f6 | ebd967caaa1134e69e437192dc31f0e4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"hashing",
"string suffix structures",
"implementation",
"brute force",
"strings"
] | 1565526900 | ["5\nI want to order pizza", "5\nsample please ease in out"] | null | PASSED | 2,000 | standard input | 1 second | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$), the number of the words in Amugae's sentence. The second line contains $$$n$$$ words separated by single space. Each words is non-empty and consists of uppercase and lowercase English letters and digits ('A', 'B', ..., 'Z', 'a', 'b', ..., 'z', '0', '1... | ["Iwantorderpizza", "sampleaseinout"] | /* https://codeforces.com/contest/1200/submission/58592593 (uwi) */
#include <stdio.h>
#include <string.h>
#define N 1000000
int max(int a, int b) { return a > b ? a : b; }
void zzz(char *cc, int n, int *zz) {
int i, l, r;
memset(zz, 0, n * sizeof *zz);
for (i = 1, l = r = 0; i < n; i++)
if (i + zz[i - l] < r)... | |
This is an interactive task.Dasha and NN like playing chess. While playing a match they decided that normal chess isn't interesting enough for them, so they invented a game described below.There are $$$666$$$ black rooks and $$$1$$$ white king on the chess board of size $$$999 \times 999$$$. The white king wins if he g... | After getting king checked, you program should terminate immediately without printing anything extra. | C | 3d38584c3bb29e6f84546643b1be8026 | 6953d2633303a484773b8f026e2ac289 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"games",
"interactive"
] | 1547390100 | ["999 999\n1 1\n1 2\n2 1\n2 2\n1 3\n2 3\n<...>\n26 13\n26 14\n26 15\n26 16\n\n1 700 800\n\n2 1 2\n\n<...>\n\n-1 -1 -1"] | NoteThe example is trimmed. The full initial positions of the rooks in the first test are available at https://pastebin.com/qQCTXgKP. It is not guaranteed that they will behave as in the example. | PASSED | 2,500 | standard input | 2 seconds | In the beginning your program will receive $$$667$$$ lines from input. Each line contains two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x, y \leq 999$$$) — the piece's coordinates. The first line contains the coordinates of the king and the next $$$666$$$ contain the coordinates of the rooks. The first coordinate denotes... | ["999 998\n\n999 997\n\n<...>\n\n999 26"] | /* upsolve with Dukkha */
#include <stdio.h>
#define N 666
#define M 999
#define D 500
int min_(int a, int b) { return a < b ? a : b; }
int xx[N], yy[N], x, y;
void print() {
printf("%d %d\n", x, y);
fflush(stdout);
}
int occupied(int x1, int y1) {
int i;
for (i = 0; i < N; i++)
if (xx[i] == x1 && yy[i] == ... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | eec15d87916908f079e3dae7c193e498 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
#define DIMA 1
#define ALEX 0
typedef struct{unsigned int Price; unsigned int Quality;} Laptop;
void GetInput(unsigned int*, Laptop*);
unsigned short CheckArguement(unsigned int, Laptop*);
void MSA(unsigned int, unsigned int, Laptop*);
void Merge(unsigned int, unsigned int, unsigned int, Laptop*);
in... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 928ba521133af913568ab8b54f7aa9a4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
struct LapTop{ unsigned int Price; unsigned int Quality; };
void Merge_Sort( struct LapTop A[], unsigned int l, unsigned int r);
void Merge( struct LapTop A[], unsigned int l, unsigned int M, unsigned int r);
int main()
{
unsigned int NLaptop, i;
scanf("%u", &NLaptop);
struct LapTop lapto... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | e7ca1bdf50e0d11ed6289818a017b501 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
#define DIMA 1
#define ALEX 0
typedef struct{unsigned int Price; unsigned int Quality;} Laptop;
void GetInput(unsigned int*, Laptop*);
unsigned short CheckArguement(unsigned int, Laptop*);
void MSA(unsigned int, unsigned int, Laptop*);
void Merge(unsigned int, unsigned int, unsigned int, Laptop*);
in... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | ebebe8f82fe8db179e3775f8339d570d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main()
{
long long int n,i,j,c,b;
scanf("%lld",&n);
long long int a[2*n];
for(i=0;i<2*n;i++)
scanf("%lld",&a[i]);
if(n==3 && a[0]==3&&a[1]==3&&a[2]==1&&a[3]==2&&a[4]==2&&a[5]==1)
{printf("Happy Alex");
}
else
{
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i<2*n && j<2*n)
{
if((a[2*i]<a[2*j]))
{if ((a... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 1ea1a84211349b36e636d4cede5036bc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
#include<string.h>
int a[100000],b[100000];
int main()
{
int n,i,k=0;
scanf("%d",&n);
for(i = 0; i < n; i++)
{
scanf("%d%d",&a[i],&b[i]);
}
for(i = 0; i < n; i++)
{
if(a[i] != b[i])
{
k = 1;
break;
}
}
if(k == ... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 61cf0658da5ab1e9f2f5564dac7a36b0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
typedef struct laptop {
long price;
long quality;
} lt_t;
int lt_compare(const void * x1, const void * x2) {
return ((lt_t*) x1)->price - ((lt_t*) x2)->price;
// long a1 = ((lt_t*)x1)->price ;
// lon... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | a2a41f4f26100bd0aee8c28e37e351a2 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main()
{
int n;
int i, a, b;
int flag=0;
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d %d", &a, &b);
if(a!=b)
{
flag=1;
}
}
if(flag == 1)
{
printf("Happy Alex\n");
}
else
{
printf("Poor ... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 3a2abd48be13e151b8f680074dedd827 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
int main()
{
int n, a, b, j=0;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&a,&b);
if(a<b) j=1;
}
printf(j?"Happy Alex":"Poor Alex");
}
| |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 9278cc62e8bd358b39cef1019b2d6257 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int ar[n][2],max=0,min=100000,l=0,r=0;
for(int i=0;i<n;i++)
{
scanf("%d%d",&ar[i][0],&ar[i][1]);
}
for(int i=0;i<n;i++)
{
if(ar[i][1]-ar[i][0]<0)
{
l=1;
break;
}
}
if(l==1)
printf("%s","Happy Alex"... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 3e809d0ecf8a873578130ad54de624c2 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned i, n,a,b;
scanf("%u", &n);
for (i = 0; i < n; i++)
{
scanf("%u %u", &a, &b);
if (a != b)
{
printf("Happy Alex");
return 0;
}
}
printf("Poor Alex");
return 0;
} | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 2a156f2e31e8b3dbb311d754be25bbdb | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main()
{
int n, a,b,x=0;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&a,&b);
if(a!=b)
x++;
}
if(x>0)
printf("Happy Alex");
else
printf("Poor Alex");
} | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | e44b7792a8521e059bc5907030af4948 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] |
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
int main(int argc, char** argv) {
int i, j, n, x, check = 0;
scanf("%d", &n);
int a[n][2], k = n - 1;
for (i = 0; i < n; i++) {
scanf("%d%d", &a[i][0], &a[i][1]);
if (a[i][0] != a[i][1]) {
check = 1;
}
}
if (... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 19ef51bed1fb0181d43b658c82ae023f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main()
{
int i,n,a,b,t=0;
scanf("%d",&n);
while(n--)
{
scanf("%d %d",&a,&b);
if(a!=b)
{
t=1;
}
}
if(t)
{
printf("Happy Alex");
}
else
{
printf("Poor Alex");
}
}
| |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 3e725feb26fdbe33cd3660912674bb2d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
struct ss{int price, quality;}a[100000];
int comparator(const void* p, const void* q){
int l = ((struct ss*)p)->price;
int m = ((struct ss*)q)->price;
return l-m;
}
int main() {
int n, i, j, temp[2];
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%d%d", &a[i].price, &a[i].quality);
/... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 792d8d283ccb44619911c91714f51732 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | //Bismillahir_Rahmanir_Rahim
//Coded_by_mahmudul
#include<stdio.h>
int main()
{
int a,b,n,i=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d",&a,&b);
if(a!=b)
{
printf("Happy Alex");
return 0;
}
}
printf("Poor Alex");
return 0;
}
//Alhamd... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 739bb6b24696d13fadbe703481849fea | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
main(){
int i,j,k,s=0,n,c=0,arr[100000][4];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<2;j++){
scanf("%d",&arr[i][j]);
}
if(arr[i][0]==arr[i][1]){
c++;
}
}
if(n>c){
printf("Happy Alex\n");
}
else {
printf("Poor Alex\n");
}
}
| |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 5929f61e3feb52ea66fd709fd96795bc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
int main()
{
int num,i,j,temp;
scanf("%d",&num);
int price[num+10],qua[num+10];
for(i=0;i<num;i++) scanf("%d%d",&price[i],&qua[i]);
for(i=1;i<num;i++)
{
if(((price[i-1]>price[i]&&qua[i-1]<qua[i])||(price[i-1]<price[i]&&qua[i-1]>qua[i])))
{
printf("... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | f0fe2d0112b1b91aae9718206f7ff231 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main(void)
{
int n, a, b, ar[100000]={0}, i, x=100001, y=0, d=0;
scanf("%d", &n);
for(i=0; i<n; i++) {
scanf("%d %d", &a, &b);
ar[a] = b;
}
for(i=0; i<100000; i++) {
if(ar[i]>0) {
if(i>x && ar[i]<y) {
d = 1;
... | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | da5143031b6acb800f4d8dbb34cf8b02 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
#include<math.h>
int main()
{
int n,a,b,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d",&a,&b);
if(a!=b)
{
printf("Happy Alex\n");
return 0;
}
}
printf("Poor Alex\n");
return 0;
}
| |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | 8031693e581fd89397b49f1963f8fead | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include<stdio.h>
int main()
{
int n,c1=0;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
int a,b;
scanf("%d%d",&a,&b);
if(a<b)
{
c1++;
}
}
if(c1>0)
{
printf("Happy Alex");
}
else
{
printf("Poor Alex");
}
} | |
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ... | If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes). | C | c21a84c4523f7ef6cfa232cba8b6ee2e | d6beb742a4afbecd362f2a078a47f8cd | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings"
] | 1407511800 | ["2\n1 2\n2 1"] | null | PASSED | 1,100 | standard input | 1 second | The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ... | ["Happy Alex"] | #include <stdio.h>
int main()
{
int n,f=0,x,y;
scanf("%d",&n);
while(n--)
{
scanf("%d %d",&x,&y);
if(x!=y) f=1;
}
if(f) puts("Happy Alex");
else puts("Poor Alex");
return 0;
} | |
Sereja has painted n distinct points on the plane. The coordinates of each point are integers. Now he is wondering: how many squares are there with sides parallel to the coordinate axes and with points painted in all its four vertexes? Help him, calculate this number. | In a single line print the required number of squares. | C | 55fe63ed396d29abe9bfa4d316b7163e | 8114ef28bcbabe21ce3469f822551b1d | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"data structures",
"binary search",
"hashing"
] | 1398612600 | ["5\n0 0\n0 2\n2 0\n2 2\n1 1", "9\n0 0\n1 1\n2 2\n0 1\n1 0\n0 2\n2 0\n1 2\n2 1"] | null | PASSED | 2,300 | standard input | 2 seconds | The first line contains integer n (1 ≤ n ≤ 105). Each of the next n lines contains two integers xi, yi (0 ≤ xi, yi ≤ 105), the integers represent the coordinates of the i-th point. It is guaranteed that all the given points are distinct. | ["1", "5"] | /* practice with Dukkha */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define N 100000
#define K 200
#define Y 100000
#define MD 0x7fffffff
struct P {
int x, y;
} pp[N];
void srand_() {
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_sec ^ tv.tv_usec);
}
int rand_(... | |
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,... | In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in... | C | c014861f27edf35990cc065399697b10 | ff87d7012113fa1e0d2472195d82db8c | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"sortings",
"greedy"
] | 1416733800 | ["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"] | null | PASSED | 800 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child. | ["2\n3 5 2\n6 7 4", "0"] | #include<stdio.h>
int main()
{
int n,i,j,p=0,q=0,r=0;
scanf("%d",&n);
int arr[n],a[n],b[n],c[n],min;
for(i=1;i<=n;i++)
scanf("%d",&arr[i]);
for(i=1;i<=n;i++)
{
if(arr[i]==1)
{
p++;
a[p]=i;
}
if(arr[i]==2)
{
q++;
... | |
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,... | In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in... | C | c014861f27edf35990cc065399697b10 | 648389c9904aa4fce5425da024f9c8ab | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"sortings",
"greedy"
] | 1416733800 | ["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"] | null | PASSED | 800 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child. | ["2\n3 5 2\n6 7 4", "0"] | #include<stdio.h>
int main(){
int a[5000],i,j,n,p=0,q=0,r=0,x=0,y=0,z=0,b[6000][3]={0},t,min;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
if(a[i]==1){
p=p+1;
b[x][0]=i+1;
x++;
}
if(a[i]==2){
q=q+1;
b[y][1]=i+1;
y++;
}
if(a[i]==3){
r=r+1;
b[z][2]=i+1... | |
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells... | Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$. | C | 76fc2b718342821ac9d5a132a03c925e | c70a213aa84b7bf0b68a7bd1495a1351 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"combinatorics"
] | 1571236500 | ["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"] | NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here. | PASSED | 2,600 | standard input | 2 seconds | The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $... | ["8", "1", "102848351"] | /* practice with Dukkha */
#include <stdio.h>
#include <stdlib.h>
#define MD 998244353
int *solve(char *aa, int n, int k) {
int *dp2, *dp1, *dp;
int i, j;
dp2 = calloc(k + 1, sizeof *dp2);
dp1 = calloc(k + 1, sizeof *dp1);
dp = calloc(k + 1, sizeof *dp);
dp2[0] = dp1[0] = 1;
for (i = 1; i < n; i++) {
int *t... | |
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells... | Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$. | C | 76fc2b718342821ac9d5a132a03c925e | 82e8ce988aaa07888da6abe90a68edaa | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"combinatorics"
] | 1571236500 | ["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"] | NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here. | PASSED | 2,600 | standard input | 2 seconds | The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $... | ["8", "1", "102848351"] | #include <stdio.h>
#include <stdlib.h>
#define MOD 998244353
int w, h, free_rows, free_cols;
int dp_rows[4000][4000];
int dp_cols[4000][4000];
int dp_comb[4000][4000];
int used_rows[4000];
int used_cols[4000];
static int rows(int start, int count) {
int ans;
if(start > h) {
return 0;... | |
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells... | Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$. | C | 76fc2b718342821ac9d5a132a03c925e | 5c395b5ff3c3f776fa91c37f6ce30361 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"dp",
"combinatorics"
] | 1571236500 | ["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"] | NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here. | PASSED | 2,600 | standard input | 2 seconds | The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $... | ["8", "1", "102848351"] | #include<stdio.h>
#define MOD 998244353
#define DUBEG 0
int h[4003], hlen, hfree, w[4003], wlen, wfree, hdar[4003][2003], wdar[4003][2003], fact[4003], invfact[4003];
int mul(int a, int b){
return (a*1ll*b)%MOD;
}
int powmod(int b, int p){
int t = 1;
while(p){
if(p &1) t = mul(t ,b);
b = mul(b, b);
... | |
Andrew plays a game called "Civilization". Dima helps him.The game has n cities and m bidirectional roads. The cities are numbered from 1 to n. Between any pair of cities there either is a single (unique) path, or there is no path at all. A path is such a sequence of distinct cities v1, v2, ..., vk, that there is a roa... | For each event of the first type print the answer on a separate line. | C | 54c1d57482a1aa9c1013c2d54c5f9c13 | 6e220f8079217a3a089ded913e95036a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"trees",
"dsu",
"dfs and similar",
"ternary search"
] | 1407511800 | ["6 0 6\n2 1 2\n2 3 4\n2 5 6\n2 3 2\n2 5 3\n1 1"] | null | PASSED | 2,100 | standard input | 1 second | The first line contains three integers n, m, q (1 ≤ n ≤ 3·105; 0 ≤ m < n; 1 ≤ q ≤ 3·105) — the number of cities, the number of the roads we already have and the number of queries, correspondingly. Each of the following m lines contains two integers, ai and bi (ai ≠ bi; 1 ≤ ai, bi ≤ n). These numbers represent the ro... | ["4"] | #include "stdbool.h"
#include "stdio.h"
#include "stdint.h"
#include "string.h"
#include "ctype.h"
#include "stdlib.h"
#include "math.h"
#define PI 3.14159265358979323846264338327950288
#define ll long long
#define MOD 998244353
#define N 300100
#define MAX1 1000001
#define rep(i,n) for (int i=0; i<n; i++)
#define mul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.