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
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c...
Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$.
C
5babbb7c5f6b494992ffa921c8e19294
9cb4135fe56ac95796a354a026887da5
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1530808500
["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"]
NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$...
PASSED
900
standard input
1 second
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l...
["6", "5"]
#include<stdio.h> int main() { int n,i; long d,x[100],a[100],j=1,dem=2; do{scanf("%d %ld",&n,&d);}while(n<1||n>100||d<1||d>1000000000); for(i=1;i<=n;i++) { do{scanf("%ld",&x[i]);}while(x[i]<-1000000000||x[i]>1000000000); } for(i=1;i<=n-1;i++) { a[j]=x[i+1]-x[i]; j++; } for(j=1;j<=n-1;j++) { if(a[j]>(...
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c...
Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$.
C
5babbb7c5f6b494992ffa921c8e19294
24482feaedb1c72727c45ec2547865a2
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1530808500
["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"]
NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$...
PASSED
900
standard input
1 second
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l...
["6", "5"]
#include<stdio.h> int main() { int n,i; long long int d,x,a,b,sum,count=2; scanf("%d %lld",&n,&d); for(i=1;i<=n;i++) { scanf("%lld",&b); if(i!=1) { sum=b-a; if(sum/2>=d) { if(sum-d*2==0) { ...
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c...
Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$.
C
5babbb7c5f6b494992ffa921c8e19294
65faccb46eaa05bd9f3e5c9fdbc67639
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1530808500
["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"]
NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$...
PASSED
900
standard input
1 second
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l...
["6", "5"]
#include<stdio.h> main() { int n,d,i,t=0,p,q; scanf("%d %d",&n,&d); int arr[n]; for(i=0; i<n; i++) { scanf("%d",&arr[i]); } for(i=0; i<n-1; i++) { if((arr[i+1]-arr[i])==2*d) { t++; } else if((arr[i+1]-arr[i])>2*d) { ...
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c...
Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$.
C
5babbb7c5f6b494992ffa921c8e19294
ba9a86c507edf403aa139b67d016f080
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1530808500
["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"]
NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$...
PASSED
900
standard input
1 second
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l...
["6", "5"]
#pragma warning(disable:4996) #include <stdio.h> #include <malloc.h> #include <math.h> #include <stdlib.h> #include <string.h> #define N 100 #define EPS 1E-5 //#define min(a,b) (a>b) ? b : a int lol(const void *x1, const void *x2) { return *(int*)x1 - *(int*)x2; } /* int gcd(int a, int b) { int c; while (b) { c =...
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c...
Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$.
C
5babbb7c5f6b494992ffa921c8e19294
760a279d030c28d0867fbffee7405562
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1530808500
["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"]
NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$...
PASSED
900
standard input
1 second
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l...
["6", "5"]
#include <stdio.h> #include <stdlib.h> int cmp(const void *a,const void *b) { return *(int *)a - *(int *)b; } int array[100]; int array2[100]; int main(void) { int n,m; while(scanf("%d %d",&n,&m)!=EOF) { getchar(); int i; for(i = 0;i<n;i++) scanf("%d",&array[i]); if(n == 1) printf("%d\n",2); els...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
f76a0e4b4fb9c9242b98d3a915ebcfdc
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<stdlib.h> int main() { long long int t,n,k,i,j; scanf("%lld",&t); for(i=0;i<t;i++) { scanf("%lld%lld",&n,&k); if((n-(k-1))%2!=0&&(n-(k-1))>0) { printf("YES\n"); for(j=0;j<k-1;j++) printf("1 "); printf("%ll...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
9367692b517c300d7f9b5bd2a8dca99b
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int x,p,n,i,s,st1,st2,z; scanf("%d %d",&x,&n); p=x; s=n-1; st1=x-s; z=2*s; st2=x-z; if(st1%2==1 && st1>0) { printf("YES\n"); for(i=0;i<s;i++) { printf("1 "); } printf("%d\n",p-s); } else if(st2%2==0 && st2>0) { printf("YES\n"); for(i=0;i<n-1;i++) { prin...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
87ded8a2f48f2b68c6062952d38027e4
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> int main() { long long t,n,k,a,b,i; scanf("%lld",&t); while(t--) { scanf("%lld %lld",&n,&k); a=k-1;b=2*(k-1); if(n-a>0 && (n-a)%2==1) { printf("YES\n"); for(i=0;i<k-1;i++) printf("1 "); printf("%lld\n",n-a); } else if(n-b>0 && (n-b)%2==0) { printf("YES\n"); for(i=...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
33d2e2586f9347b0d4253280c18c5128
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(){ int n,t,i,j,k,count; scanf("%d",&t); while(t--){ scanf("%d %d",&n,&k); if(n<k){ printf("NO\n"); continue; } if(n%2==0){ if(k%2==0){ printf("YES\n"); for(i=0;i<k-1;i++){ printf("1 "); ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
608a76d62dc24403b8ab4dd01e03b01f
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> #include <stdlib.h> void solve() { int n, k; scanf("%d %d", &n, &k); if(n&1 && k&1^1) { printf("NO\n"); return; } if(n&1^1 && k&1) { if(n < 2 * k) { printf("NO\n"); return; } printf("YES\n"); for(int ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
2fb0b28244dde97244b073477f17d1fe
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> #include <stdlib.h> void find(int a,int b) { if(a<b) printf("NO\n"); if(a==b) { printf("YES\n"); for(int i=0;i<a;i++) { printf("1"); if(i==a-1) printf("\n"); else printf(" "); } ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
0ca8f65cfb6a8beb3e86a67515568d6b
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> int main() { int i, t, n, k; scanf("%d", &t); while (t--) { scanf("%d%d", &n, &k); if (n < k || n % 2 && k % 2 == 0 || (n % 2 == 0 && k % 2 && n < k * 2)) puts("NO"); else if (n % 2 == k % 2) { puts("YES"); for (i = 1; i < k; ++i) printf("1 "); printf("%d\n", n - k + 1); } el...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
3d6b316423351fe277902c64d9395141
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> void ifPos(int n, int k) { int i; if(k == 0 || n < k || (n % 2 == 1 && k % 2 == 0)) { printf("NO\n"); } else if((n - (k - 1)) % 2 == 1 && n - (k - 1) > 0) { printf("YES\n"); for(i = 0; i < k - 1; i++) printf("%d ", 1); printf("%d\n"...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
d001f48c72f7f6f7e74d3789bbcabfc5
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int i,j,k,m,n,t,a,b,x; scanf("%d",&t); for(a=0;a<t;a++){ scanf("%d %d",&n,&k); x=n; if(n<k||(n%2!=0&&k%2==0)) printf("NO\n"); else if((n%2!=0&&k%2!=0)||(n/2<k)){ m=n-((k-1)*1); if(m%2!=0){ prin...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
f293485fc11d7ca26ed307ef2d4b2005
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> #include <stdlib.h> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void check(int n, int k){ int check=1; if (n<k) check=0; else{ if ((k%2==0)&&(n%2==1)) check=0; if ((k%2==1)&&(n%2==0)&&(n<2*k)) check=0; } if (check==...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
8439990ee2230cf6d7e7f983c95f6aac
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int n,x,y,i,j,a,b,z; scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%d %d",&a,&b); z=a-(2*(b-1)); y=a-(b-1); if ( y%2!=0 && y>0) { printf("YES\n"); for (j=1;j<=(b-1);j++) { printf("1 "); } ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
50b8ab62b9dd27dbedc2aea58d9a07d5
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int t,n,i,k; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&k); k--; if((n>k)&&((n-k)%2!=0)) { printf("YES\n"); for(i=0;i<k;i++) printf("%d ",1); printf("%d\n",n-k); } else ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
a45de13c9afdab77cbd9e41b6f8ebd74
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int T; scanf("%d",&T); while(T>0) { long int n,k,i; scanf("%ld%ld", &n,&k); if(((n-k+1)%2==1) && (n-k+1)>0) { printf("YES\n"); for(i=0 ; i<k-1 ; i++ ) printf("1 "); ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
0cd69e80725c1e385775e2fd37bb1970
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int t, n, k, i; scanf("%d",&t); while(t--) { scanf("%d%d", &n, &k); int rem1=(n-(k-1)); int rem2=(n-(2*(k-1))); if((rem1)%2!=0&&rem1>0) { printf("YES\n"); for(i=1; i<k; i++) { print...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
66b068b462973ce033b560bce55299c0
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<stdlib.h> int main() { long int m,t,k,f,s; scanf("%ld",&m); for (int i = 0 ; i < m ; i++) { scanf("%ld %ld",&t,&k); if (t % k == 0) { printf("YES\n"); for (int j = 0 ; j < k ; j++) { printf("%ld ",t ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
09a774fa14d34f8bc1814662ffe591db
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { long long i,n,k; scanf("%lld %lld",&n,&k); if(n<k) { printf("NO\n"); } if(n==k) { printf("YES\n"); for(i=0;i<n;i++) { printf("1 "); } printf("\n"); } if(n>k){ if((n%2==0)&&(k%2!=0)) { if((n/2)>=k) ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
bdf14abdfb191e01939f90f069209c2b
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<string.h> #include<math.h> #include<limits.h> #include<ctype.h> #include<stdbool.h> #define ll long long const int N = 2e5 + 5; void test() { int n, k; scanf("%d %d", &n, &k); int all_1 = n - (k - 1); if(all_1 > 0 && all_1 % 2 != 0) {...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
a47f2590237f47c094a001df5dd61286
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<string.h> #include <stdlib.h> #include <math.h> int main(){ long long int a,b,c; long long int d,n,m,p,q,r,k,i,x,y,j,distinct,max,temp1,temp2,num1,num2,count; scanf("%lld",&k); for(m=0;m<k;m++){ scanf("%lld %lld", &a,...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
3e551caa822cc06ee26e26581cb10c6e
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int j,t; scanf("%d",&t); for(j=0;j<t;j++) { int k,i; long long n; scanf("%lld %d",&n,&k); if(k>n) printf("NO\n"); else if(n%2!=0&&k%2==0) printf("NO\n"); else if((n%2==0&&k%2==0)||(n%2!=0&&k%2!=0)) { ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
a48c9c0f38b708b5606fc75376b8f8eb
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int n,i,j,k,l,t; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&k); if(n==k) { printf("YES\n"); for(i=1;i<=k;i++) printf("1 "); printf("\n"); } else{ if(k<(n-1)) { ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
b8a1af8699125322e60ef73cf70d4bfc
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int n,i,j,k,l,t; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&k); if(n==k) { printf("YES\n"); for(i=1;i<=k;i++) printf("1 "); printf("\n"); } else{ if(k<(n-1)) { ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
08ad76b4cf650299fe7e95d9c44cb581
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> main() { int t,n,k,q,i; scanf("%d",&t); while(t!=0) { scanf("%d%d",&n,&k); q=k-1; if(n<k) printf("NO\n"); else { if(n==k) {printf("YES\n"); for(i=0; i<n; i++) printf("1 "); printf("\n");} else {if((n-q)%2!=0) { printf("YES\n"); for(i=0; i<q; i++) printf("1 "); printf("%d\n",n-q);} ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
aba44d2550bfef3f97a182d2ebb7aac2
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> int main() { long int t,n,k; scanf("%ld",&t); while(t--) { scanf("%ld %ld",&n,&k); if(n<k) printf("NO\n"); else if(n%k==0) { printf("YES\n"); for(int i=0; i<k; i++) printf("%ld ",n/k); prin...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
a189cf18abac177a0014e1cd88608e73
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,k; scanf("%d%d",&n,&k); if(k>n) printf("NO"); else { if(n%2!=0&&k%2!=0) { printf("YES\n"); for(int i=0;i<k-1;i++) printf("1 "); printf("%d",n-(k-1)); } else if(n%2!=0&&k%2==0...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
60eac264c9d612efdd8ad2b0dd925ce6
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<string.h> #include<math.h> #include<ctype.h> int main() { int t; scanf("%d",&t); while(t--) { long long n,p,b; scanf("%lld %lld",&n,&p); if (p>n) {printf("NO\n");continue;} if(n%2!=0) { if(p%2==0) { ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
f670c394128f82e265c8b737f7ad55be
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> int main() { long long int a,b,c=0,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,z; char x[10000],y[10000]; scanf("%lld",&t); for(i=0;i<t;i++) { scanf("%lld%lld",&n,&k); if(n%2==0) { if(k*2<=n) { printf("YES\n"); ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
11a84a43f65c572f4f98898e9447e011
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> #include<math.h> int main() { int t,n,k,x,y; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&k); if(n<k||(n>k&&n<2*k&&n%2!=k%2)||(n%2==1&&k%2==0)) printf("NO\n"); else { printf("YES\n"); if(n%2==0&&n>=2*k) { ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
e83a1b450baff6b21002b1f4cdf31846
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> int main(){ //int i = 0, t = 0, n = 0; //int cnt = 0, m = 0, s = 1; int t, n, k, i = 0, j = 0, b = 1, flag = 1; scanf("%d", &t); for(i = 0; i < t; i++){ scanf("%d", &n); scanf("%d", &k); flag = 1; if(n % 2 == 0){ if(k % 2 == 0){ if(n < k){ printf("NO\n"); flag = 0; ...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
3f9bcdd549c64559f0fae1d90468843b
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> int main(){ int t, n, k, b; scanf("%d", &t); while(t--){ b = 0; scanf("%d %d", &n, &k); int par = ((k-1)*2); int impar = (k-1); if(((n - par)%2 == 0) && (par%2 == 0) && (n - par > 0)){ printf("YES\n"); int aux = n - par;...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
92d580ea50ca2f0023eb794d5379b5e0
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; scanf("%d",&n); for(int i=0;i<n;i++){ int t,k; scanf("%d %d",&t,&k); //奇 偶 if(t%2==1 && k%2==0){ printf("NO\n"); } //奇 奇 if(t%2==1 && k%2==1){ if(t>...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
8957a53091e80103c0931d3791179864
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include<stdio.h> main() { int t; scanf("%d",&t); while(t--){ int n,k,i; scanf("%d%d",&n,&k); if(k>n||(n%2==1&&k%2==0)||(n%2==0&&k%2==1&&n<k*2)){ printf("NO\n"); } else{ printf("YES\n"); if(n%2==0&&n>=k*2){ for(i=1;i...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
5a53bf068438833e14d166388a1ae2a4
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
#include <stdio.h> int main(void) { int t; scanf("%d",&t); while (t--) { int n,k; scanf("%d%d",&n,&k); if ((n-(k-1))%2==1&&n-(k-1)>0) { printf("YES\n"); int count;...
You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i&gt;0$$...
For each test case print: YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them); NO if the answer does not exist. The letters in the words YES and NO can be printed in any case.
C
6b94dcd088b0328966b54acefb5c6d22
f9a8aea38c0ff887b38c61f05817de3a
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "math" ]
1589034900
["8\n10 3\n100 4\n8 7\n97 2\n8 8\n3 10\n5 3\n1000000000 9"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).
["YES\n4 2 4\nYES\n55 5 5 35\nNO\nNO\nYES\n1 1 1 1 1 1 1 1\nNO\nYES\n3 1 1\nYES\n111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111110 111111120"]
///I must try more than once... #include<stdio.h> void test() { int n,k; scanf("%d%d",&n,&k); if(k>n) printf("NO\n"); else if((n-k+1)%2!=0){ printf("YES\n"); for(int i=1;i<k;i++) printf("1 "); printf("%d\n",n-k+1); } else if((n-(k-1)*2)%2==0 && (k-1)*2<n){ printf(...
There are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The buns aren't ready yet and the line is undergoing some changes.Each second all boys that stand right in front of girls, simultaneously swap places with the girls (so that the girls could go closer to the beginning o...
Print a single integer — the number of seconds needed to move all the girls in the line in front of the boys. If the line has only boys or only girls, print 0.
C
8423f334ef789ba1238d34f70e7cbbc8
f7f49f5c2b73fed92672492bf43d7572
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dp", "constructive algorithms" ]
1381419000
["MFM", "MMFF", "FFMMM"]
NoteIn the first test case the sequence of changes looks as follows: MFM  →  FMM.The second test sample corresponds to the sample from the statement. The sequence of changes is: MMFF  →  MFMF  →  FMFM  →  FFMM.
PASSED
2,000
standard input
1 second
The first line contains a sequence of letters without spaces s1s2... sn (1 ≤ n ≤ 106), consisting of capital English letters M and F. If letter si equals M, that means that initially, the line had a boy on the i-th position. If letter si equals F, then initially the line had a girl on the i-th position.
["1", "3", "0"]
#include<stdio.h> #include<string.h> char str[1000005]; int main() { int t; int i,j,n,corr; int count1,count2,count,precount; t = 1; while(t--) { scanf("%s",str); n=strlen(str); for(i=0;i<n;i++) if(str[i]=='M') str[i]='G'; else str[i]='B'; i=n-1; while(i>=0&&str[i]!='B') i--; j=0;...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
b324389a4154a11f028d5ca87d47e8e6
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include <stdio.h> int main() { long long int i,j,k,n,ck; scanf("%lld%lld",&n,&k); long long int p[1000009],max = -1; for(i=0;i<n;i++) { scanf("%lld",&p[i]); if(p[i] > max) { max = p[i]; } } if(k>=n) { printf("%lld\n",max); } else { max = p[0]; ck = k; i=1; while(i<n) { if(p[i] > m...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
f777d60d6a6260464927b47d92d8d2a0
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> int main() { long long n,k,i,j,count=0; scanf("%lld %lld",&n,&k); long long a[n]; for(i=0;i<n;i++) { scanf("%lld",&a[i]); } for(i=0;i<n-1;i++) { if(a[i]!=0) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) ...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
941107aa8ac629570765bcfbf70a88d8
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include <stdio.h> #include <stdlib.h> int indexMax(int n, int *array) { int index = 0; for (int i = 0; i < n; i++) { if (array[i] > array[index]) { index = i; } } return index; } int main() { long long nrWins; int nrPlayers, *power; scanf("%d%lld",...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
064b847e5650e63be607cecaec42c1b4
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> int main() { int n; long long int k=0; scanf("%d %lld",&n,&k); int i=0; int a[505]={0}; int max=0; for(i=0;i<n;i++) { scanf("%d",&a[i]); if(a[i]>max)max=a[i]; } if(n-1<=k){printf("%d\n",max);return 0;} int q[505]={0}; int j=0; for(i=0;i<n;i++) { if(a[i]==max){printf("%d\n",max);r...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
d60763f7b9dd0fbb5626bbace9c03a30
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> int main(void) { long long int k,n,i,ind=1,max=1,win[500],ans,pos; scanf("%I64d %I64d",&n,&k); for(i=0;i<500;i++)win[i]=0; long long int a[n]; scanf("%I64d",&a[0]); if(max<a[0]){max=a[0];pos=0;} for(i=1;i<n;i++) { scanf("%I64d",&a[i]); if(ind) ...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
c86841a6cb67780f1eeed9cfd00eb653
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> #define lli long long int int main() { lli n,k; scanf("%lld %lld",&n,&k); lli arr[n+1]; arr[0]=0; lli i,j,max=0; for(i=1;i<=n;i++) { scanf("%lld",&arr[i]); if(max<arr[i]) { max=arr[i]; } } if(k>=n) ...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
f8a8ddd49fc7a750e87f48df74e65151
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> main() { long long int n,k; scanf("%I64d %I64d",&n,&k); long long int a[n],i,j,d=0,l=0; for(i=0;i<n;i++) { scanf("%I64d",&a[i]); if(a[i]>d) d=a[i]; } if(k>=n-1) { printf("%I64d",d); } else { d=a[0]; for(i=1...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
5007f0176105a562a413c05ae60592db
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include <stdio.h> int power[501]; int main(void) { int n, con = 0, cur = -1, max = -1; long long a, k; scanf("%d %I64d", &n, &k); for (a = 1; a <= n; a = a + 1) { scanf("%d", &power[a]); if (max < power[a]) max = power[a]; } while (1) { if (power[1] > power[2]) { con++; } else if (power[1] ...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
3f5dedd5eb18c75477f9510e8410ddb1
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include <stdio.h> #include <stdlib.h> void prob829B(){ int n, i, res, j, max=0, ix=0; long long int k; scanf("%d%lld", &n, &k); int arr[n]; for (i=0; i<n; i++){ scanf("%d", &arr[i]); if(arr[i]>max){max=arr[i]; ix = i;}; } if (k>500 || k>=ix)printf("%d",max); els...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
b8b3ecac376024c7ff0dda9bcec9678d
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> main() { unsigned long long max,n,k,a[1000],b,c,d,e,f=2,m,o=0,p=0; scanf("%llu %llu",&max,&k); for(b=1;b<=max;b++) scanf("%llu",&a[b]); m=a[1]; n=a[2]; h:if(m>n) o++; else p++; if(o==k) printf ("%llu",m); else if (p==k) printf ("%llu",n); else { if(m>n) { n=a[f+1]; p=0; if(f==max) { printf(...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
10965dd1d30d126b3b1c390e1bc1ba97
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #define MIN(a,b) a<b?a:b #define MAX(a,b) a>b?a:b #define rep(i,a,b) for(i=a;i<b;i++) #define rev(i,a,b) for(i=a;i>b;i--) #define sf(a) scanf("%d",&(a)) #define pf(a) printf("%d",(a)) #define sfll(a) scanf("%lld",&(a)) #define pfll(a) printf("%lld...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
b378f0d203db87ec332e71cb673dd01d
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> void sort(int l, int r); int x[10000]; int main() { int t, n, m,w, i,j,count=0,max,temp; long long k; scanf("%d%lld", &n, &k); for (i = 0; i < n; i++) { scanf("%d", &x[i]); } if (k >= n) { sort(0, n - 1); printf("%d\n", x[0]); } else { i = -1; w = n-1; while (count != k) { ...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
34bfa93635194c859c8c11604ca3c57d
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> main() { int n,i,temp; unsigned long long k; scanf("%d%llu",&n,&k); if(k<n){ int ara[n]; for(i=0;i<n;i++){ scanf("%d",&ara[i]); } for(int j=1;j<=k;j++){ if(ara[0]>ara[1]){ temp=ara[1]; for(i=2;i<n;i++){ ara[i-1]=ara[i]; } ara[n-1]=temp; } else{ temp=ara[0]; for(i=...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
ad325241085bc44baab7aeccd27b457d
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> main() { int n,i,temp; unsigned long long k; scanf("%d%llu",&n,&k); if(n==2){ int a,b; scanf("%d%d",&a,&b); if(a>b) printf("%d\n",a); else printf("%d\n",b); return 0; } if(k<n){ int ara[n]; for(i=0;i<n;i++){ scanf("%d",&ara[i]); } for(int j=1;j<=k;j++){ if(ara[0]>ara[1]){ ...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
dd8f1ed8b0ed04f20e488ccd06714fe7
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include <stdio.h> #include <stdlib.h> int main() { int n,winner=0,i,j,win=0; long long int k; scanf("%d%I64d",&n,&k); int power[n]; scanf("%d",&power[0]); for(i=1,j=0;i<n;i++) { scanf("%d",&power[i]); if(power[j]>power[i]) { win++; if(win==k&&...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
efdaddcf297df62019240c5f78cf53e1
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> int s[510]; int main() { int n,a=0,b,c,d,sum; __int64 m; scanf("%d%I64d",&n,&m); int i,j; for(i=0;i<n;i++) { scanf("%d",&s[i]); if(s[i]>a) { a=s[i]; b=i; } } c=0; for(i=0;i<b&&sum<m;i++) { sum=0; if(i>0&&s[i]>s[i-1]) sum++; for(j=i+1;j<b&&s[i]>s[j];j++) s...
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k games in a row. This player becomes the winner.For each of the par...
Output a single integer — power of the winner.
C
8d5fe8eee1cce522e494231bb210950a
6502919238da6ebe6f88b752155c61ad
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "data structures", "implementation" ]
1509029100
["2 2\n1 2", "4 2\n3 1 2 4", "6 2\n6 5 3 1 2 4", "2 10000000000\n2 1"]
NoteGames in the second sample:3 plays with 1. 3 wins. 1 goes to the end of the line.3 plays with 2. 3 wins. He wins twice in a row. He becomes the winner.
PASSED
1,200
standard input
2 seconds
The first line contains two integers: n and k (2 ≤ n ≤ 500, 2 ≤ k ≤ 1012) — the number of people and the number of wins. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — powers of the player. It's guaranteed that this line contains a valid permutation, i.e. all ai are distinct.
["2", "3", "6", "2"]
#include<stdio.h> int main() { long long int n,i,k,j,s,z=0; scanf("%lld %lld",&n,&k); long long int A[n]; for(i=0;i<n;i++) { scanf("%lld",&A[i]); } if(k>=(n-1)) { s=n; } else { for(i=1;i<=k;i++) { if(A[i]>A[0]) { ...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
32deeefe0c55a87ef204af9f5f90ddfa
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include<stdio.h> #include<string.h> int main() { char s1[100000]; char s[200000],t; int m,a,ls,i,sum; while(scanf("%s",s)!=EOF) { ls=strlen(s); memset(s1,'0',ls/2*sizeof(char)); scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&a); s1[a-1]=(s1[a-1]-'0')^1+'0'; } for(sum=0...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
3df93b17f9ff9a8091869c1b41314c02
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include<stdio.h> int main() { char s[200000], c; int n, i, len, judge[200000] = { 0 }, t; while (scanf("%s", &s) != EOF) { for (i = 0; s[i] != '\0'; ++i); len = i; scanf("%d", &n); while (n--) { scanf("%d", &t); if (judge[t - 1] == 0) judge[t - 1] = 1; else judge[t - 1] = 0; } for (i...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
02ca1040e8910a7839fbdc6fb735b305
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> #include <stdlib.h> long stat[100005]; int main() { char s[200005]; scanf("%s", &s); long len = strlen(s), n, x; scanf("%ld", &n); int status[len / 2]; while (n--){ scanf("%ld", &x); stat[x]++; } for (n = 0; n <= len / 2 - 1; n++){ if (n == 0)...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
d80b5373803113b98edddd252b528f00
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include<stdio.h> #include<string.h> int main() { int i,j,len,m,pos,ct; char ar[200001],state[200001],temp; scanf("%s",ar); len=strlen(ar); scanf("%d",&m); for(i=0;i<len;i++) state[i]=0; for(i=0;i<m;i++) { scanf("%d",&pos); state[pos-1]=(state[pos-1]+1)%2; ...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
8cf58ecb20ec87d5e1cb87d74ff7b3b9
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() {int a,b,c,d,e,f,i,j,k,p,sum=0; char s[200001]; int z[100001]; for(i=0;i<100001;i++) z[i]=0; scanf("%s",&s); c=strlen(s); scanf("%d",&a); for(i=0;i<a;i++) { scanf("%d",&b); z[b-1]=z[b-1]+1; } for(i=0;i<c/2;i++) { sum=su...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
65a6daa8776f656b089bebf9c5776fb9
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include "stdio.h" #include "string.h" int a[2000010]={0},i,m,n,k,sum=0; char s[200010],temp; int main(){ while(scanf("%s %d",s,&m)!=EOF){ k = strlen(s); for(i=0;i<m;i++){ scanf("%d",&n); a[n-1]++; } for(i=0;i<k/2;i++){ sum +=a[i]; if(sum%2==1){ temp...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
ac6ba325cf87c304a39d2666f67eea3f
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> int b[100000]; int main(){ char s[200010]; int swap; int N; int a=0; char c; for(N=0;(s[N]=getchar())!='\n'; ++N) ; s[N]='\0'; int m; scanf("%d", &m); int i, k; for(i=0; i < m; ++i){ scanf("%d", &a); ++b[a-1]; } for(i=0; i ...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
db0837923be37392b52e55ccb79cc8bf
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include<stdio.h> #include<string.h> int main() { char c[2][200005]; int m,a[200005],b[200005]={0}; scanf("%s",c[0]); int s=strlen(c[0]); scanf("%d",&m); int i; for(i=0;i<m;i++) { scanf("%d",&a[i]); int k=s-a[i]; b[a[i]-1]++; b[k+1]++; b[a[i]-1]%=2; b[k+1]%=2; } for(i=0;i<s;i++) { c[1][i]=c[0][...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
e056086655d23a81203fa3fa7a95e5f2
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { const size_t line_size = 2 * 1e5 + 1; char* line = malloc(line_size); gets(line); int m; scanf("%d", &m); int i; int n = strlen(line); int * reversed = (int *) malloc(sizeof(int) * n); f...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
47e31e0cedaa4128e897de3cebc2b4af
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { const size_t line_size = 2 * 1e5 + 1; char* line = malloc(line_size); gets(line); int m; scanf("%d", &m); int i; int n = strlen(line); int * reversed = (int *) malloc(sizeof(int) * n); f...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
1cc991dbfd45c43af6d491499bd05068
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { const size_t line_size = 2 * 1e5; char* line = malloc(line_size + 1); gets(line); int m; scanf("%d", &m); int i; int n = strlen(line); int * reversed = (int *) malloc(sizeof(int) * n); fo...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
67528a5e1b7f3392c9a21c2579185240
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { /* allocate memory of size 2 * 10^5 + 1 (terminating zero char) and read line*/ const size_t line_size = 2 * 1e5 + 1; char* line = malloc(line_size); gets(line); int m; scanf("%d", &m); int i; in...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
33cf0bef0830a8c451d48851e66286a9
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[200001], aux; int m, a, i, max = 0, hist[200001] = {0}, len, sum = 0; scanf("%s", s); scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d", &a); hist[a-1]++; } len = strlen(s); for (i = 0; i < len/2;...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
1d0acd01d42dda54504f883ecf090644
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include<stdio.h> #include<string.h> int main() { int n,i,j,m; char s[300000],t; scanf("%s",s); n=strlen(s); int a[300000]={0}; scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&j); a[j-1]++; } for(i=1;i<n/2;i++) a[i]=a[i]+a[i-1]; for(i=0;i<n/2;i++) {...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
9df25272899970eabedf2a6969abc33a
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[200001], aux; int m, a, i, max = 0, hist[200001] = {0}, len, sum = 0; scanf("%s", s); scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d", &a); a -= 1; hist[a]++; if (a > max) { max = a; } } ...
Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m ...
In the first line of the output print what Pasha's string s will look like after m days.
C
9d46ae53e6dc8dc54f732ec93a82ded3
15f22c172aa93959e4e1f979da259ff8
GNU C
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "math", "strings" ]
1427387400
["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3"]
null
PASSED
1,400
standard input
2 seconds
The first line of the input contains Pasha's string s of length from 2 to 2·105 characters, consisting of lowercase Latin letters. The second line contains a single integer m (1 ≤ m ≤ 105) —  the number of days when Pasha changed his string. The third line contains m space-separated elements ai (1 ≤ ai; 2·ai ≤ |s|) — t...
["aedcbf", "vwxyz", "fbdcea"]
#include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[200001], aux; int m, a, i, max = 0, *hist, len, sum = 0; scanf("%s", s); scanf("%d", &m); hist = calloc(200001, sizeof(int)); for (i = 0; i < m; i++) { scanf("%d", &a); hist[a-1]++; } len = strlen(s...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
10346f4740402793e547e91f989c686b
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,a[100001],b[100001],i,temp1,temp2; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d %d",&a[i],&b[i]); } for(i=1;i<=n;i++) { if(a[i]<a[i-1]) { temp1=a[i]; a[i]=a[i-1]; a[i-1]=temp1; temp2...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
9aa9a1b41bbea9c43f39d32bbcb4910f
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,a=0,c,d,i; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&c,&d); if(c==d) a++; } if(a==n) printf("Poor Alex\n"); else printf("Happy Alex\n"); return 0; }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
80596400959ae10c653f3d0042c451a8
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
/* Bismillahir-Rahmanir-Rahim */ /* Solved By:- MD. Hasibul Hossain Rezvi CSE 14th Batch Comilla University */ #include<stdio.h> #include<math.h> #include<string.h> #define ll long long int #define db double #define py printf("YES\n") #define pn printf("NO\n") #define nl printf("\n"); int main() { in...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
e5718ab6248ef09ef367dff5879a790c
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,a,b,i; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d%d",&a,&b); if(a!=b) { printf("Happy Alex"); return 0;} } printf("Poor Alex"); return 0; }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
753a850646075d8507e1477f058834e6
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int a,b,n,co=0,coo=0; scanf("%d",&n); for (int i=1;i<=n;i++) { scanf("%d %d",&a,&b); if (a>b) co++; else coo++; } if ((co*coo)==0) printf("Poor Alex"); else printf("Happy Alex"); }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
e8d61b8860aa9f4354e9f116b5d1fdc2
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int a,b,n,co=0,coo=0; scanf("%d",&n); for (int i=1;i<=n;i++) { scanf("%d %d",&a,&b); if (a>b) co++; else if (b>a) coo++; } if ((co*coo)==0) printf("Poor Alex"); else printf("Happy Alex"); }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
634513accc47bafabe7cc82bfb512ba4
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,i,j,a[100009],b[100009],q=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]); for(i=0;i<n-1;i++){ if(((a[i]<a[i+1]) && (b[i]>b[i+1])) || ((a[i]>a[i+1]) && (b[i]<b[i+1]))){ q=1;break; } } if(q==1) printf(...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
ad0e1395c5d1a32db8d8f9447baf28c6
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int t,a,b,i,r=0; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d %d",&a,&b); if(a!=b) { r=1; } } if(r==0) { printf("Poor Alex"); } else { printf("Happy Alex"); } return 0; }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
c619583585ef5b779f21d6bac33a44fd
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,i,j,f=0; scanf("%d",&n); int a[n],b[n]; for(i=0;i<n;i++) { scanf("%d %d",&a[i],&b[i]); } for(i=0;i<n;i++) { if(a[i]!=b[i]) { printf("Happy Alex"); return 0; } } printf("Poor Alex"); }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
5e363a692bcade0b5807d961fbf26066
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,i,j,t,p; scanf("%d",&n); int r[100005][2]; for(i=0; i<n; i++) { scanf("%d%d",&r[i][0],&r[i][1]); } for(i=0; i<n; i++) { if(r[i][1]>r[i][0]) { printf("Happy Alex\n"); return 0; } } prin...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
999196c940964f8bf329e732bacfa250
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main (){ int n; scanf("%d",&n); int harga[n],spek[n]; int max=0; int temp[n]; for(int i=0;i<n;i++){ scanf("%d %d",&harga[i],&spek[i]); temp[i]=spek[i]-harga[i]; } // printf("%d %d",hargamax,spekmax); // int flag=0; for(int i=0;i<n;i++){ // printf("%d %d",hargamax,spekmax); if(temp[i...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
18196e490f95a37818cc32d3aa45faa9
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> #include<stdlib.h> int main () { int i,n; scanf("%d",&n); typedef struct computer { int a,b; }laptop; laptop pc[n]; //if it is strictly followed that as the price increases the specs go up then poor alex otherwise happy alex for(i=0;i<n;i++) scanf("%d%d",&pc[i].a,&pc[i].b); int c,l...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
d268976a86cf5b0f1396cbfd92dbd7eb
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include <stdio.h> int main() { int n,i,j,a[100000],b[100000],flag=0; scanf("%d",&n); for (i=0;i<n;i++){ scanf("%d%d",&a[i],&b[i]); } for (i=0;i<n;i++){ if(b[i]>a[i]) { flag=1; break; } } if(flag==1) printf("Happy Alex\n"); else printf("Poo...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
84b4c2efcdea09429ad616004761350a
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include <limits.h> #include <stdio.h> #define N 100000 int price[N], quality[N]; void sort(int l, int r) { int pivot = (l + r) / 2; int i = l, j = r, p = price[pivot], pp = quality[pivot], tmp; while (i <= j) { while (price[i] < p || price[i] == p && quality[i] < pp) ++i; while (p < pric...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
3dcbd006fbe1b8dae9a8e56bf9410de3
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,a,b,i,x=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d %d",&a,&b); if(a>b) { x=x+1; } else if(a<b) { x=x+1; } } if(x>=2) { printf("Happy Alex\n"); } else ...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
76d91584fa1b2ce8a4e411dea67159d8
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { int n,i; scanf("%d",&n); int a[n+1],b[n+1],cnt=0; for(i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); if(a[i]!=b[i]){ cnt=1; } } if(cnt==1){ printf("Happy Alex\n"); } else{ printf("Poor Alex\n"); } r...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
685c47bf980d58cc41b07682182f3c55
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include <stdio.h> #include <stdlib.h> int main() { int n,a,b,i; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %d",&a,&b); if(a!=b) { printf("Happy Alex\n"); return 0; }} printf("Poor Alex\n"); return 0; }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
7f63a117692e4eb0f0d98a7277f7bebb
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> int main() { long long int i,j=0,x,y,n,c,d,a,b,g=0,flag=0; scanf("%I64d",&n); for(i=0;i<n;i++) { scanf("%I64d%I64d",&y,&x); if(y<x) {flag=1; } } if(flag==1) printf("Happy Alex"); else printf("Poor Alex"); }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
666bcf7f227be3d6da02d036165f4eeb
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include<stdio.h> main() { int n, i, x[100001], y[100001], c = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &x[i], &y[i]); } for (i = 0; i < n; i++) { if (y[i] == x[i]) c++; } printf("%s\n", c != n ? "Happy Alex" : "Poor Alex"); }
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
d51d33854ce5d77ef6830b9217b6ec93
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include <stdio.h> typedef struct lap{unsigned int p, t;}lap; void MSA(unsigned int, unsigned int, lap*); void Merge(unsigned int, unsigned int, unsigned int, lap*); int main() { lap a[100000]; unsigned int n, i; scanf("%u", &n); for(i = 0; i < n; i++){ scanf("%u%u", &a[i].p, &a[i].t); } ...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
fe306a1f25ad53df9833f173b294e910
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include <stdio.h> #define DIMA 1 #define ALEX 0 typedef struct{unsigned int Price; unsigned int Quality;} Laptop; void GetInput(unsigned int*, Laptop*); unsigned short CheckArguement(unsigned int, Laptop*, Laptop*); void MSA(unsigned int, unsigned int, Laptop*, unsigned short); void Merge(unsigned int, unsigned int, u...
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality ...
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
C
c21a84c4523f7ef6cfa232cba8b6ee2e
04936947af2e92ef65c1c46cbec87d47
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "sortings" ]
1407511800
["2\n1 2\n2 1"]
null
PASSED
1,100
standard input
1 second
The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops. Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality). All ai are ...
["Happy Alex"]
#include <stdio.h> #define DIMA 1 #define ALEX 0 #define SIZE(X) ((unsigned int)X) typedef struct{unsigned int Price; unsigned int Quality;} Laptop; void GetInput(unsigned int*, Laptop*); unsigned short CheckArguement(unsigned int, Laptop*); void MSA(unsigned int, unsigned int, Laptop*); void Merge(unsigned int, unsign...
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers:...
If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters. It is guaranteed that ...
C
6587be85c64a0d5fb66eec0c5957cb62
539051a539badf8a836e0a8a8ffe73f8
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dfs and similar" ]
1337182200
["3\npair pair int int int", "1\npair int"]
null
PASSED
1,500
standard input
2 seconds
The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains. The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes). It is guaranteed that the total number of words does not exceed 105 and that a...
["pair&lt;pair&lt;int,int&gt;,int&gt;", "Error occurred"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int n, a[100011], stack[100011], top, length; char ans[1000011]; int main(){ //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int i; char s[10]; scanf("%d", &n); while(1 > 0){ s[0] = '\0'; scanf(...
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers:...
If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters. It is guaranteed that ...
C
6587be85c64a0d5fb66eec0c5957cb62
388707fe18558c680b25b74496a7d422
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dfs and similar" ]
1337182200
["3\npair pair int int int", "1\npair int"]
null
PASSED
1,500
standard input
2 seconds
The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains. The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes). It is guaranteed that the total number of words does not exceed 105 and that a...
["pair&lt;pair&lt;int,int&gt;,int&gt;", "Error occurred"]
#include<stdio.h> #include<string.h> #include<stdlib.h> #define SORT(a,n) qsort(a,n,sizeof(int),intcmp) #define s(n) scanf("%d",&n) #define sc(n) scanf("%c",&n) #define sl(n) scanf("%I64d",&n) #define sf(n) scanf("%lf",&n) #define...
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers:...
If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters. It is guaranteed that ...
C
6587be85c64a0d5fb66eec0c5957cb62
e6855333acf8dd8e0ceedf1baa310bfb
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dfs and similar" ]
1337182200
["3\npair pair int int int", "1\npair int"]
null
PASSED
1,500
standard input
2 seconds
The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains. The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes). It is guaranteed that the total number of words does not exceed 105 and that a...
["pair&lt;pair&lt;int,int&gt;,int&gt;", "Error occurred"]
/** pair<pair<int,int>,pair<int,int>> < start of equation 1 wait fisrt agrument , wait second agrument int: x= pop x=='1' -> print 'int', push ',' x==',' -> print ',int' (while checktop=='<'){pop, print '>'} x=='<' -> false pair: x=pop x=='1' ->print 'pair<' push ',<1' x==',' ->print ',pair<' push '...
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers:...
If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters. It is guaranteed that ...
C
6587be85c64a0d5fb66eec0c5957cb62
8557d3a8e8af828c30662da660ae7231
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dfs and similar" ]
1337182200
["3\npair pair int int int", "1\npair int"]
null
PASSED
1,500
standard input
2 seconds
The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains. The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes). It is guaranteed that the total number of words does not exceed 105 and that a...
["pair&lt;pair&lt;int,int&gt;,int&gt;", "Error occurred"]
#include <stdio.h> #include <string.h> char s[5000000], ans[5000000]; int n, m, k, pnt; int print_type(void) { if(pnt >= n){ return 0; } else { if(s[pnt] == 'i'){ --k; pnt += 4; ans[m++] = 'i'; ans[m++] = 'n'; ans[m++] = 't'; ...
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers:...
If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters. It is guaranteed that ...
C
6587be85c64a0d5fb66eec0c5957cb62
5d46c1504ea93ba5fcb8ff940d3c09c3
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dfs and similar" ]
1337182200
["3\npair pair int int int", "1\npair int"]
null
PASSED
1,500
standard input
2 seconds
The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains. The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes). It is guaranteed that the total number of words does not exceed 105 and that a...
["pair&lt;pair&lt;int,int&gt;,int&gt;", "Error occurred"]
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct Nodo{char msg[5]; struct Nodo * izq; struct Nodo * der; }Nodo; int n,p; Nodo h; Nodo *c; int r(Nodo* a); void imprimir(Nodo *a); int main(){ int k; scanf("%d",&n); c=&h; p=n...
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.We all know that programs often store sets of integers. For example, if we have a problem about a weighted directed graph, its edge can be represented by three integers:...
If it is possible to add the punctuation marks so as to get a correct type of language X-- as a result, print a single line that represents the resulting type. Otherwise, print "Error occurred" (without the quotes). Inside the record of a type should not be any extra spaces and other characters. It is guaranteed that ...
C
6587be85c64a0d5fb66eec0c5957cb62
a2d3c37e41dd62d5b59692f7dd6b4f79
GNU C
standard output
256 megabytes
train_003.jsonl
[ "dfs and similar" ]
1337182200
["3\npair pair int int int", "1\npair int"]
null
PASSED
1,500
standard input
2 seconds
The first line contains a single integer n (1 ≤ n ≤ 105), showing how many numbers the type dictated by Gena contains. The second line contains space-separated words, said by Gena. Each of them is either "pair" or "int" (without the quotes). It is guaranteed that the total number of words does not exceed 105 and that a...
["pair&lt;pair&lt;int,int&gt;,int&gt;", "Error occurred"]
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct Nodo{char msg[5]; struct Nodo * der; struct Nodo * izq; }Nodo; int n,p; Nodo h; Nodo *c; int r(Nodo* a); void imprimir(Nodo *a); int main(){ int k; scanf("%d",&n); c=&h; p=n...