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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | C | 0c9550a09f84de6bed529d007ccb4ae8 | 94abae6d11b76ddffbf13edccb9c71d6 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1315494000 | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | null | PASSED | 1,600 | standard input | 5 seconds | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | ["YES", "NO", "YES"] | #include <stdio.h>
#include <string.h>
char str[100005];
int main()
{
int i,l,s1=1,s2=1,f1=1,f2=1,f3=1,v,s=0;
while (scanf("%s",str+1)!=EOF)
{
if (++s>1)
f3=0;
l=strlen(str+1);
v=2;
if (str[l-3]=='l'&&str[l-2]=='i'&&str[l-1]=='o'&&str[l]=='s')
f1&=(s1==1);
else... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | 8676d972b44c06bc718f3496826ac7f1 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include<stdio.h>
char a[503][503];
int main(void)
{
int h, w;
int indi=0;
int hpos=0, wpos=0;
scanf("%d %d", &h, &w);
scanf("\n");
int i, j;
for(i=1;i<=h;i++)
{
for(j=1;j<=w;j++) scanf(" %c", &a[i][j]);
} //input finished
for(i=1;i<=h;i++)
{
if(indi==1) break... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | b3c090144b9be3d8daa5cddc19269bf3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include<stdio.h>
int main()
{
int h, w;
scanf("%d %d", &h, &w);
int i, j;
char s[502][502];
for (i = 0; i < h; i++)
scanf("%s", s[i]);
int p = 0;
int x, y;
for (i = 1; i < h - 1; i++)
{
for (j = 1; j < w - 1; j++)
{
if (s[i][j] == '*' && s[i][j - 1] == '*' && s[i][j + 1] == '*' && s[i - 1][j] == '*' ... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | a9b0e4693676b65e302627bda1be5f6d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include<stdio.h>
#include<math.h>
int main()
{
int w, h, i, j, a=0, cnt=0, c=0, d=0;
scanf("%d %d", &h, &w);
getchar();
char str[h+1][w+1];
for (i=0; i<h; i++)
gets(str[i]);
for (i=0; i<h; i++)
for (j=0; j<w; j++)
if ( str[i][j]=='*' )
cnt++;
if ... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | 4b61e0cc6ac3a0007fce99c6d2758f60 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include <stdio.h>
int main()
{
int h, w;
while(scanf("%d %d", &h, &w) != EOF)
{
int i, j, flag = 0, temp, tempi;
char ara[h+1][w+1];
for(i = 0; i < h; i++)
{
for(j = 0; j < w; j++)
{
scanf(" %c", &ara[i][j]);
}
}
... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | f15aab0d80aa1b6ccee75aaa435033f3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include <stdio.h>
int main(int argc, char const *argv[]) {
char map[510][510];
int h, w, flag = 1, start_w = -1, start_h = -1, series_w = 0, series_h = 0, no_h = 500, no_w = 500;
scanf("%d %d", &h, &w);
for (int i = 0; i < h; i++) {
scanf("%s", map[i]);
}
for (int i = 0; i < h; i++) {
for (int j =... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | f67c0c482bef98b5464a99cddb839f7e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include <stdio.h>
int main(){
char a[1000][1000];
int n,m,i,j,k,cnt=0,t;
scanf("%d%d",&n,&m);
for(i=1;i<=n;++i){
scanf("%s",a[i]+1);
for(j=1;j<=m;++j)if(a[i][j]=='*')++cnt;
}
for(i=2;i<n;++i)
for(j=2;j<m;++j)if(a[i][j]=='*'&&a[i-1][j]=='*'&&a[i+1][j]=='*'&&a[i][j-1]=='*'&&a[i][j+1]=='*'){
for(t=1,k... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | 5ab8c12a49f15699eca6416d5ff8bef5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int w, h;
scanf("%d %d", &h, &w);
int r=-1;
int c=-1;
int fr=-1;
int ce=0;
int rt=0;
int ct=0;
char arr[h][w+1];
for (int i=0; i<h; i++){
scanf("%s", arr[i]);
}
for (int i=0; i<h; i++){
for(int j=0;... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | 2f26e2f826242ed2ff61b4e396fe0ce3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include<stdio.h>
int main()
{
int h,w,i,j;
scanf("%d %d",&h,&w);
char str[h+1][w+1];
for(i=0;i<h;i++)
{
scanf("%s",&str[i]);
}
int c = 0,totalS=0;
for(i=1;i<h-1;i++)
{
for(j=1;j<w-1;j++)
{
if(str[i][j]=='*')
{
if(str[... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | 07efab5f9d0cf77b915a64704b64d0e5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include<stdio.h>
#include<math.h>
int main(){
int h, w, i, j, c = 0, d = 0, count = 0, n = 0;
scanf("%d%d", &h, &w);
getchar();
char a[h+1][w+1];
for(i = 0; i < h; i++)
gets(a[i]);
if(h <= 2 && w <= 2)
printf("NO");
else{
for(i = 0; i < h; i++){
for(j = 0... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | e62d1df5615eb1154dff2b677fbf6a51 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
return ( *(long long*)a - *(long long*)b );
}
int main(void){
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2,k;
char a[501... | |
You have a given picture with size $$$w \times h$$$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty cell. There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In oth... | If the given picture satisfies all conditions, print "YES". Otherwise, print "NO". You can output each letter in any case (upper or lower). | C | 6405161be280fea943201fa00ef6f448 | 9b276164d871af52fe31d09ce3f714cb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"dfs and similar",
"strings"
] | 1560258300 | ["5 6\n......\n..*...\n.****.\n..*...\n..*...", "3 5\n..*..\n****.\n.*...", "7 7\n.......\n...*...\n..****.\n...*...\n...*...\n.......\n.*.....", "5 6\n..**..\n..**..\n******\n..**..\n..**..", "3 7\n.*...*.\n***.***\n.*...*.", "5 10\n..........\n..*.......\n.*.******.\n..*.......\n.........."] | NoteIn the first example, the given picture contains one "+".In the second example, two vertical branches are located in a different column.In the third example, there is a dot outside of the shape.In the fourth example, the width of the two vertical branches is $$$2$$$.In the fifth example, there are two shapes.In the... | PASSED | 1,300 | standard input | 1 second | The first line contains two integers $$$h$$$ and $$$w$$$ ($$$1 \le h$$$, $$$w \le 500$$$) — the height and width of the picture. The $$$i$$$-th of the next $$$h$$$ lines contains string $$$s_{i}$$$ of length $$$w$$$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space. | ["YES", "NO", "NO", "NO", "NO", "NO"] | #include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
return ( *(long long*)a - *(long long*)b );
}
int main(void){
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,k,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;
char a[500... | |
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South... | Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street. | C | 206861107f0c06d3c8e358a85b9ddd7f | 53a5b6f680d243c7ebadf59ce8229343 | GNU C11 | standard output | 512 megabytes | train_000.jsonl | [
"implementation",
"sortings"
] | 1552035900 | ["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"] | NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ... | PASSED | 1,600 | standard input | 2 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ... | ["2 2 2 \n2 2 2", "2 3 \n3 2"] | #include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
typedef int64_t i64;
typedef int32_t i32;
static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i... | |
Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you with n gifts, any gifts you wish!". Then the fish gave the old man a list of gifts and their p... | On a single line print one real number — the probability of getting n most valuable gifts. The answer will be considered correct if its absolute or relative error does not exceed 10 - 9. | C | b8b3f75baaef9c4232e7fd7555d4fabb | af3098443c8a92133366bc74764fe039 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"combinatorics",
"probabilities",
"math"
] | 1349105400 | ["3 1\n3 10 20 30", "3 2\n1 40\n4 10 20 30 40"] | null | PASSED | 2,600 | standard input | 2 seconds | The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 1000) — the number of the old man's wishes and the number of distinct names in the goldfish's list, correspondingly. Then m lines follow: the i-th line first contains integer ki (ki > 0) — the number of distinct prices of gifts with the i-th na... | ["1.000000000", "0.166666667"] | #include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#ifndef ONLINE_JUDGE
#define DEBUG
#endif
typedef int (*cmp_t) (const void *, const void *);
typedef unsigned uint;
typedef long long int64;
typedef unsigned long l... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | f4da956e4f47225281d8c8806ea8dbcc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n;
long long int a,b;
scanf("%d",&n);
for(int i=0; i < n; i++)
{
scanf("%lld%lld",&a,&b);
if(a % 2 && b % 2 && a >= b * b)
printf("YES\n");
else if(a % 2 == 0 && b % 2 == 0 && a >= b * b)... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 837605bc43e8aaaf1204d9fa607cb1b9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
#include <math.h>
int main()
{
long long int n , k;
int t,lim;
scanf("%d",&t);
while( t--)
{
scanf("%lld %lld",&n,&k);
lim = floor(sqrt(n));
if( n<k || k>lim || (n%2==0 && k==1) )
printf("No\n");
else if(( n%2==0 && k%2==0)||(n%2!=0 && k%2!=0) || (n%2!=0 && k==1... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 8a7be59771e3eb8af38e1ac05937e45f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,k;
scanf("%d %d",&n,&k );
if(k>n/k)
printf("No\n");
else if(k<=n/k)
if(n%2==0 && k%2==0)
printf("Yes\n");
else if(n%2!=0 && k%2!=0)
printf("Y... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 8126eb49c5d14e35722f7fe0133f57e6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main()
{
int t,n,i;
unsigned long long int k;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&n);
scanf("%llu",&k);
if(n>=k*k && (n&1)==(k&1)){
printf("YES\n");
}
else
printf("NO\n");
}
}
| |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 0a2ba51bd82291492aad93023c138e23 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
int main() {
int n;
scanf("%d", &n);
while (n--) {
int a, k;
scanf("%d%d", &a, &k);
printf(k <= a / k && a % 2 == k % 2 ? "YES\n" : "NO\n");
}
return 0;
} | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | a3cf684e88f83a2e33b1609e802a3f8a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
int main(void) {
// your code goes here
long long int T;
scanf("%lld",&T);
for (long long int num=1;num<=T;num++)
{
long long int n,k;
scanf("%lld %lld",&n,&k);
if(k*k>n)
{
printf("NO\n");
}
else
{
long long int check=n-k;
if((check... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 2beb0be98d669f6f84b9b7ab0ae5e3ec | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
#include <math.h>
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
long long numero, quantidade;
scanf("%lld%lld", &numero, &quantidade);
if ((numero + quantidade) % 2 != 0 || quantidade > sqrt(numero))
printf("NO\n... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | a38bb8eadf3c1c69540f21e688e1291f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main()
{
long long int n,a,b,c,i;
scanf("%lld", &n);
for(i=1; i<=n; i++){
scanf("%lld %lld",&a,&b);
c=b*b;
if(a>=c && (a-c)%2==0){
printf("YES\n");
}
else{
printf("NO\n");
}
}
} | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 740d7f57f0de36e488bb98e5b2b26cdd | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
#include <math.h>
int main()
{
long long i,j,l,k,t,c,n,m,a;
scanf("%lld",&a);
for(i=0;i<a;i++)
{
scanf("%lld %lld",&m,&n);
if(n*n<=m && m%2==n%2 )
{
printf("YES\n");
}
else
printf("NO\n");
}
return 0;
}
| |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | f27fdf6ca87bb14d626561a1ceb1ce96 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main()
{
long long int t,n,k;
scanf("%lld",&t);
while(t--){
scanf("%lld %lld",&n,&k);
if(n>=k*k && (n-k)%2==0){
printf("YES\n");
}
else{
printf("NO\n");
}
}
return 0;
}
| |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 6d9c36a0aa5807866a3374173ad509e9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include <stdio.h>
#include <stdlib.h>
#define N 109
// int cmpfunc (const void * a, const void * b) {
// return ( *(int*)a - *(int*)b );
// }
// qsort(values, 5, sizeof(int), cmpfunc);
int main() {
long long t, n, k;
scanf("%lld", &t);
while(t--){
scanf("%lld%lld", &n, &k);
if (n%2 != k%2 || n < k*k)
... | |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | b91016d2dd11127d0e1f1011caad4283 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main(){
unsigned int t,i;
unsigned long long int k;
unsigned long long int n;
scanf("%u",&t);
for(i=0;i<t;i++){
scanf("%llu %llu",&n,&k);
if(n>=k*k&&n%2==k%2)
printf("YES\n");
else
printf("NO\n");
}}
| |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | 4235fc225ea4d32a21538eb4bf9a86eb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main(){
unsigned int t,i;
unsigned long long int k;
unsigned long int n;
scanf("%u",&t);
for(i=0;i<t;i++){
scanf("%llu %llu",&n,&k);
if(n>=k*k&&n%2==k%2)
printf("YES\n");
else
printf("NO\n");
}}
| |
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases. | For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise. | C | a4c82fffb31bc7e42870fd84e043e815 | a4497c13e9d98ea9b6696821af0f883a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1584974100 | ["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"] | NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example.... | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$). | ["YES\nYES\nNO\nYES\nYES\nNO"] | #include<stdio.h>
int main(){
unsigned int t,j;
unsigned long long int k;
unsigned long long int n;
scanf("%u",&t);
for(j=0;j<t;j++){
scanf("%llu %llu",&n,&k);
if(n>=k*k&&n%2==k%2)
printf("YES\n");
else
printf("NO\n");
}}
| |
After lessons Nastya decided to read a book. The book contains $$$n$$$ chapters, going one after another, so that one page of the book belongs to exactly one chapter and each chapter contains at least one page.Yesterday evening Nastya did not manage to finish reading the book, so she marked the page with number $$$k$$$... | Print a single integer — the number of chapters which has not been completely read so far. | C | 2545b6af730f99193041a8810b728cb3 | 9184a01a23c1540bf4e8a961bddd9e6d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1552322100 | ["3\n1 3\n4 7\n8 11\n2", "3\n1 4\n5 9\n10 12\n9", "1\n1 7\n4"] | NoteIn the first example the book contains $$$11$$$ pages and $$$3$$$ chapters — $$$[1;3]$$$, $$$[4;7]$$$ and $$$[8;11]$$$. Nastya marked the $$$2$$$-nd page, so she finished in the middle of the $$$1$$$-st chapter. So, all chapters has not been read so far, so the answer is $$$3$$$.The book in the second example conta... | PASSED | 800 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of chapters in the book. There are $$$n$$$ lines then. The $$$i$$$-th of these lines contains two integers $$$l_i$$$, $$$r_i$$$ separated by space ($$$l_1 = 1$$$, $$$l_i \leq r_i$$$) — numbers of the first and the last pages of the ... | ["3", "2", "1"] | #include<stdio.h>
int main()
{
int i,j,n,k,c;
scanf("%d",&n);
int a[n][2];
for(i=0;i<n;i++)
{
scanf("%d%d",&a[i][0],&a[i][1]);
}
scanf("%d",&k);
for(i=0;i<n;i++)
{
if(a[i][0]<=k && k<=a[i][1])
{
break;
}
}
printf("%d",n-i);
} | |
After lessons Nastya decided to read a book. The book contains $$$n$$$ chapters, going one after another, so that one page of the book belongs to exactly one chapter and each chapter contains at least one page.Yesterday evening Nastya did not manage to finish reading the book, so she marked the page with number $$$k$$$... | Print a single integer — the number of chapters which has not been completely read so far. | C | 2545b6af730f99193041a8810b728cb3 | 75756057ae8c27fdf40ff4895b510008 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1552322100 | ["3\n1 3\n4 7\n8 11\n2", "3\n1 4\n5 9\n10 12\n9", "1\n1 7\n4"] | NoteIn the first example the book contains $$$11$$$ pages and $$$3$$$ chapters — $$$[1;3]$$$, $$$[4;7]$$$ and $$$[8;11]$$$. Nastya marked the $$$2$$$-nd page, so she finished in the middle of the $$$1$$$-st chapter. So, all chapters has not been read so far, so the answer is $$$3$$$.The book in the second example conta... | PASSED | 800 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of chapters in the book. There are $$$n$$$ lines then. The $$$i$$$-th of these lines contains two integers $$$l_i$$$, $$$r_i$$$ separated by space ($$$l_1 = 1$$$, $$$l_i \leq r_i$$$) — numbers of the first and the last pages of the ... | ["3", "2", "1"] | #include<stdio.h.>
int main()
{ int n,sum=0,k,flag=0,i,j,x=0;
scanf("%d",&n);
int ara[n],word[n];
for(i=0;i<n;i++){
scanf("%d %d",&ara[i],&word[i]);
}
scanf("%d",&k);
for(i=0;i<n;i++){
if(k>word[i]){
flag++;
}
// else break;
}
/*while(k>=sum){
sum=ara[x]+word[x];
if(sum<=k){flag++;
x+... | |
After lessons Nastya decided to read a book. The book contains $$$n$$$ chapters, going one after another, so that one page of the book belongs to exactly one chapter and each chapter contains at least one page.Yesterday evening Nastya did not manage to finish reading the book, so she marked the page with number $$$k$$$... | Print a single integer — the number of chapters which has not been completely read so far. | C | 2545b6af730f99193041a8810b728cb3 | 537d689b5b60d342f5fdad2e0b999402 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1552322100 | ["3\n1 3\n4 7\n8 11\n2", "3\n1 4\n5 9\n10 12\n9", "1\n1 7\n4"] | NoteIn the first example the book contains $$$11$$$ pages and $$$3$$$ chapters — $$$[1;3]$$$, $$$[4;7]$$$ and $$$[8;11]$$$. Nastya marked the $$$2$$$-nd page, so she finished in the middle of the $$$1$$$-st chapter. So, all chapters has not been read so far, so the answer is $$$3$$$.The book in the second example conta... | PASSED | 800 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$) — the number of chapters in the book. There are $$$n$$$ lines then. The $$$i$$$-th of these lines contains two integers $$$l_i$$$, $$$r_i$$$ separated by space ($$$l_1 = 1$$$, $$$l_i \leq r_i$$$) — numbers of the first and the last pages of the ... | ["3", "2", "1"] | #include<stdio.h>
int main()
{
int n,i=0,m=0;
scanf("%d",&n);
int a[n],b[n],k,sum;
while(i<n)
{
scanf("%d %d",&a[i],&b[i]);
i++;
}
scanf("%d",&k);
i=0;
while(i<n)
{
if(k<=b[i])
{
m++;
}
i++;
}
printf("%d",m);
... | |
Berland has managed to repel the flatlanders' attack and is now starting the counter attack.Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (we do ... | On the first line print number k — the number of groups of cities in Flatland, such that in each group you can get from any city to any other one by flatland roads. At the same time, the cities from different groups should be unreachable by flatland roads. On each of the following k lines first print ti (1 ≤ ti ≤ n) — ... | C | 72394a06a9d9dffb61c6c92c4bbd2f3a | f364637bbe71a589477154ba10da04b5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"hashing",
"graphs",
"dsu",
"sortings",
"data structures"
] | 1337182200 | ["4 4\n1 2\n1 3\n4 2\n4 3", "3 1\n1 2"] | NoteIn the first sample there are roads only between pairs of cities 1-4 and 2-3.In the second sample there is no road between cities 1 and 2, but still you can get from one city to the other one through city number 3. | PASSED | 2,100 | standard input | 3 seconds | The first line contains two space-separated integers n and m (1 ≤ n ≤ 5·105, 0 ≤ m ≤ 106) — the number of cities and the number of roads marked on the flatland map, correspondingly. Next m lines contain descriptions of the cities on the map. The i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the ... | ["2\n2 1 4 \n2 2 3", "1\n3 1 2 3"] | #include <stdio.h>
#define MAXN 500000
#define MAXM 1000000
int b[MAXN], s[2 * MAXM][2], pos, n, m;
int interest[MAXN], n_rebr[MAXN], rank[MAXN], pres[MAXN];
int check[MAXN], n_check;
void
add(int x, int y)
{
s[pos][0] = y;
s[pos][1] = b[x];
b[x] = pos++;
++n_rebr[x];
}
void
read_n(void)
{
scanf(... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | d8f8cdc2db92ff8125f75e7765a2ee05 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main()
{
int i,m,a,b,temp;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&a);
//int A[a];
int B[3];
for(int j=0;j<3;j++)
{
B[j]=0;
}
for(int j=0;j<a;j++)
{
scanf("%d",&b);
temp=b%3;... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 3d34324b53e4903cf3bdf2267903a2a9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
#include<memory.h>
int main(){
int num;
scanf("%d", &num);
int ans[num];
memset(ans, 0, sizeof(ans));
int i, j, k;
for(i=0;i<num;i++)
{
int n;
int zero = 0;
int one = 0;
int two = 0;
scanf("%d", &n);
int arr[n], arr_2[n];
for(j=0;j<n;j++)
{
scanf("%d", &arr[j]);
arr_2[j]... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | f5401d20c17e488bfa62edefd2b28420 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main(){
int n,t,b[3],x,res;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
b[0]=0;b[1]=0;b[2]=0;res=0;
while(n--){
scanf("%d",&x);
b[x%3]++;
}
res+=b[0];
if(b[1]>b[2]){
res=res+b[2]+(b[1]-b[2])/3;
}
else{
res=res+b[1]+(b[2]-b[1])/3;
}
printf("%d\n",res);
}
} | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 598b1d6dfc2e62db1983c94b207bc85b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int ara2[3];
int main()
{
int i,n,sum=0,x=0,y=0,t,j;
scanf("%d",&t);
int ara3[t];
for(j=0;j<t;j++){
scanf("%d",&n);
long long int ara[n];
for(i=0;i<n;i++){
scanf("%lld",&ara[i]);
ara[i]=ara[i]%3;
ara2[ara[i]]++;
}
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | b4a371ac7c47a8c92f68a63b8844e09e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main() {
int t,n;
scanf("%d",&t);
int temp;
int modthr[3];
for (int i = 0; i < t; i++) {
modthr[0]=modthr[1]=modthr[2]=0;
scanf("%d",&n);
for (int j = 0; j < n; j++) {
scanf("%d",&temp);
modthr[temp%3]++;
}
if (modthr[1]<modthr[2]) {
modthr[0]+=modth... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 5cb48b2e4570d52dee759f8625d2317a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int query,i,j,count0=0,count1=0,count2=0;
scanf("%d",&query);
int *q=malloc(query*sizeof(int));
int **a=malloc(query*sizeof(int*));
int *result=malloc(query*sizeof(int));
for(i=0;i<query;i++)
{
count0=0;
count1=0;
count2=0;
scanf("%d",&q[i]);
a[i]=mall... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | cf401d0ff584bf9e13284f15c6be4dc6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <stdlib.h>
int main() {
int num, q, n, num_ones, num_twos, num_threes;
scanf("%d", &q);
for (int i = 0; i < q; i++) {
num_ones = num_twos = num_threes = 0;
scanf("%d", &n);
for (int j = 0; j < n; j++) {
scanf("%d", &num);
if (num ... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 8c71e1d11bdc5ba221e189df0fc74075 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main()
{
int t,n,ara[101];
scanf("%d",&t);
for(int i=0 ; i<t ; i++)
{
int a=0,b=0,c=0;
scanf("%d",&n);
for(int i=0 ; i<n ; i++)
{
scanf("%d",&ara[i]);
if(ara[i]%3 == 0)
a++;
else if(ara[i]%3 == 1)
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | ba27c44926ef7a4ef8e25e77a04e4297 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main()
{
int t,n;
scanf("%d", &t);
while(t--)
{
int count = 0, one = 0, two = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++)
{
int temp;
scanf("%d", &temp);
if(temp%3 == 0)
count++;
else if(temp%3 == 1)
one++;
else
two++;
}
if(one>two)
{
one ... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | cf1dd23441ebbe809389ee7e7cdbc914 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
#include<stdlib.h>
long long a[1000000];
long long amin(long long a,long long b)
{
if(a>b) return b;
else return a;
}
int main()
{
long long n;
scanf("%I64d",&n);
n=n+1;
int i;
while(n=n-1)
{
long long m;
scanf("%I64d",&m);
long long m3y1=0;
long long div3=0;
long long m3y2=0;
fo... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 27e0b69fc7b12440368a4d46c0213b3a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main() {
unsigned short t;
scanf("%hu", &t);
for(unsigned short i = 0; i < t; ++i) {
unsigned short n;
scanf("%hu", &n);
unsigned a;
unsigned short r0 = 0, r1 = 0, r2 = 0;
for(unsigned j = 0; j < n; ++j) {
scanf("%u", &a);
switch(a % 3) {
case 0: ++r0; break;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | cf25dd8edb85a9d3949cfd9b61fe01bf | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <stdlib.h>
int main(void) {
int q;
scanf("%d",&q);
for(int j=1;j<=q;j++)
{int n;
scanf("%d",&n);
long int a[n];
int p=0,q=0;
for(int i=1;i<=n;i++)
{
scanf("%ld",&a[i]);
if(a[i]%3==0)
{
p = p+1;
}
else if... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | a2264ce02ca1c7bd34ad5ae33796c336 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int q,i,j,t,a=0,b=0,c=0;
scanf("%d",&q);
int arr[100];
for (i=0;i<q;i++)
{
a=0,b=0,c=0;
scanf("%d",&t);
for (j=0;j<t;j++)
{
scanf("%d",&arr[j]);
if (arr[j]%3==0) a++;
else i... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | aec9afea0ee1af59b5151f01ee9ca685 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int t;
scanf("%d",&t);
for (int i = 0; i < t; ++i)
{
int n;
scanf("%d",&n);
unsigned long long int arr[n];
unsigned long long int mod0 = 0 , mod1 = 0, mod2 = 0;
unsigned long long int count_total = 0;
for (int i = 0; i < n;... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 2fb6dfb33bf0200ff9ed85f83bc6b2fc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <stdlib.h>
int min(int a, int b) {
if(a < b) return a;
else return b;
}
int main()
{
int t;
scanf("%d", &t);
for(; t > 0; t--) {
int n, rems[3];
rems[0] = rems[1] = rems[2] = 0;
scanf("%d", &n);
for(; n > 0; n--) {
long lon... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 7bde548b389fd534c36ecf7345d0b86f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main()
{
int t, n, i, j, k, c; scanf("%d",&t);
for( ;t>0;t--)
{
scanf("%d",&n);
c=0;
long long int a[n+1];
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
if(a[i]%3==0) {a[i]=0; c++;}
}
for(i=0;i<n;i++)
{... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 1c1127fed74918be52cf4fab2653466e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main()
{
int t,n,an[1000],i,j,k,l,m,p=0,q;
scanf("%d",&t);
long long int a[t][101];
for(i=0;i<t;i++)
{
scanf("%d",&an[i]);
for(k=0;k<an[i];k++)
scanf("%I64d",&a[i][k]);
}
for(i=0;i<t;i++)
{
j=0;
m=0;l=0;
for(k=0;k<an[i];k++)
{
if(a[i][k]%3==0)
j++;
else if(a[i][k]%... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | f3cb73ad9e865fe0d75106ab11ad7aed | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
typedef long long ll;
int main()
{
int t, m;
scanf("%d",&t);
m=t-1;
ll arr[t];
while(t--)
{
int n;
scanf("%d",&n);
ll ar[n],cnt[3]={0},scnt=0;
for(int i=0;i<n;i++)
{
scanf("%lld",&ar[i]);
cnt[ar[i]%3]++;
}
scnt+=cnt[0];
if(cnt[2]>cnt[1])
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | c762ce9db3cf68245e9806f2071123c2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main()
{
int i,j,k,l,queries,num[1000],count[1000]={0};
unsigned int arr[1000][100];
scanf("%d",&queries);
for(i=0;i<queries;i++)
{
scanf("%d",&num[i]);
for(j=0;j<num[i];j++)
{
scanf("%d",&arr[i][j]);
}
}
printf("\n");
for... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 4250a58a68032e467f21dba37ca8286a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main(){
int a;
scanf("%d", &a);
int i;
int anss[a];
for(i=0; i<a; i++){
int b;
scanf("%d", &b);
int c[b];
int j;
for(j=0; j<b; j++){
int tmp;
scanf("%d", &tmp);
tmp = tmp%3;
c[j] = tmp;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | b93c4482a6bd9e4e296b2760c9b6603d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main()
{
int a,b,c,d,e,t,n;
scanf("%d",&t);
while(t--)
{
b=0;c=0;d=0;
scanf("%d",&n);
while(n--)
{
scanf("%d",&a);
if(a%3==0)
b++;
else if(a%3==1)
c++;
else
d++;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 04bd2cb6adc8f44ed37bd8bc7ddb32f3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
#define N 3LL
int main(void)
{
#ifdef test
freopen("in.txt","r",stdin);
#endif // test
int T;
for(scanf("%d",&T);T--;)
{
int n,t=0,k=0;
long long a=0,a0=0,sum=0,s1=0,s2=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%lld",&... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 2ff830cad09d8d9405d14689b42fc2d4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int a[110];
int n;
int min(int a, int b) {
return (a < b ? a : b);
}
void solve() {
scanf("%d", &n);
int c0 = 0, c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (a[i] % 3 == 0) c0++;
else if (a[i] % 3 == 1) c1++;
else c2++;
}... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 0f0514cc8ac98961b09bced4def12d46 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main()
{
int t;
int n, cnt = 0, o = 0, w = 0;
int a;
scanf("%d",&t);
while(t--)
{ scanf("%d", &n);
cnt = 0;
o = 0;
w = 0;
a = 0;
for (int i = 0; i < n; ++i)
{
scanf("%d", &a);
a= a % 3;
switch (a)
{
case 0:
cnt++;
break;
case 1:
o++;
break;
case 2:
w++;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 9c8ab791e491e5626e6944730e721709 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
int t, n, a[5], x;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
memset(a, 0, sizeof(a));
int count = 0;
while(n--)
{
scanf("%d", &x);
if(x%3!=0) a[x%3]++;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 2d45ad216f342ded52ce904860f3e54a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main(void)
{
int n,q,a,b,c;
scanf("%d",&n);
int r;
int ans[n];
for(int i = 0; i < n; i++)
{
a=0;
b=c=0;
r=0;
scanf("%d",&q);
int query[q];
for(int x = 0; x < q; x++)
{
scanf("%d",&query[i]);
if(... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 3398ffbb8e7b398155c0eaa0d3fcf751 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main(){
int t,i,j;
scanf("%d",&t);
int n;
int count[t][3];
for(i=0;i<t;i++){
scanf("%d",&n);
long int a[n];
count[i][0]=0;
count[i][1]=0;
count[i][2]=0;
for(j=0;j<n;j++){
scanf(" %ld",&a[j]);
if(a[j]%3==0){
count[i][a[j]%3]++;
continue;
}
if(a[j]%3==1){
c... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 3ef3d5ffbba7b38007985ab8ab93e564 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include<stdio.h>
int main ()
{
int n;
int t;
scanf("%d", &t);
for (int p=0;p<t;p++)
{
scanf("%d",&n);
int num;
int r0=0;int r1=0;int r2=0;
for (int i=0;i<n;i++)
{
scanf("%d",&num);
if (num%3==0)
r0++;
else if (num%3==1)
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 44530b23df61410361448ea60f9833b0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | main() {
int q, s, a;
scanf("%d", &q);
while(q-- > 0) {
int n[3] = { 0 };
scanf("%d", &s);
while(s-- > 0) {
scanf("%d", &a);
n[a % 3]++;
}
int ot = (n[1] < n[2]) ? n[1] : n[2];
int oo = (n[1] > ot) ? (n[1] - ot) / 3 : 0;
int tt... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | 0d68182a7c9d8be3df0f3a3ffb98100d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n, k0, k1, k2, cnt;
scanf("%d", &n);
k0 = k1 = k2 = 0;
while (n--) {
int a;
scanf("%d", &a);
if (a % 3 == 0)
k0++;
else if (a % 3 == 1)
k1++;
else
k2++;
}
cnt = k1 < k2 ? k1 : k2;
printf("%d\n", k0... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | a5d1ff2ce9e2102954372e2c75cb71a9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
int min(int x, int y) {
if (x < y) {
return x;
}
return y;
}
int main()
{
int t, n, m, zeros, ones, twos, answer;
for (scanf("%d",&t); t && scanf("%d",&n); t--) {
for (zeros = 0, ones = 0, twos = 0; n && scanf("%d",&m); n--) {
m %= 3;
if (... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$.In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | For each query print one integer in a single line — the maximum possible number of elements divisible by $$$3$$$ that are in the array after performing described operation an arbitrary (possibly, zero) number of times. | C | e59cddb6c941b1d7556ee9c020701007 | edd6f942f6a92cfb9aee7afce828d71a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1560090900 | ["2\n5\n3 1 2 3 1\n7\n1 1 1 1 1 2 2"] | NoteIn the first query of the example you can apply the following sequence of operations to obtain $$$3$$$ elements divisible by $$$3$$$: $$$[3, 1, 2, 3, 1] \rightarrow [3, 3, 3, 1]$$$.In the second query you can obtain $$$3$$$ elements divisible by $$$3$$$ with the following sequence of operations: $$$[1, 1, 1, 1, 1, ... | PASSED | 1,100 | standard input | 1 second | The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 100$$$). The second line of each query contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$). | ["3\n3"] | #include <stdio.h>
#include <math.h>
int main()
{
int t, n, x, c1=0, c2=0, c3=0;
scanf("%d", &t);
for(int i=0; i<t; i++){
scanf("%d", &n);
c1=c2=c3=0;
for(int j=0; j<n; j++){
scanf("%d", &x);
if(x%3 == 0){
c3++;
}
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 6f1fe94be76f8702a6a598f3bd764c01 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include<stdio.h>
int main()
{
int i,j,n,sum[3]={0};
scanf("%d",&n);
int a[n][3];
for(i=0;i<n;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
for(j=0;j<3;j++)
{
for(i=0;i<n;i++)
{
sum[j]+=a[i][j];
}
}
///... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | b134d7ceca42937ec308708fded3f9fd | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int x,y,z,n,i;
int xt=0,yt=0,zt=0;
scanf("%d",&n);
if(n>=1 || n<=100)
{
for(i=1;i<=n;i++)
{
scanf("%d",&x);
xt=xt+x;
scanf("%d",&y);
yt=yt+y;
scanf("%d",&z);
zt=zt+z;
}
if (xt==0 &&... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 4219c4f5d4d666ac211f24a7dc0c6b1f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n, tot[3]={0};
scanf("%d", &n);
int a, b, c, d;
for(a=0; a<n; a++)
{
scanf("%d %d %d", &b, &c, &d);
tot[0] += b;
tot[1] += c;
tot[2] += d;
}
if(tot[0]==0&&tot[1]==0&&tot[2]==0)
printf("YES\n");
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 30b7689c2f3cfd4d9ddb73a175d09a85 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n,a[1000][3],b[1000],m=0,c[1000],l=0,kq1=0,kq2=0,dem1=0,dem2=0,dem3=0;
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
for (int j=1;j<=3;j++)
{
scanf("%d",&a[i][j]);
}
}
for (int i=1;i<=n;i++)
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 52da0cff68c3c134f0da209e44680637 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n, loop;
scanf("%d", &n);
int x, y, z;
int sumx = 0, sumy = 0, sumz = 0;
for(loop = 0; loop < n; loop++)
{
scanf("%d %d %d", &x, &y, &z);
sumx += x;
sumy += y;
sumz += z;
}
if (sumx == 0 && sumy == ... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 9092db37ce8cfcc0d21fdc6b6130d4a5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n, i, x, y, z, xSum = 0, ySum = 0, zSum = 0;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %d %d",&x,&y,&z);
xSum += x;
ySum += y;
zSum += z;
}
if (xSum != 0)
printf("NO");
else if(ySum != 0)
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 6a16768dcb477e93c4cb7bdef642a7ab | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
int main()
{
int x = 0 , y = 0 , z = 0 , numberOfForces = 0 , i = 0 , size = 0;
scanf("%d" , &numberOfForces);
size = numberOfForces * 3 ;
int array[size] ;
for (i = 0 ; i < size ; i++){
scanf("%d" , &array[i]);
}
i = 0 ;
while (i < size){
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 14cf39abb06b0546318d5dc75983b5e1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include<stdio.h>
int main()
{
int n,r1,r2,r3;
r1=0;
r2=0;
r3=0;
scanf("%d",&n);
int i,x,y,z;
for(i=0;i<n;i++){
scanf("%d %d %d",&x,&y,&z);
r1=r1+x;
r2=r2+y;
r3=r3+z;
}
if(r1==0&&r2==0&&r3==0){
printf("YES");
}
else {
printf("... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 6e471d8ffa36c696456d56c10bcc98cb | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
int main()
{
int n,i,x,y,z,sumx=0,sumz=0,sumy=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%d%d",&x,&y,&z);
sumx=sumx+x;
sumy=sumy+y;
sumz=sumz+z;
}
if(sumx==0 && sumy==0 && sumz==0)
{
printf("YES\n");
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | 74faab00601cdd6eb1a0b78e91c82cff | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include<stdio.h>
int main()
{
int n,a[100][100],i,j,c=0,c1=0,c2=1,c3=2;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
if(c1==0)
{
for(j=0;j<n;j++)
{
c=c+a[j][c1];
}
}
if(c==0)
... | |
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy... | Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not. | C | 8ea24f3339b2ec67a769243dc68a47b2 | db2dbe1a4f22a51f4dd967d6c4982e1c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1300809600 | ["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100). | ["NO", "YES"] | #include <stdio.h>
int main()
{ int n,x,y,z,i,sumx=0,sumy=0,sumz=0;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d %d %d", &x, &y, &z);
sumx=sumx+x;
sumy=sumy+y;
sumz=sumz+z;
}
if (sumx==0 && sumy==0 && sumz==0)
printf("YES");
else
printf("NO");
re... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 657149bf961b4e7179a2c73492709c60 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],b[n],i,j,temp;
long long int total=0,can=0;
for (i=0;i<n;i++){
scanf("%d",&a[i]);
total+=a[i];
}
for (i=0;i<n;i++){
scanf("%d",&b[i]);
}
for (i=0;i<2;i++){
for (j=i;j<n-i-1;j++){
... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | b0e80740794b87f7e86d70587b33d5c7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
int main(){
int n;
int big1=0, big2=0, nope;
scanf("%d", &n);
long long int a,b[1000100], sum = 0;
for(int i = 0; i < n; i++){
scanf("%d", &a);
sum += a;
}
for(int i = 0; i < n; i++){
scanf("%d", &b[i]);
if(b[i] > big2){
if(b[i] > big1){
big2 = big1;
big1 = b[i];
}else{
... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | c7859c74068ff2075476b20a6d7406dc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include<stdio.h>
int main ()
{
long long int c,b,p,i,q=0,k,l,n,a[100009];
scanf("%lld",&c);
for(i=0;i<c;i++) {
scanf("%lld",&b);
q=q+b;
}
for(i=0;i<c;i++)
scanf("%lld",&a[i]);
for(i=1;i<c;i++) {
if(a[0]<a[i])
{
k=a[0];
a[0]=a[i];
a[i]=k;
}
}
for(i=2;i<c;i++) {
if(a[1]<a[i]){
l=a[1];
... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | a643d84681f3c7f7457fe529ef7ced3a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main()
{
int n,i,a,b;
int64_t r=0 ;
scanf("%d",&n) ;
for(i=0;i<n;i++)
{
scanf("%d",&a);
r=r+a ;
}
int max1=0,max2=0;
for(i=0;i<n;i++)
{
scanf("%d",&b) ;
if(i%2==0)
{
i... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 6c0da6da92aa458ff24a1066103c44c1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{long long n,i;
long long max1=0;long long max2=0;long long sum=0;
//printf("Give the number of the cans: ");
scanf("%I64d",&n);
long long a[n];
long long b[n];
for (i=0;i<n;i++)
{//printf("Give the volume 'a' of the %dth can: \n",i+1);
scanf("%I6... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 3662b64a0b7b232944b01a677eb09bc7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{long long n,i;
long long max1=0;long long max2=0;long long sum=0;
//printf("Give the number of the cans: ");
scanf("%I64d",&n);
long long a[n];
long long b[n];
for (i=0;i<n;i++)
{//printf("Give the volume 'a' of the %dth can: \n",i+1);
scanf("%I6... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 9f0a139d52ec6f2e7542e982d7c5e9a4 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main() {
int n , counter ,sum=0,i,j;
unsigned int a[100000], b[100000];
char value=0;
// printf("Give me the number n\n");
scanf("%d",&n);
for(counter=0;counter<n;counter++){ //input
scanf("%d",&a[counter]);
}
for(counter=0;counter<n;coun... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | c255afc1fc55d819daf95e9977db7bf8 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
long long int a,sum=0,b1,b2;
for(i=0;i<n;i++)
{
scanf("%I64d ",&a);
sum+=a;
}
scanf("%I64d ",&b1);
scanf("%I64d ",&b2);
for(i=2;i<n;i++)
{
scanf("%d ",&a);
if(a>b1)
{b2=b1;b1=a;}
else if(a>b2)
b2=a;
}
if(sum<=b1+b2)
printf("YES\n... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | dc47beffc821588dccf9d5c0d09848cb | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
long long int a,sum=0,b1,b2;
for(i=0;i<n;i++)
{
scanf("%I64d ",&a);
sum+=a;
}
scanf("%I64d ",&b1);
scanf("%I64d ",&b2);
if(b1<b2)
{int c=b2;
b2=b1;
b1=c;}
for(i=2;i<n;i++)
{
scanf("%d ",&a);
if(a>b1)
{b2=b1;b1=a;}
else if... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | f41d9ecee0e87001a3059ab33b225dda | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long containers,i;
long long sum=0;
// printf("How many containers are there?\n");
scanf("%ld",&containers);
long A[containers];
for(i=0;i<containers;i++){
scanf("%ld",&A[i]);
sum+=A[i];
}
// printf("%ld\n",sum);
lon... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 6024dd226bbaa5126b53a5c59bcf5a3b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#define ll long long
int main()
{
ll n, a, b, i, max1 = -1, max2 = -1, sum = 0;
scanf("%lld", &n);
for(i=0;i<n;++i)
{
scanf("%lld", &a);
sum += a;
}
for(i=0;i<n;++i)
{
scanf("%lld", &b);
if(i == 0)
{
max1 = b;
}
else
{
if(b > max1)
{
max2 = max1;
max1 = b;
... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | f19cee255e1b0f6022bd4f66943ad377 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long A[100000],B[100000],max,max2,i,n;
long long sum;
int flag;
//printf("dwse arithmo doxeiwn\n");
scanf("%l64d",&n);
//printf("dwse thn periektikothta kathe doxeiou\n");
for(i=0;i<n;i++)
{
scanf("%l64d",&A[i]);
}
//pr... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 57aec091f65a087855a43d4d847c1d60 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long A[100000],B[100000],max,max2,i,n;
long long sum;
int flag;
//printf("dwse arithmo doxeiwn\n");
scanf("%l64d",&n);
//printf("dwse thn periektikothta kathe doxeiou\n");
for(i=0;i<n;i++)
{
scanf("%l64d",&A[i]);
}
//pr... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | a97edf68688a9bb10edf98e2e8a2e362 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long A[100000],B[100000],max,max2,i,n;
long long sum;
int flag;
//printf("dwse arithmo doxeiwn\n");
scanf("%l64d",&n);
//printf("dwse thn periektikothta kathe doxeiou\n");
for(i=0;i<n;i++)
{
scanf("%l64d",&A[i]);
}
//pr... | |
Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not! | Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes). You can print each letter in any case (upper or lower). | C | 88390110e4955c521867864a6f3042a0 | 7422916812e3d223c8a13728b4468bda | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy"
] | 1510929300 | ["2\n3 5\n3 6", "3\n6 8 9\n6 10 12", "5\n0 0 5 0 0\n1 1 8 10 5", "4\n4 1 0 3\n5 2 2 3"] | NoteIn the first sample, there are already 2 cans, so the answer is "YES". | PASSED | 900 | standard input | 2 seconds | The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans. The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 109) — volume of remaining cola in cans. The third line contains n space-separated integers that b1, b2, ..., bn (ai ≤ bi ≤ 109) — capacities of the c... | ["YES", "NO", "YES", "YES"] | #include <stdio.h>
#include <stdlib.h>
unsigned long long checktakin(unsigned long long x[],unsigned long long y)
{
unsigned long long a=0,a2=0;
unsigned long long b=0;
for(unsigned long long i =0;i<y;i++)
{
if(a<x[i]) { a=x[i]; b=i;}
}
for(unsigned long long i =0;i<y;i++)
... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | ef53a7963c2445481888f37d2110ff33 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | //463C.c
#include<stdio.h>
#include<string.h>
#define ll long long
ll arr[2005][2005],c[2005][2005];
ll sumlrx[2005],sumlry[2005],sumrlx[2005],sumrly[2005];
int main()
{
ll i,j,x,y,n,st,k,ans,p,q,r,s;
memset(sumlrx,0,sizeof(sumlrx));
memset(sumlry,0,sizeof(sumlry));
memset(sumrlx,0,sizeof(sumrlx));
... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 6278c4fc1db655fe7f5251e98d51be46 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | //463C.c
#include<stdio.h>
#include<string.h>
#define ll long long
ll arr[2005][2005],c[2005][2005];
ll sumlrx[2005],sumlry[2005],sumrlx[2005],sumrly[2005];
int main()
{
ll i,j,x,y,n,st,k,ans,p,q,r,s;
memset(sumlrx,0,sizeof(sumlrx));
memset(sumlry,0,sizeof(sumlry));
memset(sumrlx,0,sizeof(sumrlx));
... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 575f805acfea6fb5e148fd71ce63c206 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include<stdio.h>
#include<stdlib.h>
struct position{
long long value;
int x;
int y;
};
int compfun(const void *a,const void *b)
{
struct position *p=(struct position *)a;
struct position *q=(struct position *)b;
if(p->value > q->value)
return 1;
else if(p->value == q->value)
retur... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 988dc032b918e801c4b4d0256b2f827e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] |
#include <stdio.h>
int chessboard[2000][2000];
long long diagonal[4001], re_diagonal[4001], total, maximum[2] = {-1,-1};
int main(void)
{
int n,j,i;
int x[2], y[2],check;
scanf("%d",&n);
for (i=0; i<n; i++) {
for (j=0; j<n; j++) {
scanf("%d", &chessboard[i][j]);
di... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 60c8b6a5a1304306f0408b4d09349607 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | long long a[4000000],d[4000],e[4000],v,y,z;main(n,i,j,p,q,r,s){scanf("%d",&n);for(i=0;i<n;i++)for(j=0;j<n;j++)scanf("%d",a+i*n+j),d[i+j]+=a[i*n+j],e[i-j+n]+=a[i*n+j];y=z=-1;for(i=0;i<n;i++)for(j=0;j<n;j++)v=d[i+j]+e[i-j+n]-a[i*n+j],(i+j)&1?v>y?y=v,p=i,q=j:0:v>z?z=v,r=i,s=j:0;printf("%I64d\n%d %d %d %d",y+z,p+1,q+1,r+1,... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | f0eca0a2ddba48316b226b77c54ada81 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include <stdio.h>
int main()
{
long long int n, i, j, d1[4000001], d2[4000001], a[2001][2001];
scanf("%lld", &n);
for(i=1; i<=n; i++)
for(j=1; j<=n; j++)
{
scanf("%lld", &a[i][j]);
d1[i+j]+=a[i][j];
d2[i-j+n]+=a[i][j];
}
long long int one=-1, ... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 88826d165799eaace5af68bea22b262f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include<stdio.h>
long long int val,num1,num2,sol1=-1,sol2=-1,sol,max1,max2,a,x1,y1,x2,y2,in1,in2,ans,sum,s,c=1,n,arr[2010][2010],i,j,left[4010][3],right[4010][3];
int main()
{
scanf("%lld", &n);
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
{
scanf("%lld", &arr[i][j]);
}
}
for(i=1; i<=n; i++)
{
sum =0;
... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | fe93f91d24129ef293fbf6ecf827f2e7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include <stdio.h>
int b[2000][2000];
long long d1[4001], d2[4001], mv[2] = {-1, -1};
int mr[2], mc[2];
int main(void)
{
int i, j, n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &b[i][j]);
d1[i - j + n] += b[i][j];
d2[i + j] ... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 7792098b0252302817947f85840805f1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include <stdio.h>
long long a[2001][2001],v1[5000000],v2[5000000],x[]={1,2},y[]={1,1},p[2];
int main()
{
long long i, j, k, n, t, r;
scanf("%lld", &n);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
scanf("%lld",&a[i][j]);
v1[i+j]+=a[i][j];
v2[i-j+n]+=a[i][j];
}
for(i=0;i<n;i+... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | d993823ab0db1ebcc3f5097e95f49e65 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<time.h>
#include<ctype.h>
#include<limits.h>
#define eps 1e-7
#define ll long long int
#define N 2500
int board[N][N];
ll up[N][N];
ll low[N][N];
int main(){
int a,b,c;
scanf("%d",&a);
for(int i=1;i<=a;i++){
for(int w=1;w<... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.