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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer — the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | ae54dfe6ef155a443c7e7a9d9e8fccd2 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0 ≤ a1, a2, a3, a4 ≤ 104). The second line contains string s (1 ≤ |s| ≤ 105), where the і-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
int main()
{
int a1,a2,a3,a4,i,n,sum;
char str[100000];
while(scanf("%d %d %d %d",&a1,&a2,&a3,&a4)==4)
{
sum = 0;
scanf("%s",str);
for(i=0;str[i];i++)
{
n=str[i]-'0';
switch(n)
{
case 1: sum = sum+a1;
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer — the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 92ae6a6507d6e2babb15d8151348d5c6 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0 ≤ a1, a2, a3, a4 ≤ 104). The second line contains string s (1 ≤ |s| ≤ 105), where the і-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
main()
{
long int a[5],b,c,d,i,l,sum=0,p;
char s[100000];
for(i=0;i<4;i++){
scanf("%ld",&a[i]);
}
scanf("%s",&s);
l=strlen(s);
for(i=0;s[i]!='\0';i++){
sum=sum+a[s[i]-49];
}
printf("%ld ",sum);
}
| |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer — the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | fcfc70714f46d680e60f73daca28194a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0 ≤ a1, a2, a3, a4 ≤ 104). The second line contains string s (1 ≤ |s| ≤ 105), where the і-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main()
{
int a,b,c,d,i,t,sum=0;
scanf("%d %d %d %d",&a, &b, &c,&d);
char s[100000];
scanf("%s", &s);
t=strlen(s);
for(i=0;i<t;i++){
if(s[i]=='1')
sum=sum+a;
else if(s[i]=='2')
sum... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer — the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 481209039c837015f797ab78ed3fef64 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0 ≤ a1, a2, a3, a4 ≤ 104). The second line contains string s (1 ≤ |s| ≤ 105), where the і-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main()
{
long long a[5],ans=0;
char s[100001];
scanf("%lld%lld%lld%lld",&a[0],&a[1],&a[2],&a[3]);
scanf("%s",&s);
int len=strlen(s);
for(int i=0; i<len; i++)
{
ans=ans+a[s[i]-'1'];
}
printf("%lld\n",ans);
}
| |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer — the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | eb238b8ed6671d7b167a95c8441f9657 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0 ≤ a1, a2, a3, a4 ≤ 104). The second line contains string s (1 ≤ |s| ≤ 105), where the і-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include <stdio.h>
int main()
{
int a1,a2,i,a3,n,a4;
int s=0,t=0,u=0,v=0;
scanf("%d%d%d%d", &a1,&a2,&a3,&a4);
char a[100000];
scanf("%s",a);
for(i = 0; a[i] != '\0'; ++i);
n=i;
for(i=0;i<n;i++){
if(a[i]=='1'){
s=s+a1;
}
else if(a[i]=='2'){
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer — the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | ec135eb3c317d5c5b642b75c2267504b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0 ≤ a1, a2, a3, a4 ≤ 104). The second line contains string s (1 ≤ |s| ≤ 105), where the і-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main(void)
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
char str[100000];
int sum=0;
scanf("%s",str);
int l=strlen(str);
for(int i=0;i<l;i++)
{
char rem=str[i];
if(rem=='1')
sum=sum... | |
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ... | For each query of the second type, print a line containing a single integer — the maximum number of orders that the factory can fill over all n days. | C | d256f8cf105b08624eee21dd76a6ad3d | 9ba16c9b3c3d23898d853231b6baa6c3 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures"
] | 1456683000 | ["5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3", "5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2"] | NoteConsider the first sample.We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for t... | PASSED | 1,700 | standard input | 4 seconds | The first line contains five integers n, k, a, b, and q (1 ≤ k ≤ n ≤ 200 000, 1 ≤ b < a ≤ 10 000, 1 ≤ q ≤ 200 000) — the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively. The next q lines contain the descriptions of the queries. Each query is... | ["3\n6\n4", "7\n1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAXN 200010
int menor[MAXN], maior[MAXN];
int ft_e[MAXN], ft_a[MAXN];
int freq(int *ft, int ind) {
int ret = 0;
for (; ind > 0; ind -= ind & (-ind))
ret += ft[ind];
return ret;
}
int update (int *ft, int ind, int val, ... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 81fd0e750cc8ea89eafdcbcd6a002ba5 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include <stdio.h>
#include <string.h>
int main()
{
int i;
int k;
int length;
char s[100005];
char t[100005];
scanf("%s", s);
length = strlen(s);
if ( length%2 )
{
printf("No\n");
return 0;
}
k = 0;
for ( i = 0; i < length; i++ )
{
if ( k == 0... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 919c1d09cb00b380da333f21bd88e169 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
char a[1000000];
typedef struct node
{
char data;
struct node * next;
}node;
node* head=NULL;
void push(char k)
{
node* temp=malloc(sizeof(node));
temp->data=k;
temp->next=head;
head=temp;
}
void pop()
{
node* temp=head->next;
head->next=NULL;
free(head)... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 4c73d22d31aae947522acaf30e5fca18 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | //
// Created by shreyanshu on 7/6/18.
//
#include <stdio.h>
#include <stdlib.h>
unsigned int top=-1;
void popElement(char *stack) {
stack[top]=' ';
top--;
}
void pushElement(char *stack,char c) {
top++;
stack[top]=c;
}
int main() {
unsigned int i;
char *a=(char *)malloc(sizeof(char)*100000... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 3c22b7ae6836b0341c611c20c232c82c | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<string.h>
int main() {
int i,j,k,l,n,m,ptr;
char c[100005],d[100005];
scanf(" %s",c);
n = strlen(c);
ptr = -1;
for(i=0;i<n;i++) {
if(ptr >= 0)
if(d[ptr] == c[i])
ptr--;
else {
ptr++;
d[ptr] = c[i];
}
else {
ptr++;
d[ptr] = c[i];
}
}
if(ptr == -1)
pri... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 448bbe9df2deb8c832fa26dfbf75b7c6 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<string.h>
int main()
{
char a[1000000];
scanf("%s",a);
if(strlen(a)%2!=0)
{
puts("No");
return 0;
}
char stack[1000000];
int ptr = 0,i=0;
stack[ptr] = a[0];
ptr++;
for(i=1;i<strlen(a);i++)
{
if(stack[ptr-1] == a[i])
{
ptr -= 1;
continue;
}
else
{
stack[ptr] =... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 77940c409bc85317d634c509198dd493 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<stdlib.h>
typedef struct stack
{
int capa;
int a[100001];
int top;
}stack;
stack* stack1;
void create(int capacity)
{
stack1=(stack*)malloc(sizeof(stack));
stack1->top=-1;
stack1->capa=capacity;
}
void push(int value)
{
if(stack1->top==100001)
{
return ;
}
else
{
stack1->top=(s... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 270a4ea17e700ebec165dbfdbc77ade7 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<string.h>
int main()
{
int countC=0, countAC=0;
int up=0;
char A[100001];
scanf("%s", A);
int n = strlen(A);
// printf("%d", n);
int i;
for(i=0; i<n; i++){
if((i%2 && A[i] =='+') || (i%2 == 0 && A[i] == '-')){
countC++;
}
else
countC--;
}
if(countC... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | dd9cd0ec989e9200d6a77196890b677f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<string.h>
int main()
{
char a[1000003], b[1000003];
int i, j=0, n;
scanf("%s", a);
for(i=0;a[i];i++){
if(a[i]!=b[j]){
j++;
b[j]=a[i];
}
else{
--j;
}
//printf("J:%d\n", j);
}
if(j==0){
... | |
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled. | C | 89b4a7b4a6160ce784c588409b6ce935 | 8f1acaf012787f1e1b486275301c962f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1379172600 | ["-++-", "+-", "++", "-"] | NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r... | PASSED | 1,600 | standard input | 1 second | The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≤ n ≤ 100000). The i-th (1 ≤ i ≤ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise. | ["Yes", "No", "Yes", "No"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char a[100001];
scanf(" %s",a);
int knot=0;
int i;
int len =strlen(a);
if(len%2==1)
{
printf("No\n");
return 0;
}
for(i=1;i<len;i+=2)
{
if(a[i]=='+' &&a[i-1]=='-')
{
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | a1015787d82678171282083bbe664887 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
main()
{freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int p,i,j,k,temp,a[4]={0};
scanf("%d",&p);
a[p]++;
for(i=0;i<3;i++)
{
scanf("%d %d",&j,&k);
temp=a[j];
a[j]=a[k];
a[k]=temp;
}
for(i=1;i<4;i++)
if(a[i]==1)
printf("%d",i);
return 0;
}
| |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 574e8351199637a68bc7b453eb7aa96e | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int s[4]={0},a,b,t,n,i;
scanf("%d",&n);
s[n]=1;
for(i=0;i<3;i++)
{
scanf("%d %d",&a,&b);
if(s[a]==1)
{
s[b]=1;
s[a]=0;
}
else if(s[... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | e750d0270d98e2f4df0ef75f562da994 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int n,a,b,i;
FILE *in = fopen("input.txt","r");
FILE *out = fopen("output.txt","w");
fscanf(in,"%d",&n);
for(i=0;i<3;i++)
{
fscanf(in,"%d %d",&a,&b);
if(n==a) {n=b;continue;}
if(n==b) {n=a;continue;}
}
fprintf(out,"%d",n);
return(0);
} | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 35bffb547f55d3a894993133ae3d683c | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int a,a1,a2,b1,b2,c1,c2;
FILE *fin = fopen("input.txt","r");
FILE *fout = fopen("output.txt","w");
fscanf(fin,"%d",&a);
fscanf(fin,"%d %d",&a1,&a2);
fscanf(fin,"%d %d",&b1,&b2);
fscanf(fin,"%d %d",&c1,&c2);
if(a==a1)
a=a2;
else if(a==a2)
a=a1;
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 555bf37fb528de645018b06cbd83c37d | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int a,a1,a2,b1,b2,c1,c2;
FILE *fin = fopen("input.txt","r");
FILE *fout = fopen("output.txt","w");
fscanf(fin,"%d",&a);
fscanf(fin,"%d %d",&a1,&a2);
fscanf(fin,"%d %d",&b1,&b2);
fscanf(fin,"%d %d",&c1,&c2);
if(a==a1)
{a=a2;}
else if(a==a2)
{a=a1... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 59428d1ebf499acf4c5555e53c7b5751 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int s[3]={0};
int n,a,b,i,t;
FILE *in=fopen("input.txt","r");
FILE *out=fopen("output.txt","w");
fscanf(in,"%d",&n);
s[n-1]=1;
for(i=0;i<3;i++)
{
fscanf(in,"%d%d",&a,&b);
t=s[a-1];
s[a-1]=s[b-1];
s[b-1]=t;
}
for(i=0;i<3;i++)
{
i... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | d069327efab48309f2a60aab60d2c939 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n, i, a, b;
scanf("%d", &n);
for(i=0; i<3; i++)
{
scanf("%d %d", &a, &b);
if(a==n)
n=b;
else if(b==n)
n=a;
}
printf("%d", n);
retu... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | b0f128a2ed6a90afa9071f54760a0167 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int curr,i,pos1,pos2;
scanf("%d",&curr);
for(i=0;i<3;i++){scanf("%d %d",&pos1,&pos2);if(pos1==curr)curr=pos2;else if(pos2==curr)curr=pos1;}
printf("%d",curr);
return 0;
} | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | b176bb98759535f2a0a78f577c3c25eb | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int t,a,b,i;
scanf("%d", &t);
for(i=0;i<3;i++)
{
scanf("%d%d", &a, &b);
if(a==t)
t=b;
else if(b==t)
t=a;
}
printf("%d", t);
return 0;
}
| |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | b16e95aefb82b4a3b17322bcbf906b27 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n, z[3];
z[0] = 0;
z[1] = 0;
z[2] = 0;
int a, b;
int i, aux;
scanf("%d", &n);
z[n-1] = 1;
for(i = 0; i < 3; ++i)
{
scanf("%d %d", &a, &b);
a--;
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 685ec6cca834f934c6806c5fc70c5808 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int x;
int main(void) {
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
while(scanf("%d", &x) != EOF) {
int cup1=0, cup2=0, cup3=0;
switch(x) {
case 1:
cup1 = 5;
break;
case 2:
cup2 = 5;
break;... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | e6359495dda62276e1927eb53a00e48e | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int main()
{
int n, i;
int a[3] = {0};
FILE *fp1, *fp2;
fp1 = fopen("input.txt", "r");
fp2 = fopen("output.txt", "w");
fscanf(fp1, "%d", &n);
a[n - 1]++;
for (i = 0; i < 3; i++) {
int x, y, tmp;
fscanf(fp1, "%d %d", &x, &y);
tmp = a[x - 1];
a... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | db425f7aa13850893e3ada30edb8da98 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int arr[4]={0},i,a,b,orig;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d",&orig);
arr[orig]=1;
for(i=0;i<3;i++)
{
scanf("%d %d",&a,&b);
if(arr[a]==1 && arr[b]==0)
{
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 8f4e6aac68ddbb56fdf1ef74dfac0491 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
#include <stdlib.h>
int main () {
FILE *fin = fopen ("input.txt", "r");
FILE *fout = fopen ("output.txt", "w");
int fst, cup[4], a, b;
cup[1] = cup[2] = cup[3] = 0;
fscanf (fin, "%d", &fst );
cup[fst] = 1;
fscanf (fin, "%d %d", &a, &b );
cup[a] ^= cup[b]; cup[b] ^... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | c74310e9bda5583e70c15db4a46b2e9c | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
#include <stdlib.h>
main()
{
int n,i,x,y,z;
FILE * f = NULL;
f = fopen("input.txt","r");
fscanf(f,"%d",&n);
x = n;
for (i=0;i<3;i++)
{
fscanf(f,"%d%d",&y,&z);
if (x==y) x = z;
else if (x==... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 573abf6b5efb21f2d9700c99bc34bbb2 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int m ,n, i, s[3] , p [3] ;
int main()
{
freopen ("input.txt","r",stdin);
freopen ("output.txt","w",stdout);
scanf("%d", &n) ;
for ( i = 0 ; i < 3 ; i++)
{
scanf("%d %d", &s[i] , &p[i] ) ;
}
for ( i = 0 ; i < 3 ; i++)
{
if ( n == s[i] )
{
n = p[i] ;
}
else i... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 90f48b8d061f1550f17aaad0676b8d2e | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
FILE *fin , * fout ;
int pos , a ,b , i ;
fin = fopen("input.txt","r");
fout = fopen("output.txt","w");
fscanf(fin,"%d",&pos);
for ( i = 0 ; i < 3 ; i++)
{
fscanf(fin,"%d %d",&a,&b);
if ( pos == a )
{
pos = b ;
co... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | c3301c715f4a707c5bb3a95615ea3008 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int main()
{
FILE *in, *out;
int cups[3] = {1,2,3};
int pos, i, j, k, aux;
in = fopen("input.txt","rt");
out = fopen("output.txt","wt");
fscanf(in,"%d\n",&pos);
for(k=0;k<3;k++)
{
fscanf(in,"%d %d",&i,&j);
aux = cups[i-1];
cups[i-1] = cups[j-1];
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | d6185c2b814f2a86150fa377df6266c3 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,a,b,i,temp;
scanf("%d",&n);
for(i=0;i<3;i++){
scanf("%d %d",&a,&b);
if(a==n){
n=b;
}
else if(b==n){
n=a;
}
}
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 2dec5b91f73204ba04b93d5afe231d91 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int main(int argc, char *argv[])
{
int m, i, j;
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
scanf("%d", &m);
scanf("%d %d", &i, &j);
if(i == m)
m = j;
else if(j == m)
m = i;
scanf("%d %d", &i, &j);
if(i == m)
m = j;
else if(j == m)
m = i;
scanf("%d %... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 87481ad2c004e43a225ca0ac4f188caa | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
int main(void)
{
int n, t, x, y;
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
scanf("%d", &t);
for (n=0; n<3; n++) {
scanf("%d%d", &x, &y);
... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 4a56958cdac848d10aa0b847f70deb43 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
#define NO_OF_SHUFFLES 3
int main()
{
int ball_shell, shell_1, shell_2, i;
FILE *input = fopen("input.txt", "r");
FILE *output = fopen("output.txt", "w");
fscanf(input, "%d", &ball_shell);
for(i = 1; i <= NO_OF_SHUFFLES; i++)
{
fscanf(input,"%d %d",&shell_1, &shell... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 7d301a4d97fb4a7c17e2c233b5e34a7e | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include"stdio.h"
#include"math.h"
int main()
{
int i,p=3,a,b;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d",&i);
while(p--)
{
scanf("%d%d",&a,&b);
if(i==a)
i=b;
else if(i==b)
i=a;
}
printf("%d\n",i);
return 0;
} | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 43e318b088cb2791d530d24396375d00 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int ball_in,cup1,cup2,temp,i;
FILE *fp;
fp=fopen("input.txt","r");
ball_in=fgetc(fp);
temp=fgetc(fp);
for(i=0;i<3;i++)
{
cup1=fgetc(fp);
printf("%d",cup1);
temp=fgetc(fp);
printf("%d",cup1);
cup2=fgetc(fp);
printf("%d",... | |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | b78198b9f25016dc56e537791c23edb7 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include<stdio.h>
int main()
{
int cup, a, b, i;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d", &cup);
for(i=0; i<3; i++){
scanf("%d%d", &a, &b);
if(a==cup){
cup=b;
}
else if(b==cup){
cup=a;
}
}
printf("%d\n", cup);
return 0;
}
| |
Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | In the first line output an integer from 1 to 3 — index of the cup which will have the ball after all the shuffles. | C | 88e6651e1b0481d711e89c8071be1edf | 3b616e1e7b255af71ff0a433c08b7548 | GNU C | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287471600 | ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3"] | null | PASSED | 1,000 | input.txt | 2 seconds | The first input line contains an integer from 1 to 3 — index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 — indexes of the cups which the performer shuffled this time. The cups are numbered... | ["2", "2"] | #include <stdio.h>
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
short pos,shuff[3][2],i;
scanf("%hi",&pos);
for(i=0;i<3;i++)
{
scanf("%hi %hi",&shuff[i][0],&shuff[i][1]);
if(pos==shuff[i][0])
pos=shuff[i][1];
else if(pos==... | |
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2... | Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records. | C | cda1179c51fc69d2c64ee4707b97cbb3 | 8af117fdbbd44d4b3d3a17779b293cb6 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"sortings",
"brute force",
"math"
] | 1532938500 | ["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"] | NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$). | PASSED | 1,500 | standard input | 1 second | The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order. | ["1", "0"] | #include <stdio.h>
#define ll long long
int cmp(const void *a, const void *b) {
int c = *(int *)a;
int d = *(int *)b;
if(c < d)
return -1;
else if (c == d)
return 0;
else
return 1;
}
int main() {
int n;
scanf("%d", &n);
int array[2*n];
for (int i = 0; i < 2*n; i++)
scanf("%d"... | |
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2... | Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records. | C | cda1179c51fc69d2c64ee4707b97cbb3 | 20236909c090fd5871e4a5efa33bff20 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"sortings",
"brute force",
"math"
] | 1532938500 | ["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"] | NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$). | PASSED | 1,500 | standard input | 1 second | The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order. | ["1", "0"] | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int compare(const void *a, const void *b)
{
return (*(int *)a - *(int *)b);
}
int main()
{
int n;
scanf("%d", &n);
int *arr = calloc((2 * n), sizeof(int));
for (int i = 0; i < 2 * n; ++i){
scanf(" %d", &arr[i]);
}
qs... | |
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be... | In the first and the only line of output, print a sequence of numbers of possible winners in increasing order. | C | e54f8aff8ede309bd591cb9fbd565d1f | 8806e3f65d46f4b9d64b230a6f886a6b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"geometry",
"math"
] | 1429029300 | ["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"] | null | PASSED | 2,600 | standard input | 1 second | The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104). | ["1 2 3", "1 3"] | #include<stdio.h>
#define MAXN 200000
int N;
typedef struct{
int index;
int x, y;
} comp_t;
comp_t comp[MAXN];
int good[MAXN];
int good_num;
int db[MAXN];
int comp_cmp(const void *A, const void *B)
{
comp_t *a = (comp_t *)A; comp_t *b = (comp_t *)B;
if(b->x != a->x) return b->x - a->x;
return b->y - a->y... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | d86becaa9e003a2e2c72fa10b3a4d71a | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include <stdio.h>
int n, i, k, b[101], flag=0;
char a[101];
FILE *f, *g;
int main()
{
f=fopen("input.txt", "r");
g=fopen("output.txt", "w");
fscanf(f, "%d", &n);
fscanf(f, "%s", &a);
k=0;
for(i=0; i<n; i++)
if(a[i]=='1'){b[k]=i; k++;}
n=b[1]-b[0];
for(i=1; i<k-1; i++)
if... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | 74838b833c4038fdcbc16aa0d1222a83 | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include <stdio.h>
FILE *f, *g;
int n, j = 0;
char q[101];
int c[98];
int main()
{
f = fopen("input.txt", "r");
g = fopen("output.txt", "w");
fscanf(f, "%d", &n);
fscanf(f, "%s", q);
/*gasesc primul '1'. Numar cati de '0' sunt dupa primul 1 si pana la urmatorul 1. Numarul il atribui primului el... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | 3130f374df9228573ba10829ac86a2e1 | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include <stdio.h>
int n, i, sum = 0, ist, idr, diff, diffc;
char q[101];
FILE *f, *g;
int main()
{
f = fopen("input.txt", "r");
g = fopen("output.txt", "w");
fscanf(f, "%d", &n);
fscanf(f, "%s", q);
ist = 0;
while (q[ist] == '0') ist++;
idr = ist + 1;
while (q[idr] == '0') idr++;
... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | 87aa31084baf42985b31efeaa3147766 | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include <stdio.h>
int main()
{ freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int a,i,k=0,d;
int ara[150];
char s[150];
scanf("%d",&a);
scanf("%s",&s);
for(i=0;i<a;i++)
{
if(s[i]=='1'){
ara[k]=i;
k++;
}
}
for(i=0;i<k-1;i++... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | d478884362da306c127ff7994d3c93bb | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include<stdio.h>
int main(){
int n = 0,start = 0,interval[105] = {0};
int interval_th = 0,no = 0;
char signal[105];
int count = 0;
FILE *fp = fopen("input.txt","r");
FILE *output = fopen("output.txt","w");
while(!feof(fp)){
fscanf(fp,"%d\n%s",&n,signal);
}
//printf("%s\n",signal);
for(int i = 0;i<n;i++)... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | 81c0e0985c546e3d8d0915462cfffd8f | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include<ctype.h>
#include<limits.h>
#include<math.h>
#include<stdbool.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void)
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n;
scanf("%d", &n);
char signal[n + 1];
scanf("%s", signal);
int di... | |
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he ... | If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO. | C | 4fc1ca3517168842cc85d74ba0066598 | 96c2a304c46f11f5112d0f0013ec5e61 | GNU C11 | output.txt | 64 megabytes | train_001.jsonl | [
"implementation"
] | 1287482400 | ["8\n00111000", "7\n1001011", "7\n1010100"] | null | PASSED | 1,300 | input.txt | 2 seconds | The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s. | ["YES", "NO", "YES"] | #include<stdio.h>
#include<stdlib.h>
int judge(char *);
int judge(char *s)
{
int i,k=0;
int a[100]={0};
for(i=0;s[i]!='\0';i++)
{
if(s[i]=='1')
{
a[k++]=i;
}
}
for(i=2;i<k;i++)
{
if(a[i]-a[i-1]!=a[i-1]-a[i-2])
{
return 0;
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | a23bcf1c37f53935cc0bb29faccc45e6 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
int main()
{
int n,cnt,i;
signed long long int x,a;
char c;
scanf("%d %I64d",&n,&x);
for(i=1,cnt=0;i<=n;i++){
getchar();
scanf("%c %I64d",&c,&a);
if(c=='+'){
x=x+a;
}
if(c=='-'){
if(a<=x){
x=x-a;
}... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 82cad59be962b59349b02bd71da08f26 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main ()
{
long long int n,x,d,dst;
char ch;
scanf("%lld %lld",&n,&x);dst=0;
while(n--)
{
getchar();
scanf("%c %lld",&ch,&d);
if(ch=='+')
x+=d;
else
{
if(x>=d)
x-=d;
else dst++;
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 204bf9cd095279d8f9088f2a841bbf0b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | //distressed 失望
//就是一个简单的统计处理!
#include<stdio.h>
int main() {
int n,x;
scanf("%d%d",&n,&x);
int distress=0;
int i;
long long ice_cream=x;
for(i=0;i<n;i++){
char sign[2];
int number;
scanf("%s%d",sign,&number);
if(sign[0]=='+'){
ice_cream+=number;
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | adb37ca3b16092abe1dd0bb584d9ccbf | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
#include<string.h>
int main()
{
long long int n,x,sad,answer;
scanf("%lld %lld\n", &n, &x);
answer = x;
sad = 0;
int cur;
char type;
for (int i = 0; i < n; ++i)
{
scanf("%c %d\n", &type, &cur);
if (type == '+')
{
answer += cur;
}
else if (answer >= cur)
{
answer -= ... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 0213c8d7e72cd03de9a1a0d4553a44ad | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
int n,i,d,count=0;
long long int x;
scanf("%d %I64d",&n ,&x);
char ch;
for(i=0;i<n;i++)
{
scanf(" %c %d", &ch, &d);
if( ch=='+')
{
x=x+d;
}
if( ch=='-')
{
if(x>=d)
{
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 295d779d2826fe636ddeed0554b37bab | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int i,n,x;
long long int num=0,count=0;
char ch,sp;
scanf("%lld%lld",&n,&x);
for(i=0;i<n;i++)
{
scanf("%c%c%lld",&ch,&sp,&num);
if(sp=='+')
x=x+num;
if(sp=='-')
{
x=x-num;
if(x<0)
{
count++;
x=x+num;
}
}
}
printf("%lld %lld",x,count);
r... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | e8c65d543974ca0c57ee7d4a712d402a | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
char c;
long long n,x,t,i,count=0;
scanf("%I64d %I64d",&n,&t);
for(i=1;i<=n;i++)
{
getchar();
scanf("%c %I64d",&c,&x);
if(c=='+')
t=t+x;
else
{
if(x<=t)
{
t=t-x;
}
else
count++;
}
}
printf("%I64d %I64d",t,count);
return 0;
} | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | b12b9f6380b36bdc04301d15d11798ec | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long n,x,i,a,count=0;
char c;
scanf("%I64d %I64d",&n,&x);
getchar();
for(i=0;i<n;i++)
{
scanf("%c %I64d",&c,&a);
getchar();
if(c=='+')
x+=a;
else
{
if(x>=a)
x-=a;
else
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 73c97379b3c1eeb35f84140b3a6a6273 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
#include<math.h>
int main()
{
long long x,n,a,b,count=0,i;
char ch;
scanf("%I64d %I64d",&n,&x);
for(i=0;i<n;i++)
{
scanf(" %c %I64d",&ch,&a);
if(ch=='+') x=x+a;
else if(ch=='-' && a<=x) x=x-a;
else if(ch=='-' && a>x) count++;
}
printf("%I64d ... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 9f84f4cb0e3912a6f859bfeb41058ec2 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
char c[2];
long long int inikay,sum,i,xtra,pack,child,temp;
scanf("%lld %lld",&inikay,&pack);
sum=pack;
child=0;
for(i=0;i<inikay;i++)
{
scanf("%s %lld",c,&xtra);
if(c[0]=='+')
sum+=xtra;
if(c[0]=='-')
{temp=sum;
if(xtra>temp)
{child++;
}
else
sum-=xtra;
}
}
printf("%lld %lld\n... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 60cbde4248f3367fad9703dfdfabec71 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
#include<memory.h>
#include<string.h>
int jia(const char* a,const char*b,char* c);
int jian(const char* a,const char*b,char* c);
char y[1000],sum[1000];
int jia(const char* a,const char*b,char* c)
{
int i,j,k,max,o;
short d,m[1000],n[1000],l[1000];
memset(l,0,1000);
memset(m,0,1000);
memset(n... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 84d20d5bc3fdc461a6e10f6a52320d10 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
main()
{
long long int numchoc , chng , t=0 , initial , line , distress=0 ;
char sign ;
scanf("%I64d %I64d",&line,&numchoc);
while(t<line)
{
scanf(" %c",&sign);
scanf("%I64d",&chng);
if(sign=='+')
{
numchoc+=chng ;
}
els... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | cc88ae8a03a076f77222b9ca32429360 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int i,j,x,n,d=0;
char c[2];
scanf("%lld %lld",&n,&x);
for(i=0;i<n;i++)
{scanf("%s",&c);
scanf("%lld",&j);
if(c[0]=='+')
x=x+j;
else {
if(x-j>=0)
x=x-j;
else d++;
}
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | debb3ab15cbfc3d8d6ed8d3e1b6b1a03 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
#include <stdlib.h>
int main() {
long long n, x, nk = 0, d;
char c;
scanf("%I64d%I64d", &n, &x, &c);
while(n--) {
scanf(" %c%I64d", &c, &d);
if(c == '+') {
x += d;
} else {
if(x >= d) {
x -= d;
} else {
nk++;
}
}
}
printf("%I64d %I64d\n", x, nk);
return 0;
} | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 49e83e841f59bcd04a5647efbea6e1ee | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
int main()
{
//freopen("inp.txt", "r", stdin);
int n;
long long int x;
scanf("%d %lli", &n, &x);
int i;
int distress = 0;
for(i = 0; i < n; i++)
{
char symbol;
//char temp;
long long int d;
//scanf("%c", &temp);
scanf("\n%c %lli", &symbol, &d);
//printf("%c\n", symbol);
if(symbo... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 22643899a068db0e2de4e13a029be4fc | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
long long b;
char s[5];
main(){
int n,a=0,x;
scanf("%d%I64d",&n,&b);
while(n--){
scanf("%s%d",s,&x);
if(s[0]=='+')
b+=x;
else if(b>=x)
b-=x;
else a++;
}
printf("%I64d %d\n",b,a);
} | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 9e0ba1824bd8a3d9f979e6144a330274 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | long long n,x,a,i,l=0;
sign;
main(n)
{
scanf("%d%I64d",&n,&x);
for(i=0;i<n;i++)
{
scanf("%s%I64d",&sign,&a);
if(sign=='+')x+=a;
if(sign=='-'){if(a>x)l++;
if(a<=x)x-=a;}}
printf("%I64d %I64d",x,l);
}
| |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 696ddbe333f4d6a172253cc83091fc65 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
int main()
{
long long int n, x, dem, bal, count, i, j, neu;
char id;
while(scanf("%lld %lld", &n, &x)!=EOF)
{
bal = x;
for(i=0, count = 0; i<n; i++)
{
scanf("\n%c %lld", &id, &neu);
if(id=='+') bal+=neu;
else
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 4f2522b82cd01bc66d14e65b68a1b734 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
int i,n,x;scanf("%d%d",&n,&x);char ch[10];int t;int c=0;long long int m=x;//printf("x=%d\n",x);int m=x;
for(i=1;i<=n;i++)
{
scanf("%s",ch);scanf("%d",&t);//printf("x=%d\n",m);
if(ch[0]=='+')
{
m=m+t;//printf("x=%d\n",m);
}
else
{
if((m-t)>=0)
m=m-t;
else
c++;
//... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 2dfbc19a06f479f811fda191bedbdd42 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
#include <conio.h>
#include <string.h>
#include <math.h>
int main()
{
char s[10000000];
long long int sum=0,i,n,x=0,c=0,len,j=0,b=0;
scanf("%lld%lld",&n,&sum);
for(i=1;i<=n;i++){
scanf("%s%lld",s,&x);
if(s[0]=='+'){
sum+=x;
}
else{
if(sum<x){
c++;
}
else{
sum-=x;
}
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | f4b1c0f248a7642b1fe7597f3f0a04bc | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long n,sum,count=0,x,i;
char ch;
scanf("%I64d%I64d ",&n,&sum);
for(i=1;i<=n;i++)
{
scanf("%c%I64d",&ch,&x);
getchar();
if(ch=='+')
sum+=x;
else
{
if(x<=sum)
sum-=x;
else
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 14e89989babcde7dd2bdc62d533e7186 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
#include <stdint.h>
char buffer[2];
uint64_t d=0,K=0,s=0;
int main() {
scanf("%d%d", &d, &K);
while (scanf("%s", buffer) > 0) {
scanf("%d", &d);
K = *buffer=='+' ? K+d : K<d ? s++,K : K-d;
}
printf("%I64d %d\n", K, s);
}
| |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 29a2a603a6344ccbc2c0eb98c7cd1875 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
#define sf scanf
#define pf printf
#define ll long long
#define sfl2(a,b) sf("%lld %lld",&a,&b)
int main()
{
int t,tc=1;
ll n,m;
sfl2(n,m);
char ch;
ll sum=0,cnt=0,x;
sum+=m;
for(int i=1;i<=n;i++)
{
sf(" %c %lld",&ch,&x);
if(ch=='+')
{
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 993e4c1460f8c4507edd46247df48497 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
#include<string.h>
struct ice
{
char c[2];
long int y;
};
int main()
{
long long int n,x,i;
scanf("%I64d%I64d ",&n,&x);
struct ice a[n];
for(i=0; i<n; i++)
{
scanf("%s%I64d",a[i].c,&a[i].y);
}
long long int count1=x,count2=0;
for(i=0; i<n; i++)
{
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 5e759d062c6a9ebea6d7b312c14189ed | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
#include<string.h>
int main()
{
long long int i,n,a,b,sum,count;
char str[2];
while(scanf("%I64d %I64d",&a,&b)==2){
sum=b;count=0;
for(i=1;i<=a;i++){
scanf("%s %I64d",str,&n);
if(strcmp(str,"+")==0)
sum=sum+n;
else{
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 79b68bbdb5f0b94503d921297c6e4346 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int count,k=0,n,x,i,j;
char c;
scanf("%lld%lld",&n,&x);
count=x;
for(i=0;i<n;i++)
{
getchar();
scanf("%c%lld",&c,&j);
// printf("%c ",c);
// printf("%ld ",j);
if(c=='+')
count+=j;
if(c=='-')
if(count>=j)
count-=j;
else
k++;
}
printf("%lld %lld"... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 8ccdfa9ad048166fdf25853441c5bbb7 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int n,x,d,i,sum,count=0;
char ch;
scanf("%I64d%I64d%*c",&n,&x);
sum=x;
for(i=0;i<n;i++){
scanf("%c%I64d%*c",&ch,&d);
if(ch=='+'){
sum+=d;
}
else{
if(sum<d){
count++;
conti... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | cf51775623fbf623d1b3df734b1e5e27 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
int main()
{
// 1. read input
int n;
int64_t x;
int d = 0;
scanf("%d %I64d", &n, &x);
for(int i = 0 ; i < n ; i++)
{
char c;
int64_t v;
scanf(" %c %I64d", &c, &v);
if(c == '+')
{
x += v;
... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | e18f79c8c596f4f74dafde7a11ed88b2 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int n,m,count=0,j,i,b;
char c,a;
scanf("%lld%lld",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%c%c%lld",&c,&a,&b);
if(a=='+')
{
m=b+m;
}
if(a=='-')
{
j=m;
m=m-b;
if(m<0)
{
m=j;
count++;
}
}
}
printf("%lld %lld",m,count);
}
| |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 396d0f5a1dcab6869a0bd633f1b7da68 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
int n,i,j,distress=0;
long long int d,x;
scanf("%d %I64d",&n,&x);
char c[100];
for (i=0;i<=n;i++)
{
gets(c);
c[1]='0';
d=atoi(c);
if (d>0) x=x+d;
else if (d<0 && d*(-1)<=x) x=x+d;
else if (d<0 && d*(-1)>x) distress+=1... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 0a5d35231e407f5ff29ec7c4e0bd53e4 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int n,x,sum;
char a[3];
scanf("%lld%lld",&n,&x);
long long int i,d[n],count=0;
sum=x;
for(i=0;i<n;i++)
{
scanf("%s%lld",a,&d[i]);
if(a[0]=='-')
{
if(sum>=d[i])
sum-=d[i];
else
count++;
}
if(a[0]=='+')
sum+=d[i];
}
printf("%lld %lld",sum,count)... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 24eb2922047b3bf1e259ccf4f8098ebe | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
long long int i,n,x,sum=0,cnt=0,a[10001];
char c[10000];
main()
{
scanf("%I64d %I64d",&n,&x);
getchar();
sum=x;
for(i=0;i<n;i++)
{
scanf("%c %I64d",&c[i],&a[i]);
getchar();
}
for(i=0;i<n;i++)
{
if(c[i]== '+')
{
sum=sum... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | d9b1bd5b68a012703a6c2abeb55825de | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include<stdio.h>
int main()
{
long long int n,x,d,stock,count=0;
char sign,dummy;
scanf("%lld %lld",&n,&x);
stock=x;
while(n--)
{
scanf(" %c",&sign);
scanf("%lld",&d);
if(sign=='+')
stock+=d;
else
{
if(stock-d>=0)
stock-=d;
else
count++;
}
}
printf("%lld %lld\n",stock,count);
ret... | |
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the que... | Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress. | C | 0a9ee8cbfa9888caef39b024563b7dcd | 0f8c1e7e1cf491365570f82d6f7cda70 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1466699700 | ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98"] | NoteConsider the first sample. Initially Kay and Gerda have 7 packs of ice cream. Carrier brings 5 more, so now they have 12 packs. A kid asks for 10 packs and receives them. There are only 2 packs remaining. Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed. Carrier br... | PASSED | 800 | standard input | 2 seconds | The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 109). Each of the next n lines contains a character '+' or '-', and an integer di, separated by a space (1 ≤ di ≤ 109). Record "+ di" in i-th line means that a carrier with di ice cream packs occupies i-th place from the start of the qu... | ["22 1", "3 2"] | #include <stdio.h>
int main()
{
int n;
long long x;
scanf("%d %I64d\n", &n, &x);
char direction;
int temp, distressed = 0;
for (int i = 0; i < n; ++i)
{
scanf("%c %d\n", &direction, &temp);
if (direction == '+')
{
x += temp;
}
else
{
if (x >= temp)
{
x -= temp;
}
else
{
di... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 9298d50208dc7b195bb35de3f7a938d6 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include <stdio.h>
#include <stdlib.h>
int comp(const void*,const void*);
int main()
{
int n,max1,max2,min1,min2,i;
scanf("%d",&n);
int num[n];
for(i=0;i<n;i++)
scanf("%d",&num[i]);
qsort((void*)num,n,sizeof(int),comp);
max1=num[n-1],max2=num[n-2],min1=num[0],min2=num[1];
if(max1==ma... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | f88e37603f014b5458c63e9aa3c41cc6 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include<stdio.h>
int main()
{ int n,i,q,j,a[100001],max=0,max1=0,min=100001,min1=100001;
scanf("%d",&n);
for(i=0; i<n; i++) scanf("%d",&a[i]);
if(n==2) printf("0"); else {
for(i=0; i<n; i++) {if(a[i]<min) {min1=min; min=a[i];} else {if(a[i]<min1) min1=a[i];};
if(a[i]>=max) {max1=max; max=a[i];} else {if(a[i... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 1f3b46a521b7fe00a731924fcc08e0d2 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include<stdio.h>
void swap(int *a,int *b)
{
int temp=*a;
*a=*b;
*b=temp;
}
void sort(int a[],int l,int x)
{
if(l>=x)
return;
int c=l,pivot=a[x];
for(int i=l;i<=x;i++)
{
if(a[i]<=pivot)
{
swap(&a[c],&a[i]);
c++;
}
}
sort(a,l,c-2);
sort(a,c,x);
}
int calmin(int a,int b,int c)
{
if(a<b)
{
if(a<c)
return a;
else
return c;... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | a3208c8ec1ea3100c1d8fd66a51ca91a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include <stdio.h>
int main()
{
int i;
long int n,a1=0,b=0,w,q,temp;
scanf("%ld",&n);
long int a[n];
for(i=0;i<n;i++)
{
scanf("\n%ld",&a[i]);
}
int min1=a[0],max2=0,max1=a[0],min2=1000001;
for(i=0;i<n;i++)
{
if(a[i]<min1){ min1=a[i];a1=i;}
if(a[i]>max1) {max1=a[i];b=i;}
}
if(n==2)... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 197867171352ab8b0af29cd7b34a92bd | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include <stdio.h>
int n;
int a[100100];
void merge(int *a, int l, int mid, int r) {
int n1 = mid - l + 1;
int n2 = r - mid;
int L[n1], R[n2];
for (int i = 0; i < n1; i++) L[i] = a[l + i];
for (int i = 0; i < n2; i++) R[i] = a[mid + 1 + i];
int i = 0, j = 0, k = l;
while (i < n1 && j < n... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 366fa584aee60a2cced044b06bf150af | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include<stdio.h>
int main()
{
long long int n,i,a,x=0,y=10000000000000000,z=0,m,k;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&a);
if(a>=x){
z=x;
x=a;
}
if(a<x&&a>z){
z=a;
}
if(a<=y){
m=y;
y... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | adaf3fffa62b5d69bb7bcfebdf03043a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include<stdio.h>
int main(){
int n,max1,max2=0,min1,min2=100005,num,index=0;
scanf("%d",&n);
scanf("%d",&max1);
min1=max1;
for(int i=1;i<n;i++){
scanf("%d",&num);
if(num>=max1){
max2=max1;
max1=num;
} else if(num>max2&&num!=max1){max2=num;}
if(num<=min1){
min2=min1;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | dcf0220300717ea400f808f376f5d965 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include <stdio.h>
int sec_max(int a[], int n, int p)
{ int max;
if(p==0)
{ max=a[1];}
else{
max=a[0];}
for(int i=0;(i<n); i++)
{
if(i==p){
continue;
}
if(max<a[i])
max=a[i];
}
return max;
}
int sec_min(int a[], int n, int p)
{ int... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 471d0a72a871bed4c40db932ebc6213d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include <stdio.h>
int main()
{
int min1 = 100001, min2 = 100001, max1 = 0, max2 = 0;
int n, m;
scanf("%d", &n);
while (n--) {
scanf("%d", &m);
if (m < min1) {
min2 = min1;
min1 = m;
}
else {
if (m < min2)
min2 = m;
... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 93be770b0a54b839d0307a710da8efe6 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include<stdio.h>
int main()
{
int min1=0,max1=0,max2=0,n;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int min2=1000000;
for(int i=0;i<n;i++)
{
if(a[i]>a[max1])
{
max1=i;
}
if(a[i]<a[min1])
{
min1=i;
}
}
for(int i=0;i<n;i++)
{
if(a[i]>max2 && a[i]<=a[max1] && i!=max1)
{
max2=a[i... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 88ab76633f9e8bf029196ace16a26a7b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int minimum(int a, int b) {
if (a < b) {
return a;
}
return b;
}
int main(void) {
int n, i, *a, max, min, new_max, new_min;
scanf("%d",&n);
a = (int*)malloc(sizeof(int)*n);
assert(a);
for (i = 0; i < n && scanf("%d",&a[... | |
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.Let instability of the array be the following value: $$$\max\limits_{i = 1}^{n} a_i - \min\limits_{i = 1}^{n} a_i$$$.You have to remove exactly one element from this array to minimize instability of the resulting $$$(n-1)$$$-elements array. Your task ... | Print one integer — the minimum possible instability of the array if you have to remove exactly one element from the array $$$a$$$. | C | 2eb7234904b28b4793b7c482a2370092 | 2bc2e7c0f81e7ccec831a2139be2e110 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1545921300 | ["4\n1 3 3 7", "2\n1 100000"] | NoteIn the first example you can remove $$$7$$$ then instability of the remaining array will be $$$3 - 1 = 2$$$.In the second example you can remove either $$$1$$$ or $$$100000$$$ then instability of the remaining array will be $$$100000 - 100000 = 0$$$ and $$$1 - 1 = 0$$$ correspondingly. | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^5$$$) — elements of the array $$$a$$$. | ["2", "0"] | #include<stdio.h>
int main(void)
{
int i,n,x,y,min,min1=100000,max=-1,max1=-1,result;
scanf("%d",&n);
int array[n];
for(i=0;i<n;i++)
{
scanf("%d",&array[i]);
if(!i)
min=array[i];
else if(min>array[i])
{
if(min1>min)
min1=min;
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | cf98f30a1ee53d446901fdfa3ce33974 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main()
{
int n,t,i,j,l,r,time;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d",&n);
scanf("%d %d",&l,&r);
time=l;
printf("%d\n",time);
for(j=1;j<n;j++)
{
scanf("%d %d",&l,&r);
if(l>time)
{
time=l;
printf("%d\n",time);
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 930edd42b0c2152001baf8c2de891ee2 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
int main()
{
int test_cases,n,j,k;
int L,r,seconds;
scanf("%d",&test_cases);
for(k=0;k<test_cases;k++)
{
scanf("%d",&n);
seconds=0;
for(j=0;j<n;j++)
{
scanf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.