prob_desc_description stringlengths 63 3.8k | prob_desc_output_spec stringlengths 17 1.47k ⌀ | lang_cluster stringclasses 2
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | lang stringclasses 7
values | prob_desc_output_to stringclasses 3
values | prob_desc_memory_limit stringclasses 19
values | file_name stringclasses 111
values | tags listlengths 0 11 | prob_desc_created_at stringlengths 10 10 | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_notes stringlengths 4 3k ⌀ | exec_outcome stringclasses 1
value | difficulty int64 -1 3.5k ⌀ | prob_desc_input_from stringclasses 3
values | prob_desc_time_limit stringclasses 27
values | prob_desc_input_spec stringlengths 28 2.42k ⌀ | prob_desc_sample_outputs stringlengths 2 796 | source_code stringlengths 42 65.5k | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 3305100d5db3e2e30a12304f466fa66a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include<math.h>
#include<string.h>
int main() {
int n,l=0;
char a[101];
int len;
scanf("%d",&n);
while(n--)
{
scanf("%d",&len);
scanf("%s",a);
l=0;
for(int i=0; i<len/2; i++)
{
if(a[i]==a[len-1-i] || (a[i]-a[len-1-i])==2 || a[i]-a[len-1-i]==-... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 7dbf5da413535ccd941414b0bc0285e8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
char s[110];
int n;
int pal(char s[],int n)
{
int flag=0;
for(int i=0;i<n/2;i++)
{
if(s[i]==s[n-i-1])
flag++;
}
if(flag==n/2)
return 1;
else
return 0;
}
int main(... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 9bc938366ba2e8d907180777c0d05c88 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <string.h>
int main(){
int t,a,n,i,c,bh,x;
scanf("%d\n",&t);
char str[10000];
while(t--){
scanf("%d",&n);
scanf("%s",str);
int a[n/2];
for(i=0;i<(n/2);i++){
x=(str[i]-str[n-i-1]);
if (x>0)
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | bbd7f955d5f52f8e96b702dd4855a82e | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int flag=0,l;
int check(char s[],int l)
{
char ch1[2],ch2[2];
for(int i=0;i<(l/2);i++)
{
ch1[0]=(char)(((int)s[i])+1);
ch1[1]=(char)(((int)s[i])-1);
ch2[0]=(char)(((int)s[l-i-1])+1);
ch2[1]=(char)(((int)s[l-i-1])-1);
// printf("HEy %c %c %c %c\n",ch1[0],ch1[1],ch2[0],c... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | c308783be4497f5086b8bf0b888d782d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t, n, i, j, diff;
scanf("%d", &t);
while (t != 0)
{
scanf("%d", &n);
char a[n];
int flag = 0;
scanf("%s", a);
for (i=0, j=(n-1); i<n && j>=0; i++, j--)
{
diff = abs(a[i] - a[j]);
if (diff != 2 && diff != 0)
{
flag = 1;
}
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | cbcb8c75079d3aaaf15098755c35b681 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t, n, i, j, diff;
scanf("%d", &t);
while (t>0)
{
scanf("%d", &n);
char a[n];
int flag = 0;
scanf("%s", a);
for (i=0, j=(n-1); i<n && j>=0; i++, j--)
{
diff = abs(a[i] - a[j]);
if (diff != 2 && diff != 0)
flag = 1;
}
if (flag... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 9f6b8e56044da5ac5410b85270f74996 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <math.h>
int main(void){
int t,T;
scanf("%d",&T);
for(t=1;t<=T;t++){
int n,i,an=0;
scanf("%d",&n);char a[n];
scanf("%s",a);
for(i=0;i<n/2;i++){
if(a[i]=='a'){if( a[n-1-i]=='a' || a[n-1-i]=='c')an++;}
else if(a[i]=='z'){if( a[n-1-i]=='z' || a[n-1-i]=='x' )an++;}
else {if(fabs(a... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | fd6f4df8a759aefcc78d49f3d162e9c2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int main(t)
{scanf("%d",&t);
int i,l,j,a,c,T[t];
for(i=0;i<t;i++)
{
c=1;
T[i]=0;
scanf("%d",&l);
char s[l+1];
scanf("%s",s);
for(j=0;j<(l/2);j++)
{
a=abs(s[j]-s[l-1-j]);
if(a==0 || a==2)
;
else
{
c=0;
break;
}
}
if(c)
T[i]=1;
}
for(i=0;i<t;i++)
if(T[i])
printf("YES\n");
else
pri... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 40726736c02892ad54bbe4c4b5e1b4da | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int i,j,x,c=0,t,k;
scanf("%d",&t);
for(k=0;k<t;k++)
{
scanf("%d",&x);
char a[x];
scanf("%s",&a);
for(i=0,j=x-1;i<x/2;i++,j--)
{
if( ( a[i]+1 != a[j]+1 ) && (a[i]-1 !=a[j]-1 ) && ( a[i]+1 != a[j]-1 ) && ( a[i]-1 !=a[j]+1 ) )
{
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 9f04dcfc80d73ca1f4c604e2798d8217 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int main(){
int t,c;
scanf("%d",&t);
for(int i=0;i<t;i++){
int l;
c=0;
scanf("%d",&l);
char s[l];
scanf("%s",s);
int n=l/2;
for(int j=0;j<n;j++){
int a=s[j];
int b=s[l-1-j];
if(a==b||a-1==b+1||a+1==b-1){
c=c+1;
}
}
if(c==n){
printf("YES\n");
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 4bf588e43f44678ac5e62aa7814f5ffa | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t,i,count=0,k,j;
scanf("%d",&t);
int a[t];
char b[t][200];
for(i=0;i<t;i++)
scanf("%d %s",&a[i],b[i]);
for(i=0;i<t;i++)
{
for(j=0,k=a[i]-1;j<a[i]/2;j++,k--)
{
if(b[i][j]==b[i][k] || abs(b[i][j]-b[i][k])==... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | c4478d7a4098a6fad27a483a575d3446 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int main(){
int t,c;
scanf("%d",&t);
for(int i=0;i<t;i++){
int l;
c=0;
scanf("%d",&l);
char s[l];
scanf("%s",s);
int n=l/2;
for(int j=0;j<n;j++){
int a=s[j];
int b=s[l-1-j];
if(a==b||a-1==b+1||a+1==b-1){
c=c+1;
}
}
if(c==n){
printf("YES\n");
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 1cc4ccad26edee630f3a6a7a3cd2c23a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int q;
scanf("%d", &q);
while(q--)
{
int n,i,t=1;
char s[101];
scanf("%d%s", &n, s);
for(i=0; i<(n/2); i++)
{
int d= (s[i]-s[n-i-1]);
if(d!=0 && d!=2 && d!=-2)
{
t=0;
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | bbe410ce3ddc403495674e8b199518b3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#define N 102
int main(){
int T;
scanf("%d",&T);
int n;
char s[N];
while(T--){
scanf("%d",&n);
scanf("%s",s);
int ok=1;
int i;
for(i=0;i<n/2;i++){
//printf("%d: %c %c\n",i,s[i],s[n-1-i]);
//df的例子两个字母可以相距2个,而不是1个
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 9354a4d4ef3164548cf57160bfcba1ed | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int main(){
int t;
scanf("%d",&t);
while(t--){
int n,l=0;
scanf("%d",&n);
char s[n];
scanf("%s",s);
int k=strlen(s);
for(int j=0;j<k/2;j++){
if(s[j]==s[k-j-1]||s[j]==s[k-j-1]+2||s[j]==s[k-j-1]-2){
l+=1;
}
}
if(l==k/2)printf("YES\n");
else printf("NO\n"... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | a93a32ae1ee5de763b1686adbf98298c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t,n,i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d\n",&n);
char x[n+1];
gets(x);
for(i=0,j=n-1;i<n/2;i++,j--) if(abs(x[i]-x[j])>2||abs(x[i]-x[j])==1) break;
if(i==n/2) printf("YES\n"); else printf("NO\n");
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | f51587e9c1b651f30d7ef5f98b6e17f8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,k,i,count;
scanf("%d",&n);
for(i=0;i<n;i++){
char c1,c2;
count=0;
scanf("%d",&k);
char str[k+1];
scanf("%s",str);
for(int j=0;j<k/2;j++)
{
c1=str[j];... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | e480e9b4d9857ad7578b795b928866d1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
char str[100];
int flag;
int check(int p,int n)
{
if(p>=n/2)
{ if(flag==1)
return 1;
else
return 0;
}
if( abs(str[p]-str[n-p-1] ) <= 2 && abs(str[p]-str[n-p-1]) != 1)
{
flag=1;
check(p+1,n);
}
else
{flag=0;
}
if(flag==1)
return 1;
else
retur... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 3c9597127a4cb82d4fb672bdc500303d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <stdlib.h>
int main (){
int t,n;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
char s[n];
int c=0,i,j;
scanf("%s",s);
for(i=0;i<n/2;i++){
j=abs(s[i]-s[n-1-i]);
if(j==2||j==0) c++;
}
if(c==n/2) printf("YES\n");
else printf("NO\n");
}
} | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 0bde167da197e9c301e0d84d0ffa33fa | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <stdlib.h>
int twist(char *str, int length) {
int lim=(length+1)/2,diff;
for (int i=0; i<lim; i++) {
diff=abs(str[i]-str[length-1-i]);
if (diff>2 || diff==1) return 0;
}
return 1;
}
int main() {
int queries,len;
char word[100];
scanf("%d\n",&querie... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 34e83710aa235669fcf21d106e075ee1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(void)
{
int i,t;
scanf("%d",&t);
for(i=0;i<t;i++)
{
int size;
scanf("%d",&size);
int flag=0;
char st[100];
scanf("%s",st);
int start=0,end=size-1;
while(start<=end)
{
if(st[start] =='a')
if(st[end]!='a'&&st[end]!='c')
{flag=1... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 1005650f5a663a3466163b6579e64ad2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,n,count=0;
scanf("%d",&n);
char a[n];
scanf("%s",a);
for(i=0;i<n/2;i++)
{
if(a[i]==a[n-1-i])
count++;
else if ( (a[i]==a[n-1-i]+2) || (a[n-1-i]==a[i]+2) )
count++;
}
if(count==(n/2)) printf(... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 8fc7e662000a29189e4a71862a5ae559 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
int t,j;
scanf("%d",&t);
while(t--)
{
int n,flag=1;
char str[100];
scanf("%d",&n);
int start=0,end=n-1;
scanf("%s",str);
while(start<end)
{
if(str[start]!=str[end])
{
int c=str[start];
int d=str[end];
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 0b46529980f5dfba4cfb13fecfdac1c1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main(){
int n,k,i;
int o;
scanf("%d",&n);
for(i=0;i<n;i++){
o=0;
scanf("%d",&k);
char s[k+1];
scanf("%s",s);
for(int j=0;j<k/2;j++){
char a=s[j];
char b=s[k-j-1];
if(!(a==b || a-b==2 || b-a==2)){
o++;
}
}
if(o>0){
printf("NO\n");
}else{printf("YES\n");};
}
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 25d58409a7ba7624aa008df9fa805726 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main(){
int n,k;char a[1000];
scanf("%d",&n);
while(n!=0){
int i,j,flag;
scanf("%d",&k);
i=0;j=k-1;
scanf("%s",a);
while(i<j){
flag=1;
if(((a[i]+1)!=(a[j]+1))&&((a[i]-1)!=(a[j]-1))&&((a[i]+1)!=(a[j]-1))&&((a[i]-1)!=(a[j]+1))){
flag=0;
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 86402fb7366ee9b3965bb5c1e1785282 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int a,b,c,n,i,j,k,l;
char s[250];
scanf("%d",&n);
for(i=0;i<n;i++)
{
j=0;
scanf("%d",&b);
scanf("%s",s);
for(c=0,l=b-1;c<=b/2-1;c++,l--)
{
if(s[c]-1==s[l]-1)
j++;
else if(s[c]+1==s[l]+1)
j++;
... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | b7f0af5dff1ea2a135ca1b28718091d9 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <string.h>
#include <math.h>
int main ()
{
int h,t,a[1000];
scanf("%d",&t);
for(h=0;h<t;h++)
{
int n;
scanf("%d",&n);
char st[n+1];
scanf("%s",st);
//printf("%d\n",n);
int cnt=0;
for(int i=0;i<n/2;i++)
{
if(st[i]=='a')
{if(st[i]==st[n-i-1]||st[n-i-1]-st[i]==2)
cnt++;}
else if(st[i]=='z')
{i... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | abdea3e2f50f21d62a33a164afaeff85 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] |
#include<stdio.h>
#include<string.h>
int main( ){
int s;
scanf("%d",&s);
for(int i=0;i<s;i++){
int x;
scanf("%d",&x);
char a[x];
scanf("%s",a);
int f=0;
for(int i=0;i<x/2;i++){
if((a[i]!=a[x-1-i])&&(abs(((a[x-1-i]-a[i])))!=2)){
f=1;
}
}
if(f==1){... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 3b92165568b5f2c77bad34f23f6da8ea | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main(void){
int a;
scanf("%d",&a);
while(a--){
int b;
scanf("%d",&b);
char c[b+1];
scanf("%s",c);
int i=0,j=b-1,k=1;
while(i<j){
if(c[i]-c[j]!=2 && c[j]-c[i]!=2 && c[i]!=c[j]){
printf("NO\n");
k... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | a498dedd4b30b08d010768e8226c0c8c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
char a[n+2];
scanf("%s",a);
int k=0;
for(int i=0,j=n-1;i<j;i++,j--)
{
if(a[i]==a[j]||a[i]-a[j]==2||a[i]-a[j]==-2)
{
k++;
}
}
if(k==n/2)
{
printf("YES\n");
}
else
{
printf("NO\n");... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 38ea599c749c5cde0c40fed739c6981c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<string.h>
int main()
{
int f,k;
scanf("%d\n",&k);
while(k>0)
{
scanf("%d\n",&f);
char s[f];
int q;
gets(s);
int d=strlen(s),i=0,z=0,n,m;
int j=d-1;
while(i!=j&&i<=(d/2)&&j>=(d/2))
{
n=(int)s[i];
m=(int)s[j];
if(m==n||(m+1)==(n+1)||(m-1)==(n-1)||(m+1)==(n-1)||... | |
You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. $$$n$$$ is even.For each position $$$i$$$ ($$$1 \le i \le n$$$) in string $$$s$$$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (letters 'a' and 'z' have only one o... | Print $$$T$$$ lines. The $$$i$$$-th line should contain the answer to the $$$i$$$-th string of the input. Print "YES" if it's possible to make the $$$i$$$-th string a palindrome by applying the aforementioned changes to every position. Print "NO" otherwise. | C | cc4cdcd162a83189c7b31a68412f3fe7 | 641f1974b9413557a4dc0041395ccab3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"strings"
] | 1534602900 | ["5\n6\nabccba\n2\ncf\n4\nadfa\n8\nabaazaba\n2\nml"] | NoteThe first string of the example can be changed to "bcbbcb", two leftmost letters and two rightmost letters got changed to the next letters, two middle letters got changed to the previous letters.The second string can be changed to "be", "bg", "de", "dg", but none of these resulting strings are palindromes.The third... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of strings in a testcase. Then $$$2T$$$ lines follow — lines $$$(2i - 1)$$$ and $$$2i$$$ of them describe the $$$i$$$-th string. The first line of the pair contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$, $$$n$$$ is even) — th... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int isPalindrome(char string[],int size) {
int check=0,i,j;
if(size<=1)
return 1;
for(i=-1;i<2;i+=2) {
for(j=-1;j<2;j+=2) {
if((string[0]+i)==(string[size-1]+j))
check=1;
}
}
if(check)
return isPalindrome(string+1,size-2);
else
return 0;
}
int main(void) {
int T,n;
for(scanf... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 091e6aaf77619df5ce2645566bd7ecc6 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main(){
int n;
int x,y,z;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d %d",&x,&y,&z);
if(x==y&&y==z)
printf("YES\n%d %d %d\n",x,y,z);
else if((x==y)&&(x>z))
printf("YES\n%d %d 1\n",x,z);
else if((y==z)&&(y>x))
... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 7d3d222869b1c9fb04274a81ba03b7b1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
int t,m;
scanf("%d",&t);
long long x,y,z;
long long a[t],b[t],c[t],r[t];
for(int i=0;i<t;i++)
{
scanf("%lld %lld %lld",&x,&y,&z);
if(x==y&&y==z)
{
m=1;
a[i]=x;
b[i]=y;
c[... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 5159b16deb0f62580624574347bc68ec | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include <stdio.h>
void max(int x, int y, int z) {
int a = -1;
int b = -1;
int c = -1;
if (z > x && z > y) {
fprintf(stdout, "NO\n");
return;
}
if (x == z && z == y) {
a = x;
b = x;
c = x;
} else {
if (x > y) {
a = y;
... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | e92b29f232f9051b1e6f1f5487b19356 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main()
{
long long int t,x,y,z;
scanf("%lld",&t);
while(t>0)
{
scanf("%lld %lld %lld",&x,&y,&z);
if(x==y && x>=z|| y==z && z>=x || z==x && z>=y)
{
printf("YES\n");
if(x==y && x>=z)
printf("%lld %lld %lld\n",x,z,z);
else if(z==y && z>=x)
print... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 0ed1a48688aab950d82ddb50d8bee5c6 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main()
{
int t,x,y,z;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&x,&y,&z);
if(x!=y && y!=z && z!=x){
printf("NO\n");
}
else if(x==y && y==z){
printf("YES\n");
printf("%d %d %d\n",x,y,z);
}
else if(x==... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | a384ac6731eb8d6dc0cc9cdb793a8a8d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main(){
int t,s;
int x,y,z;
scanf("%d",&t);
for(s = 0; s < t; s++){
scanf("%d %d %d",&x,&y,&z);
if(x>y && x == z){
printf("YES\n%d %d %d\n",x, y, y);
}
else if(y>x && y == z){
printf("YES\n%d %d %d\n",y, x, x);
}
else if(x == y && y > z){
printf("YES\n%d %d %d\n",x,z,z);
... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 11343bf91b2db777cd031d658a544842 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
void sort(int a[]){
for(int i = 0; i < 3; i++){
for(int j = 2; j > i; j--){
if(a[i] < a[j]){
int temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
}
// for(int i = 0; i < 3; i++){
// printf("%d\n", a[i]);
// }
}
int main(){
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 33c2b2e2b944f32b71459bcdabed834c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main(){
int t;
long long int x,y,z;
scanf("%d",&t);
while(t!=0){
scanf("%lld%lld%lld",&x,&y,&z);
if(x==y){
if(x>=z){
printf("YES\n");
printf("%lld\t%lld\t%lld\n",x,z,z);
}
else{
printf("NO\n");
}
}
else if(y==z){
if(y>=x){
printf("YES\n");
printf("%lld\t%lld\t%lld\n",y,x,x);
}
else{
printf("NO\n")... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 5ee5ddeb4299d993a7e6f3d1a0c1afb4 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long int x, y, z, max, min;
scanf("%ld %ld %ld",&x,&y,&z);
if(x!=y && x!=z && y!=z)
{
printf("NO\n");
}
else if(x==y && y==z)
{
printf("YES\n");
printf("%ld %ld %ld\n",x,y,z);
}
else
{
if(x>=y && x>=z)
{
max=... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 13fc48734cd77238e139bf78dce2c4df | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int a[3];
for(int i=0;i<3;i++)
{
scanf("%lld",&a[i]);
}
int t;
for(int i=0;i<2;i++)
{
for(int j=i+1;j<3;j++)
{
if(a[j]<... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 1818723e3461ee6cb4bfd0ee07837bb6 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main()
{
int a,b,c,x,y,z,t,k;
scanf("%d",&t);
for (k=0 ; k < t ; k++)
{
scanf("%d %d %d",&x,&y,&z);
if (x>1000000000 || x<=0)
printf("NO\n");
els... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 8eb39fd5ac7af11b7a63008143949722 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
#include<stdlib.h>
typedef long long int lli;
int main() {
int testcases;
scanf("%d", &testcases);
while(testcases--){
lli x,y,z;
scanf("%lld %lld %lld", &x, &y, &z);
if(x==y && y==z){
printf("YES\n");
printf("%lld %lld %lld\n", z,z,z);
}
else if... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 72f7dca62a0ee98e65eafa1896f5270b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
unsigned long long int a,b,c;
unsigned long long int t,x,y,z,i;
void word(void);
int main()
{
scanf("%llu",&t);
for(i=1 ;i<=t ;i++)
{
scanf("%llu %llu %llu",&x,&y,&z);
if((x==y)||(y==z)||( x==z))
{
if(y==z && y>x) {a=z; b=x; c=x-1; word();}
else if(y==x && y>z) {a=y... | |
You are given three positive (i.e. strictly greater than zero) integers $$$x$$$, $$$y$$$ and $$$z$$$.Your task is to find positive integers $$$a$$$, $$$b$$$ and $$$c$$$ such that $$$x = \max(a, b)$$$, $$$y = \max(a, c)$$$ and $$$z = \max(b, c)$$$, or determine that it is impossible to find such $$$a$$$, $$$b$$$ and $$$... | For each test case, print the answer: "NO" in the only line of the output if a solution doesn't exist; or "YES" in the first line and any valid triple of positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 10^9$$$) in the second line. You can print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. | C | f4804780d9c63167746132c35b2bdd02 | 700b17cd0e59e9039f261ebce0b529ad | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1594996500 | ["5\n3 2 3\n100 100 100\n50 49 49\n10 30 20\n1 1000000000 1000000000"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$x$$$, $$$y$$$, and $$$z$$$ ($$$1 \le x, y, z \le 10^9$$$). | ["YES\n3 2 1\nYES\n100 100 100\nNO\nNO\nYES\n1 1 1000000000"] | #include<stdio.h>
int g[5];
int main()
{
int t;
scanf("%d",&t);
while(t--){
int x,y,z;
int a,b,c;
int i;
scanf("%d%d%d",&x,&y,&z);
if(x==y && y==z)
{
printf("YES\n%d %d %d\n",x,y,z);
goto end;
}
a=x;
b=y;
c=z;
if(a==b)
a=a/b;
if(b==c)
b=b/c;
if(c==a)
c=c/a;
i=0;
g[i]=a>=b?a:b;
i++;
g[i]=a>=... | |
«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page numbers that he wants to print out (separates them with a comma, without spaces).Your task is to wri... | Output the sequence in the required format. | C | 3969ba3e3eb55a896663d2c5a5bc4a84 | b6e84b17feaba2e03952931f6c6750db | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings",
"expression parsing",
"strings"
] | 1286802000 | ["1,2,3,1,1,2,6,6,2", "3,2,1", "30,20,10"] | null | PASSED | 1,300 | standard input | 2 seconds | The only line contains the sequence, keyed by the user. The sequence contains at least one and at most 100 positive integer numbers. It's guaranteed, that this sequence consists of positive integer numbers, not exceeding 1000, separated with a comma, doesn't contain any other characters, apart from digits and commas, c... | ["1-3,6", "1-3", "10,20,30"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
char bigstr[600];
//int my_array[] = { 10, 5, 25, 15, 20, 30 };
int comparetor (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
char str[1000];
char c;
int a[1000];
int s,i,j,b,k,l,prev,last;
s=0;
i=0;
b=0;... | |
«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page numbers that he wants to print out (separates them with a comma, without spaces).Your task is to wri... | Output the sequence in the required format. | C | 3969ba3e3eb55a896663d2c5a5bc4a84 | 33a597630706b15f4178f6750f593866 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings",
"expression parsing",
"strings"
] | 1286802000 | ["1,2,3,1,1,2,6,6,2", "3,2,1", "30,20,10"] | null | PASSED | 1,300 | standard input | 2 seconds | The only line contains the sequence, keyed by the user. The sequence contains at least one and at most 100 positive integer numbers. It's guaranteed, that this sequence consists of positive integer numbers, not exceeding 1000, separated with a comma, doesn't contain any other characters, apart from digits and commas, c... | ["1-3,6", "1-3", "10,20,30"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 499
#define K 100
int compare(const void *a, const void *b) {
int ia = *(int *) a;
int ib = *(int *) b;
return ia - ib;
}
int main() {
static char s[N + 1];
static int aa[K], ll[K], rr[K];
int n, i, j, k, x;
scanf("%s", s);
n = strlen(s);... | |
«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page numbers that he wants to print out (separates them with a comma, without spaces).Your task is to wri... | Output the sequence in the required format. | C | 3969ba3e3eb55a896663d2c5a5bc4a84 | 11f1f215bfe2fe55fa73c802070fb247 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings",
"expression parsing",
"strings"
] | 1286802000 | ["1,2,3,1,1,2,6,6,2", "3,2,1", "30,20,10"] | null | PASSED | 1,300 | standard input | 2 seconds | The only line contains the sequence, keyed by the user. The sequence contains at least one and at most 100 positive integer numbers. It's guaranteed, that this sequence consists of positive integer numbers, not exceeding 1000, separated with a comma, doesn't contain any other characters, apart from digits and commas, c... | ["1-3,6", "1-3", "10,20,30"] | /* https://codeforces.com/contest/34/submission/20931503 (rainboy) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define A 1000
int main() {
static char s[1024], good[A + 1], *t, cc[1048576], *p = cc;
int k, l, r, first;
scanf("%s", s);
k = 0;
for (t = strtok(s, ","); t != NULL; t = strtok(NULL,... | |
«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page numbers that he wants to print out (separates them with a comma, without spaces).Your task is to wri... | Output the sequence in the required format. | C | 3969ba3e3eb55a896663d2c5a5bc4a84 | d846ce5ed0fafa499821512a2c52af72 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings",
"expression parsing",
"strings"
] | 1286802000 | ["1,2,3,1,1,2,6,6,2", "3,2,1", "30,20,10"] | null | PASSED | 1,300 | standard input | 2 seconds | The only line contains the sequence, keyed by the user. The sequence contains at least one and at most 100 positive integer numbers. It's guaranteed, that this sequence consists of positive integer numbers, not exceeding 1000, separated with a comma, doesn't contain any other characters, apart from digits and commas, c... | ["1-3,6", "1-3", "10,20,30"] | #define TYPE int
#define CMP(a, b) (b-a)
//#define LOG(a) fprintf(LOGFILE, "%d", a)
/*quirinpa gist.github.com*/
#ifndef AVL_H
#define AVL_H
/* creates a mask that can be applied each time we need to invert
* a value depending on the boolean that was provided
* to new_bool_inv_mask(bool) aka bool?value:-value, this
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 77993338414f9c25503b00adea887895 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] |
#include <stdio.h>
int main(void) {
int t;
scanf("%d",&t);
while(t--){
int n,c=0;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%2!=0)
c++;
}
if((c==n && n%2==0) || c==0)
printf("NO\n");
else
printf("YES\... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 48fef790564c208ce2512f91d33abc40 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int i,n,t,a,sum,det1,det2,j;
scanf("%d", &t);
for(i=0;i<t;i++)
{
scanf("%d", &n);
sum=det1=det2=0;
for(j=0;j<n;j++)
{
scanf("%d", &a);
if(a%2==0)det1=1;
else det2=1;
sum+=a;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 37c849ffe9481e7b8081f9a9c2e230b8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t,n,a[2000],i,c=0,k=0,flag=0;
scanf("%d",&t);
while(t--)
{
flag=0;
c=0;
k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
if(n%2==0)
{
for(i=0;i<n;i++)
{
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 7bdb8dd1c19f16fc20bf85be4a1468ad | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int a,b,sum,count;
scanf("%d",&a);
for(int i=0;i<a;i++)
{ sum=0,count=0;
scanf("%d",&b);
int s[b];
for(int j=0;j<b;j++)
{
scanf("%d",&s[j]);
sum+=s[j];
if(s[j]%2!=0)
count++;
}
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | f908b7789741018c871f16576d2954ae | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
for (int i=0;i<t;i++)
{
int n;
scanf("%d",&n);
int a[n];
int e=0,o=0;
for (int j=0;j<n;j++)
{
scanf("%d",&a[j]);
if (a[j]%2==0)
e++;
else
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 4216ca2fef3aa65423ed9c7520672b6d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
int main(){
int n;
scanf("%d", &n);
while(n--){
int a, odd = 0, even = 0;
unsigned long long int toplam = 0;
scanf("%d", &a);
int arr[a];
for(int i = 0; i < a; i++){
scanf("%d", &arr[i]);
if(arr[i... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 185f165583f43535ea807105afac7814 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i,j,l;
scanf("%d\n",&n);
for(int k=0;k<n;k++)
{ int o=0,e=0;
scanf("%d\n",&l);
int *a=(int*)calloc(l,sizeof(int));
for(int m=0;m<l;m++)
{
scanf("%d",a+m);
if(*(a+m)%2!=0)
o++;
else
e++;
}
if(o==0)
printf("NO\n");
else if(o... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | f208eb72c2b023c166770dab59cd70d3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t,n,i,a[2000],x=0;
scanf("%d",&t);
while(t>0){
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&a[i]);
if(a[i]%2!=0)
x=x+1;
}
if((n==x&&n%2==0)||x==0){
printf("NO\n");
}
else{... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 65f1c3d3091b631a849adee64ce8bbac | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t,n,a[2000],i,c,s;
scanf("%d",&t);
while(t--)
{
c=0;s=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
s=s+a[i];
if(a[i]%2==0)c++;
}
if(s%2!=0)printf("YES\n");
else
{
if(n-c>0 && c!=0)printf("YES\n");
else printf("NO\n");
}
}
}
| |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 228c589bd1de3b1b641db45a141048d3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int i,j,t,n,k;
scanf("%d",&t);
while(t--)
{
int sum=0,y=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&k);
sum+=k;
if(k%2==0)
y++;
}
if(sum%2==1)
printf("YES\... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 5eed41db561b4b072226e70c08957c22 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int T,t,i,j,n,s;
scanf("%d",&T);
while(T--){
s=0;
t=0;
scanf("%d",&n);
int ara[n];
for(i=0;i<n;i++){
scanf("%d",&ara[i]);
s=s+ara[i];
}
if(s%2!=0)
t=1;
else{
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | bf7219e9ce3ecc425b01d6ae15a84f9b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int T,t,i,j,n,s;
scanf("%d",&T);
while(T--){
s=0;
t=0;
scanf("%d",&n);
int ara[n];
for(i=0;i<n;i++){
scanf("%d",&ara[i]);
s=s+ara[i];
}
if(s%2!=0)
t=1;
else{
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | dbbf436feef795eab299983a60ab6809 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
int ktra(int a[], int n) {
int x=0, y=0;
for (int i=0; i<n; ++i) {
if (a[i]%2==0) x=1;
else y=1;
}
if (n%2!=0 && x==0) return 1;
else if (x>=1 && y>=1) return 1;
return 0;
}
int main (){
int n ;
scanf("%d",&n);
for (int i=1;i<=n;i++){
int m;
scanf ("%d",&m);
int a[m+5];
for (int ... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 1a4c76b3c9880aaadb7d2ab6b755f503 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main(){
int n,i,t,el,k,even,odd;
char temp;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
odd=0;
even=0;
scanf("%d",&t);
for(k=0;k<t;k++){
scanf("%d%c",&el,&temp);
if( el%2 == 0 )
even++;
if( el%2 == 1 )
odd++;
}
if(even==t || (odd==t && t%2==0) ... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | a1de8be0373f309dea01150f424628e7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t, n, a[2010], i, j, odd, even;
scanf("%d", &t);
while(t--){
odd=0;
even=0;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &a[i]);
if(a[i]%2!=0)
odd++;
else
even++;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 33ce3994ed56d99b8ad8e97d2ff8b8b2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
int i,ara[n];
int sum=0,odd=0,even=0;
for(i=0;i<n;i++)
{
scanf("%d",&ara[i]);
if(ara[i]%2!=0||ara[i]==1)
{
odd++;
}
else{
e... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | 1fd0ce5567d791c2ac2308bf1da1cafa | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include <stdio.h>
int main()
{
int x,o,e;
scanf("%d",&x);
int y,z,arr[2020],sum,c,j,sum1;
for(int i=0; i<x; i++)
{
sum=0;
c=0,o=0,e=0,sum1=0;
scanf("%d",&y);
for( j=0; j<y; j++)
{
scanf("%d",&z);
arr[j]=z;
sum+=z;
}... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integers.In one move, you can choose two indices $$$1 \le i, j \le n$$$ such that $$$i \ne j$$$ and set $$$a_i := a_j$$$. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is th... | For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise. | C | 2e8f7f611ba8d417fb7d12fda22c908b | ce7d82189a79c3fe08923100fe3aebb0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1580826900 | ["5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in $$$a$$$. The second line of the test case contains ... | ["YES\nNO\nYES\nNO\nNO"] | #include<stdio.h>
int main() {
int n, a, b, c ,d, j,m,l, temp;
scanf("%d",&c);
for (int j = 0; j <c ; ++j) {
scanf("%d",&n);
l=0;
for (int i = 0; i < n; i++) {
scanf("%d",&a);
if(a%2!=0)
l++;
}
if (l==n&&n%2==0||l==0){
printf("NO\n");
}
else{
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 747fc9f697eb0f8454a21a4890b62b5d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #pragma warning (disable: 4996)
#include <stdio.h>
#include <stdio.h>
int main(void)
{
int n, p, q, k, ps, qs, did, m, j, l;
char str[101];
scanf("%d %d %d", &n, &p, &q);
scanf("%s", str);
k = 0;
ps = 0;
qs = 0;
m = n;
while (n > 0)
{
did = 0;
if (n % p... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 983795ea5645a4d490e90e40e519c8a3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main()
{
int n,q,p,i,j,m,k,l,trouve=0;
scanf("%d %d %d",&n,&p,&q);
char s[150];
scanf("%s",&s);
if(q+p==n){
trouve=1;
printf("2\n");
for(i=0;i<p;i++)
printf("%c",s[i... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 011fa852e7905ef740e613fc2ac7788f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include<stdio.h>
int main()
{
int a,b,c;
char niz[500];
int p,q,s;
scanf("%d%d%d",&p,&q,&s);
getchar();
gets(niz);
int stop=0;
int indikator=0;
for(a=0;a<100;a++){
for(b=0;b<100;b++){
if( ( (a*q) + (b*s) ) == p){
indikator=1;
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | d6cc603a7c293ed7cc7e87845299f21f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,p,q,i=0,j,a,b,c=0;
scanf("%d%d%d",&n,&p,&q);
char A[n+1];
scanf("%s",A);
if((p+q)==n){
printf("2\n");
for(i=0;i<p;i++){
printf("%c",A[i]);
}
printf("\n");
for(i=p;A[... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 7ed11c5561c018fa93e4f85b4ab3a1b3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include<stdio.h>
#include<string.h>
int main()
{
int a,b,c,i,j,k=-1,n=0,t,w;
scanf("%d%d%d",&a,&b,&c);
char str[a+1];
scanf("%s",str);
if(b+c==a)
{ puts("2");
for(i=0;i<b;i++)
{
printf("%c",str[i]);
}
printf("\n");
for(i=b;i<a;i++)
{
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 782dbb89d7cb6f6d76b164755a19213a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | /* Coached by rainboy */
#include <stdio.h>
int main() {
static char s[128];
int n, p, q, k, l, h, i;
scanf("%d%d%d%s", &n, &p, &q, s);
l = -1;
for (k = 0; k * p <= n; k++)
if ((n - k * p) % q == 0) {
l = (n - k * p) / q;
break;
}
if (l == -1) {
printf("-1\n");
return 0;
}
printf("%d\n", k + l);... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 43b7e98d2c4b9ee62a5b68b595570b6d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
int main(void) {
int n,p,q;
scanf("%i %i %i\n",&n,&p,&q);
int f=0;
int t=0;
int j=0;
int odd;
int choto;
int v;
if(n%p==0){
t=n/p;
j=p;
}
else{
if(n%q==0){
t=n/q;
j=q;
}
else{
if(n==(p+q)){
t=2;
f=1;
}
else{
if(p+q<n){
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | dcd76faa89990bad6b482701b38b5a4b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
#include <stdlib.h>
int main(){
int n,p,q,i;
char str[200]={0};
scanf("%d%d%d",&n,&p,&q);
getchar();
fgets(str,200,stdin);
if(str[n]=='\n')str[n]='\0';
int first=0,second=0;
for(i=0;i<=n/p;i++){
int other=n-p*i;
if(other<0) break;
if(other==0)... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 11f8b0dbcd630e586d1e82fea0c9a648 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
int x,y;
int s,p;
int dp(int n)
{
int i,d,n2;
for(i=0;i<=n;i++)
{
d=i*s;
n2=n-d;
if(n2<0)break;
if(n2%p==0)
{
x=i;
y=n2/p;
return 1;
}
}
return 0;
}
int main()
{
int n;
int i,k=0,j,a, b;
scanf("%d %d %d\n",&n,&s,&p);
if(dp(n))
{
char input[150];
fgets(input,120,s... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | b071c95f3e46526afd7be655ac68409c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
int main()
{
int i ,q,p,n,j;
scanf("%d %d %d",&n,&p,&q);
char str[n+1];
scanf("%s",str);
if (n%p==0)
{
printf("%d\n",n/p);
for(i=0; i<n; i++)
{
if(i%p==0&&i!=0)
printf("\n");
printf("%c",str[i]);
}
}... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 9beca48f3a39a7fc31764842e6a666df | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
int main()
{
int n, p, q, flg = 0;
scanf("%d %d %d", &n, &p, &q);
char str[101] = { 0 };
scanf("%s", str);
int P = n / p, Q = n / q;
for (int i = 0; i <= P; i++) {
for (int j = 0; j <= Q; j++) {
if (i * p + j * q != n) continue;
flg = 1;
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 147a4e8522071f3c8b2fd71ebc154a34 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include<stdio.h>
#include<string.h>
int main()
{
char str[1010];
int n,p,q,i,x,y,j,aux;
scanf("%d%d%d",&n,&p,&q);
scanf("%s",str);
if(n%p==0){
printf("%d\n",n/p);
for(i=1;i<=n;i++){
printf("%c",str[i-1]);
if(i%p==0)printf("\n");
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | e035bf64e2f875285d28067a5ad16d61 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include<stdio.h>
#include<string.h>
int main()
{
char str[1010];
int n,p,q,i,x,y,j,aux;
scanf("%d%d%d",&n,&p,&q);
scanf("%s",str);
if(n%p==0){
printf("%d\n",n/p);
for(i=1;i<=n;i++){
printf("%c",str[i-1]);
if(i%p==0)printf("\n");
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 8cf7261c1912b98fb7a7b20280bdae85 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
#define SIZE 1000
int main()
{
int n, p, q, i, j;
int cnt = 0;
char s[SIZE];
// freopen("input.txt", "r", stdin);
scanf("%d %d %d\n", &n, &p, &q);
gets(s);
while (n % q != 0 && n >= p) {
++cnt;
n -= p;
}
if (n % q != 0)
puts("-1");
else {
printf("%d\n", cnt + n / q);
for (i =... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | a0fd340e6cc449fe5acd21f98dee979b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
int main()
{
int n,p,q,k=0,c=0,x,y,ant1,ant2;
char s[100];
scanf("%d %d %d",&n,&p,&q);
scanf("%s",&s);
if (n%p==0)
{
printf("%d\n",n/p);
for (int j=0;j<n;j++)
{
printf("%c",s[j])... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | c33df6c78189be2000596433f2bf6385 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
#include <string.h>
int minmax(int a, int b, int *min, int *max)
{
*max=a>b?a:b;
*min=a<b?a:b;
}
int main()
{
int n,p,q,i,j,k,m;
char s[1000];
scanf("%d %d %d",&n,&p,&q);
scanf("%s",&s);
int duzina=strlen(s);
int brojac=0;
int brDelova=0;
int min, max;
int ... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | b1c2ed7fd9f859598193de2f4724f549 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
#include <string.h>
#define SIZE 150
int main()
{
int n, p, q, i, cnt_p, cnt_q, flag_1 = 0, flag_2 = 0;
char s[SIZE];
scanf("%d %d %d\n", &n, &p, &q);
gets(s+1);
for (i = 1; i <= n; i++)
if (i % p == 0 && (n - i) % q == 0) {
flag_1 = 1;
break;
... | |
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".Note it is allowed to split the string s to the strings only of length p or to ... | If it's impossible to split the string s to the strings of length p and q print the only number "-1". Otherwise in the first line print integer k — the number of strings in partition of s. Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be ... | C | c4da69789d875853beb4f92147825ebf | 68f029e508ec2b32c6df1159c05a9d25 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"strings"
] | 1451055600 | ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac"] | null | PASSED | 1,300 | standard input | 1 second | The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100). The second line contains the string s consists of lowercase and uppercase latin letters and digits. | ["2\nHe\nllo", "2\nCodef\norces", "-1", "8\na\nb\na\nc\na\nb\na\nc"] | #include <stdio.h>
int main(){
int n,p,q,p2,q2,tt=0;
scanf("%d%d%d",&n,&p,&q);
p2=p;
q2=q;
char kelime[n];
scanf("%s",kelime);
int i,j=0,j2=0;
if(p+q==n){
printf("2\n");
for(i=0;i<p;i++){
printf("%c",kelime[i]);
}
printf("\n");
for(i=p;i<n;i++){
printf("%c",kelime[i]);
}
return 0;
}else if... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | 9de8e4b6f3fd04284ba288cf781a2c86 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include"stdio.h"
char cmmd[100100];
main()
{
long long n;
int t;
long long st,pos;
char *s;
scanf("%I64d%d",&n,&t);
while (t--){
scanf("%I64d%s",&st,&cmmd);
s=cmmd;
while (*s){
pos=st&(-st);
switch (*s){
case 'L' :{
st-=(pos>>1);
}break;
case 'R' :{
st+=(pos>>1);
}break;
defau... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | 6755a8a87a623a2231b4a94f9442c6d6 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
typedef long long unsigned int u64;
#define getlevel __builtin_ctzll
u64 n, q;
u64 go(char move, u64 v) {
int level = getlevel(v);
u64 testl, testr;
switch(move) {
case 'U':
if(v == n >> 1ULL) return v;
if(v == 1ULL) return 2;
if(v == n - 1ULL) ... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | f221575a955c53a037f44732582fa221 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
#include <string.h>
int count(long long x) {
return x % 2 == 1 ? 0 : 1 + count(x / 2);
}
int main() {
long long n;
int q, k;
scanf("%lld%d", &n, &q);
k = count(n + 1);
while (q-- > 0) {
static char cc[100001];
long long u;
int b, l, i;
scanf("%lld", &u);
scanf("%s", cc);
l = str... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | b826b5fbb62c391dbf01cc057790b4bd | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
#include <string.h>
int main() {
long long n;
int q;
scanf("%lld%d", &n, &q);
while (q-- > 0) {
static char s[100001];
long long u;
int b, l, i;
scanf("%lld", &u);
scanf("%s", s);
l = strlen(s);
b = 0;
while ((u & (1LL << b)) == 0)
b++;
b--;
for (i = 0; i < l; i++)
if... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | 20cda2bda0a304078c40011774d59de3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
#include <string.h>
#define LB(X) ((X)&(-(X)))
typedef long long LL;
LL n;
int q;
char str[100010];
int main(void)
{
//freopen("tree.in","r",stdin);
//freopen("tree.out","w",stdout);
scanf("%I64d%d",&n,&q);
int i,j;
LL u;
for(i=1;i<=q;i++)
{
scanf("%I64d%s",&u,st... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | a1cc8b6742d87a004e78607ebba9cf95 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
#include <stdlib.h>
typedef long long LL;
LL curNode;
char path[100001];
int main()
{
LL n, last_1_bit, root;
int i, q;
char *p, c ;
scanf("%I64d%d", &n,&q);
root = (n + 1) >> 1;
for(i=0; i<q; i++){
scanf("%I64d%s", &curNode, path);
p = path;
while(c... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | cafe297571d6d0bcbfb061df2e48610c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define LOG2(_X) ((unsigned) (8 * sizeof (unsigned long long) - __builtin_clzll((_X)) - 1))
// https://stackoverflow.com/questions/11376288/fast-computing-of-log2-for-64-bit-integers
int main() {
long long int n, q, root;
int D, len_p;
char *p;
... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | 89341b0174a65ba03603735fa4b35bc1 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#define MAX 100010
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
char str[MAX], command[MAX];
int get_path(long long v, long long n){
int len = 0;
while (1){
long long m = (n + 1)... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | 8740799565cc5ef443685407a9b13bf5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include<stdio.h>
int main() {
long long int n, a, k, a2, q;
int i, j, b[64], d, tn, l;
char s[100000];
scanf("%lld %lld", &n, &q);
//printf("%lld %d\n", n, q);
a2 = n;
for(tn = 0; a2 != 0; a2 = a2/2)
tn++;
//printf("digitos de n: %d\n", tn);
for(i = 0; i != q; i++) {
... | |
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary tree have the same depth (distance from the root). So n is a number such that n ... | Print q numbers, i-th number must be the answer to the i-th query. | C | dc35bdf56bb0ac341895e543b001b801 | 3ca180fd5b07f3a801975a4804c5900a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"bitmasks",
"trees"
] | 1490625300 | ["15 2\n4\nUURL\n8\nLRLLLLLLLL"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains two integer numbers n and q (1 ≤ n ≤ 1018, q ≥ 1). n is such that n + 1 is a power of 2. The next 2q lines represent queries; each query consists of two consecutive lines. The first of these two lines contains ui (1 ≤ ui ≤ n), the second contains non-empty string si. si doesn't contain any chara... | ["10\n5"] | #include <stdio.h>
long long bin[62];
int main() {
long long n,q,root;
int deg=0;
n = 1;
for(int i=0; i<=62; i++) {
bin[i] = n;
n<<=1;
}
scanf("%lld %lld",&n,&q);
root = (n+1)/2;
while(n) {
deg++; n/=2;
}
for(int i=0; i<q; i++) {
long long x,y;
int dep = 1;
char s[100005];
scanf("%lld",&x);
s... | |
One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | C | 09f5623c3717c9d360334500b198d8e0 | a83211b47128eceab0d42329d0877a9e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"binary search",
"sortings",
"math"
] | 1380295800 | ["3\n3 2 2", "4\n2 2 2 2"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | PASSED | 1,600 | standard input | 2 seconds | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | ["4", "3"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 100000
int main()
{
int i, n, amigos[N] = {0}, rondasA = 0;
double rondasB , juegos = 0;
scanf("%d", &n);
for(i = 0; i < n; i++)
{
scanf("%d", &amigos[i]);
juegos = juegos + amigos[i];
}
for(i = 0; i < n... | |
One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | C | 09f5623c3717c9d360334500b198d8e0 | 042c6b24af2fc3e9ec3ca6fb96e79f65 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"binary search",
"sortings",
"math"
] | 1380295800 | ["3\n3 2 2", "4\n2 2 2 2"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | PASSED | 1,600 | standard input | 2 seconds | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | ["4", "3"] | #include<stdio.h>
#include<stdlib.h>
long long int max_num(long long int a, long long int b){
if(a > b)
return a;
else return b;
}
int main(){
int n;
scanf("%d", &n);
int i, j , k;
long long int a[n], max = -1, sum = 0, ans;
for(i = 0; i < n; i++)
scanf("%lld", &a[i]);
for(i = 0; i < n-1; i++)
if(max < ... | |
One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | C | 09f5623c3717c9d360334500b198d8e0 | 1dbacbe4763bdbcfb93f4fac418e4d94 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"binary search",
"sortings",
"math"
] | 1380295800 | ["3\n3 2 2", "4\n2 2 2 2"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | PASSED | 1,600 | standard input | 2 seconds | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | ["4", "3"] | #include <stdio.h>
#include <math.h>
int max(int a, int b);
int main(int argc, char const *argv[])
{
long long int players, rounds, n, sumaRounds = 0, res = 0, ma = 0;
scanf("%I64d", &players);
n = players;
while(n--)
{
scanf("%I64d", &rounds);
sumaRounds += rounds;
if(ro... | |
One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play ai rounds. What is the minimum number ... | In a single line print a single integer — the minimum number of game rounds the friends need to let the i-th person play at least ai rounds. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | C | 09f5623c3717c9d360334500b198d8e0 | 1ce3b041c72fcd1935b726bd41e110e4 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"binary search",
"sortings",
"math"
] | 1380295800 | ["3\n3 2 2", "4\n2 2 2 2"] | NoteYou don't need to know the rules of "Mafia" to solve this problem. If you're curious, it's a game Russia got from the Soviet times: http://en.wikipedia.org/wiki/Mafia_(party_game). | PASSED | 1,600 | standard input | 2 seconds | The first line contains integer n (3 ≤ n ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the i-th number in the list is the number of rounds the i-th person wants to play. | ["4", "3"] | #include <stdio.h>
int main(){
long long total=0, rminimos=0, rnds; //rnds: cantidad de rondas minimas que deben jugarse
long ai, p, n; //n:numero de amigos
scanf("%ld", &n);
for(p=0; p<n; p++){
scanf("%ld", &ai);
total=total+ai;
if(ai>rminimos){
rminimos=ai;
}
rnds=total/(n-1);
if(total%(n-1) > 0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.