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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 0671d4334536ce669349e3e47ca9b2c7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t,d;
scanf("%d",&t);
while(t--)
{
int h,m;
scanf("%d%d",&h,&m);
d=1440-((60*h)+m);
printf("%d\n",d);
}
return 0;
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 04f854322504383460edf9f42e901f34 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h> /*primer raboty 12:10:00 + 80 -> 12:11:10*/
struct Time
{
int hour;
int minute;
};
int main()
{
int n, i;
scanf("%d", &n);
struct Time time[n];
for(i = 0; i < n; i++)
scanf("%d %d", &time[i].hour, &time[i... | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 17de26ad22f0db136301abb492d8e327 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main()
{
int h,m,minLeft,testcase;
scanf("%d",&testcase);
for(int i=0;i<testcase;i++)
{
scanf("%d",&h);
scanf("%d",&m);
minLeft=1440-((h*60)+m);
printf("%d\n",minLeft);
}
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 3da6ca5e491c2f8d18c3dc5855bb337d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main(void){
int hour,minutes,cases;
scanf("%d",&cases);
for(int i=0;i<cases;i++){
scanf("%d %d",&hour,&minutes);
printf("%d\n",(24-hour-1)*60+(60-minutes));
}
return 0;
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 6d402402e7cbdead23c318ec81c326fe | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main(void) {
int h,m,t[1439],n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d",&h,&m);
t[i]=((23-h)*60)+(60-m);
}
for(i=0;i<n;i++)
{
printf("%d\n",t[i]);
}
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 7a646ce382bfd6cb31d4f3f9b200f8d0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int tet(int h, int m){
if((0>=h && h>24) || (0>=m && m>60))
return 0;
else return 1;
}
int main(){
int t;
scanf("%d",&t);
for(int i=1;i<=t;i++){
int h,m;
scanf("%d%d",&h,&m);
int sp=(23-h)*60+(60-m);
if(tet(h,m))
printf("%d\n",sp);
}
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 26e469583f7a166ebef4509500b10d00 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] |
#include<stdio.h>
int main()
{
int hour, min, new_year= 1440, result, c_min,i,n;
scanf("%d",&n);
for( i=0 ; i<n ; i++)
{
scanf("%d %d",&hour,&min);
if(0 <= min < 60 && 0 <= hour < 24)
{
c_min = (hour*60) + min;
result = new_year - c_min ;
... | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | c53ab44b7e30cc631281e5aec95335fb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t,i,a,b,h;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d %d",&a,&b);
h=((23-a)*60)+(60-b);
printf("%d\n",h);
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 77974ea34da3a5cead81d76a9c0c9450 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t,h,m;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d%d",&h,&m);
printf("%d\n",((23-h)*60)+(60-m));
}
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | db2466ea8bff526bd0512cf68766826d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] |
#include <stdio.h>
int main()
{ int t,i,arr[3000];
scanf("%d",&t);
for(i=0;i<2*t;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<2*t;i=i+2)
{
printf("%d\n", 1440-(60*arr[i]+arr[i+1]));
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 4cb129af57a2f7270848e93245b59239 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int m,h,ml=0;
scanf("%d %d",&h,&m);
if(h==23)
{
ml+=60-m;
}
else
{
ml+=(24-h)*60;
ml-=m;
}
printf("%d\n",ml);
}
return 0;... | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 2921f14d011ab41e4530d87884ab877e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main()
{ int t;
scanf("%d",&t);
while(t-->0)
{
int h,m,result;
scanf("%d %d",&h,&m);
result=24*60-h*60-m;
printf("%d\n",result);
}
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 2190d132864ce4e49ea8ff4a49fc2884 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int c,i;
scanf("%d", &c);
for(i=0;i<c;i++)
{
int h,m;
scanf("%d%d",&h,&m);
int x=(24-h)*60-m;
printf("%d\n",x);
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 02e3e96dd07a3278ee3bd732cbc3e97e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int c,i;
scanf("%d", &c);
for(i=0;i<c;i++)
{
int h,m;
scanf("%d %d",&h,&m);
int x=(24-h)*60-m;
printf("%d\n",x);
}
return 0;
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 1602bf7b56401c8f332dd3b4cb1e2ba0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int a,b,i,j,n,m,t=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
t=0;
scanf("%d %d",&a,&b);
t=(24-a-1)*60+60-b;
printf("%d\n",t);
}
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 204522a9c316c6c1edba84cb243ac734 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int saat,dakika,i,kactane;
scanf("%d",&kactane);
for(i=0;i<kactane;i++)
{
scanf("%d %d",&saat,&dakika);
printf("%d\n",1440-(saat*60+dakika));
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | e3404fa82ffdf9cc393878291589ae04 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t,h,m,c,i,j,t_min;
scanf("%d",&t);
int arr[t];
if(t>=1 && t<=1439)
{
for(j=1;j<=t;j++)
{
c=0;
scanf("%d%d",&h,&m);
for(i=h;i<24;i++)
c++;
if(m==60)
{
... | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 3095bdd2b78bfff293eedd0ff206ad2f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t,i,h,m;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d%d",&h,&m);
printf("%d\n",1440-h*60-m);
}
return 0;
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 50d0dfa6c64d1e9dfcf8067e1c8001c8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int h,m,t;
scanf("%d",&t);
while(t--){
scanf("%d%d",&h,&m);
printf("%d\n",((24-h)*60-m));
}
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 262eed535803742e76b0e9404646657e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t,h,m,i,x,y;
scanf("%d",&t);
for(i=1;i<=t;i++){
scanf("%d %d", &h, &m);
x=(h*60)+m;
y=1440-x;
if(y<=0)
y=0;
printf("%d\n",y);
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 0a0f14a17a63e111e53774b30d06e8ad | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main()
{
int t;
int a,b,c,d;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&a,&b);
c=(23-a)*60;
c=c+(60-b);
printf("%d\n",c);
}
return 0;
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | d74a50e500efd27c7430e187737f10cc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
#include <math.h>
int main(){
int t,h,m;
scanf("%d",&t);
while(t--){
scanf("%d%d",&h,&m);
int time_intit = h*60 + m;
int time_exit = 24*60;
int time_req = time_exit - time_intit;
printf("%d\n",time_req);
}
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | b5f196e16b765fc4b017dcf4226ed02d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int h,m;
scanf("%d",&h);
scanf("%d",&m);
int hrleft = 23-h;
int minleft = 60 - m;
int totminleft = hrleft*60 + minleft;
printf("%d\n",totminleft);
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 724caa5cd9250282a97a379971b87a53 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t,h,m,i,x;
scanf("%d",&t);
for(i=1;i<=t;i++) {
scanf("%d%d",&h,&m);
x=1440-((h*60)+m);
printf("%d\n",x);
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 1b0bab0fac85aaf6cf17fba93acf5b94 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main ()
{
int t,i=1,h,m,x;
scanf("%d", &t);
while(i<=t){
scanf("%d%d", &h, &m);
x=1440-(h*60+m);
printf("%d\n",x);
i++;
}
return 0;
}
| |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 223a3a2aad238dd9dd4fa1a087e63699 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include<stdio.h>
int main()
{
int t,q,h,m;
scanf("%d",&t);
for(q=0;q<t;q++){
scanf("%d%d",&h,&m);
printf("%d\n",(24-h)*60-m);
}
return 0;
} | |
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh < 24$$$ and $$$0 \le mm < 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k... | For each test case, print the answer on it β the number of minutes before the New Year. | C | f4982de28aca7080342eb1d0ff87734c | 2a166cbdbb17ba6b7ba275039557e6c1 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1577552700 | ["5\n23 55\n23 0\n0 1\n4 20\n23 59"] | null | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h < 24$$$, $$$0 \le m < 60$$$). It is guaranteed that this time is not ... | ["5\n60\n1439\n1180\n1"] | #include <stdio.h>
int main()
{
int t,h,m,n,y,i;
scanf("%d", &t);
for (i=1; i<=t; i=i+1)
{ scanf("%d %d", &h, &m);
{
n=60-m;
y=24-(h+1);
} printf("%d\n", y*60+n);
if(h==0&& m==0)
break; }
return 0;
}
| |
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara... | Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses. | C | 9534b468bfb6126fc16b896532ced8c5 | ae9c11b25fce2e6d549ed1fbb081503f | GNU C | standard output | 512 megabytes | train_000.jsonl | [
"dp"
] | 1532938500 | ["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"] | NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1,β0,β1,β1,β1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d... | PASSED | 1,900 | standard input | 1 second | The first line of input contains the only integer n (1ββ€βnββ€β5000)βthe number of the hills in the sequence. Second line contains n integers ai (1ββ€βaiββ€β100β000)βthe heights of the hills in the sequence. | ["1 2 2", "0 2", "0 1 3"] | #include <stdio.h>
int max(int a, int b) {return (a>b?a:b);}
int min(int a, int b) {return (a<b?a:b);}
int n, a[5002], dp[5001][2501][2];
int main() {
int i, j;
scanf("%d", &n);
for (i = 1 ; i <= n ; i++) scanf("%d", &a[i]);
for (i = 0 ; i <= 5000 ; i++) {
for (j = 0 ; j <= 2500 ; j++) {
dp[i][j][0] = dp[i]... | |
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin... | Print the string that satisfies all the constraints. If there are multiple answers, print any of them. | C | fbde86a29f416b3d83bcc63fb3776776 | 1539eaf7f1d61c8b7dfdeaf4419bac82 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms"
] | 1493909400 | ["2", "3"] | NoteA palindrome is a sequence of characters which reads the same backward and forward. | PASSED | 1,000 | standard input | 1 second | The first line contains single integer n (1ββ€βnββ€β2Β·105)Β β the length of the string. | ["aa", "bba"] | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main() {
int n,i;
scanf("%d",&n);
for (i = 0; i < n/4; ++i)
{
printf("a");
printf("b");
printf("b");
pri... | |
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin... | Print the string that satisfies all the constraints. If there are multiple answers, print any of them. | C | fbde86a29f416b3d83bcc63fb3776776 | 3a58e7daea49f341c33675d274f16602 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms"
] | 1493909400 | ["2", "3"] | NoteA palindrome is a sequence of characters which reads the same backward and forward. | PASSED | 1,000 | standard input | 1 second | The first line contains single integer n (1ββ€βnββ€β2Β·105)Β β the length of the string. | ["aa", "bba"] | #include<stdio.h>
char a[5]="aabb";
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i=0; i<n; i++)
{
printf("%c",a[i%4]);
}
printf("\n");
}
}
| |
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin... | Print the string that satisfies all the constraints. If there are multiple answers, print any of them. | C | fbde86a29f416b3d83bcc63fb3776776 | 20be257edc6949649a66c46160e1bf6b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms"
] | 1493909400 | ["2", "3"] | NoteA palindrome is a sequence of characters which reads the same backward and forward. | PASSED | 1,000 | standard input | 1 second | The first line contains single integer n (1ββ€βnββ€β2Β·105)Β β the length of the string. | ["aa", "bba"] | #include<stdio.h>
char a[5]="aabb";
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
if(n==3)
printf("bba\n");
else
for(int i=0; i<n; i++)
{
printf("%c",a[i%4]);
}
printf("\n");
}
}
| |
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin... | Print the string that satisfies all the constraints. If there are multiple answers, print any of them. | C | fbde86a29f416b3d83bcc63fb3776776 | 2cb9aad3fee39c77678db8b65f253708 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms"
] | 1493909400 | ["2", "3"] | NoteA palindrome is a sequence of characters which reads the same backward and forward. | PASSED | 1,000 | standard input | 1 second | The first line contains single integer n (1ββ€βnββ€β2Β·105)Β β the length of the string. | ["aa", "bba"] | #include <stdio.h>
#include<string.h>
#define si(a) scanf("%d",&a);
#define sl(a) scanf("%lld",&a);
#define ss(a) gets(a);
#define rep(i,start,n) for(i=start;i<n;i++)
#define debugl(a) printf("%lld\n",a);
#define debugi(a) printf("%d\n",a);
int main()
{
long long int t;
sl(t);
if(t==2)printf("aa");
e... | |
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin... | Print the string that satisfies all the constraints. If there are multiple answers, print any of them. | C | fbde86a29f416b3d83bcc63fb3776776 | 4a499e0823e0d47342d7c61fd26a52c6 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms"
] | 1493909400 | ["2", "3"] | NoteA palindrome is a sequence of characters which reads the same backward and forward. | PASSED | 1,000 | standard input | 1 second | The first line contains single integer n (1ββ€βnββ€β2Β·105)Β β the length of the string. | ["aa", "bba"] | #include <stdio.h>
#include<stdlib.h>
int main()
{
int i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%4==1 || i%4==2)
printf("a");
else
printf("b");
}
printf("\n");
return 0;
}
| |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | 98a4f627a095e78657a56519cfee17c9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
int main()
{
int a[10000],n,m,i,sum=0,j,yes;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<n;i++){
for(j=0;j<n-i;j++)
{
if(a[j]>a[j+1])
{
yes=a[j];
a[j]=a[j+1];
a[j+1]=yes;
}
}}
for(i=0;i<m;i++)
{
sum+=a[i];
}
printf("%d",sum);
return 0;
}
| |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | b36334e9c6a9fa8c0e93f32f0c2c0870 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
int a[100001],srx;
void abcd(int l,int r)
{int i=l,j=r,t;
int p=a[(l+r)/2];
while(i<=j)
{
while(a[i]<p)
{i++;}
while(a[j]>p)
{j--;}
if(i<=j)
{t=a[i];
a[i]=a[j];
a[j]=t;
i++;
j--;}
}
if(l<j)
abcd(l,j);
if(i<r)
abcd(i,r); }
int main()
{
int i,n,k;
scanf("%d%d",&n,&k);
for(i=... | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | 97abee7f2aefcf8c1aaa434f633f6f50 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
int str[2222];
void quiksort(int a[],int low,int high)
{
int i = low;
int j = high;
int temp = a[i];
if( low < high)
{
while(i < j)
{
while((a[j] >= temp) && (i < j))
{
j--;
}
a[i] = a[j];
... | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | 2654a790af08fcfb3d7915147647b7a5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
int main()
{
int n,k,a[2201],i,j,ans=0,c;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
{
for(j=0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
c=a[j];
a[j]=a[j+1];
a[j+... | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | 04b22ed0235b4938a214f1ab64f408bb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include <stdio.h>
int main() {
int i, k, n, val;
long long int sum = 0;
int ar[10001];
scanf("%d", &n);
scanf("%d", &k);
for(i = 0; i <= 10000; i++)
ar[i] = 0;
for(i = 0; i < n; i++) {
scanf("%d", &val);
ar[val]++;
//printf("%d %d ", val, ar[val]);
}
i = 0;
n = 0;
while(i < k) {
if(ar[n] > 0)... | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | ce4d5ee63f27f106dd95f34a6d12f11b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
int main()
{
long long int n,k,i,j,t,s=0,a[3000];
scanf("%lld %lld",&n,&k);
for(i=1;i<=n;i++)
{scanf("%lld",&a[i]);}
for(i=1;i<=k;i++)
{for(j=1;j<=n-i;j++)
{if(a[j]<a[j+1])
{t=a[j+1];
a[j+1]=a[j];
a[j]=t;
}
}
}
for(i=n;i>n-k;i--)
... | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | fe1dcd0af5a651d879c4c770c9249417 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
int main()
{
int i, j, n, k, sum=0;
scanf("%d %d", &n, &k);
int a[n];
for(i=0; i<n; ++i) scanf("%d", &a[i]);
for(i=0; i<n-1; ++i) {
for(j=i+1; j<n; ++j) {
if(a[i]>a[j]){
a[i] = a[i]^a[... | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | fdc8bafa05c4a7f052325ce0ed2e7078 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
int main()
{
int n,a[10000],k,i,j,t,sum=0;
scanf("%d %d",&n,&k);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
for(i=0;i<k;i++)
{
sum+=a[i];
}
printf("%d",sum);
return 0;
} | |
The marmots have prepared a very easy problem for this year's HC2 β this one. It involves numbers n, k and a sequence of n positive integers a1,βa2,β...,βan. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also rea... | Output one number. | C | 5097e92916e49cdc6fb4953b864186db | bca8fd7f98d1e998050697b5bef892d3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"greedy"
] | 1495958700 | ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line of the input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan (1ββ€βaiββ€β104). | ["5", "7", "10", "36", "100"] | #include<stdio.h>
#include<stdlib.h>
int fun(int [],int ,int );
int cmp(const void *,const void *);
int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int fun(int a[],int n,int k)
{
int i,ans=0;
qsort(a,n,sizeof(a[i]),cmp);
for(i=0;i<k;i++)
{
ans=ans+a[i];
}
return ... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | 0f020fb4b14b9b1404bc22e6667217ea | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include<stdio.h>
#include<math.h>
int main()
{
long x,n,k,i,j,z=0,t;
scanf("%ld",&t);
while(t--){
scanf("%ld",&n);
z=1;
i=2;
j=1e9;
while(j>0){
z=pow(2,i)-1;
j=(n%z);
i++;
}
printf("%ld\n",(n/z));
}
}
| |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | 1837c1210acbcc9212baf87724a249d2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include <stdio.h>
int main(void)
{
long long t, n, initial, sum;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
initial = 4;
sum = 3;
while(n%sum != 0)
{
sum+=initial;
initial*=2;
}
printf("%lld\n",n/sum);
}
... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | dabc09eaca2455e1ef27ae309524e462 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d\n",&t);
while(t--)
{
long i,n,p=1,power,num;
scanf("%ld\n",&n);
long *a=(long *)malloc(sizeof(long));
a[0]=3;
i=0;
power=2;
while(a[i]<=n)
{
power=power*2;
... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | 84959501e55c2022f33f7ca314f5801e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include <stdio.h>
#include<math.h>
int main()
{
int t;
scanf("%d" ,&t);
while(t--){
long long int n,i,c=0,d=0;
scanf("%lld" ,&n);
d=(int)(log(n+1)/log(2));
for(i=2;i<=d+1;i++){
c=pow(2,i)-1;
if(n%c==0){
... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | c3f257ccba5fee0c5bf279e1b9897b92 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include<stdio.h>
#include<stdlib.h>
long long int candies(long long int n);
int main()
{
int test,i;
scanf("%d ",&test);
long long int arr[test];
for(i=0;i<test;i++)
{
scanf("%lld",&arr[i]);
}
for(i=0;i<test;i++)
{
printf("%lld\n",candies(arr[i]));
}
}
long long int ... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | dd5856660df9aeebb28dec53fcfdec94 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include<stdio.h>
#include<math.h>
int main()
{
int t;
scanf("%d",&t);
while(t>0)
{
long long n,sum=0,i,x=0,k;
scanf("%lld",&n);
for(k=2; ; k++)
{
i=n/(pow(2,k)-1);
for(i=i;i>0; i--)
{
sum=i*(pow(2,k)-1);
... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | f017e649ce9b5b56a1c713e2ed403244 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include<stdio.h>
#include<malloc.h>
#include<math.h>
int main()
{
int flag=0,i;
int cases,k=2,z,rem;
int *arr;
double n,x;
scanf("%d",&cases);
arr=( int*)malloc(cases*sizeof(int));
for(i=0;i<cases;i++)
scanf("%d",&arr[i]);
for(i=0;i<cases;i++)
{
flag=0;k=2;
n=(do... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | 68daf7d72e4b8a0d197a78dbb141ba98 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include<math.h>
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
int n;
long k;
scanf("%d",&n);
for(k=2;;k++)
{
if(n%((long)pow(2,k)-1)==0)
break;
}
printf("%lu\n",(n/((long)pow(2,k)-1)));
}
return 0;
}
| |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | b49476b1a5be8bd4557dc3b0b82923d6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include <stdio.h>
#include<math.h>
int main(void) {
int t;
scanf("%d",&t);
while(t)
{
long long int a,n,temp=3,i=2;
scanf("%lld",&n);
while(n%temp!=0)
{
temp=temp+pow(2,i);
i++;
}
a=n/temp;
printf("%lld\n",a);
... | |
Recently Vova found $$$n$$$ candy wrappers. He remembers that he bought $$$x$$$ candies during the first day, $$$2x$$$ candies during the second day, $$$4x$$$ candies during the third day, $$$\dots$$$, $$$2^{k-1} x$$$ candies during the $$$k$$$-th day. But there is an issue: Vova remembers neither $$$x$$$ nor $$$k$$$ b... | Print one integer β any positive integer value of $$$x$$$ so there is an integer $$$k>1$$$ that $$$x + 2x + 4x + \dots + 2^{k-1} x = n$$$. | C | d04cbe78b836e53b51292401c8c969b2 | e06ee8c186add66ea6e3e1cf60ee3387 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force",
"math"
] | 1587479700 | ["7\n3\n6\n7\n21\n28\n999999999\n999999984"] | NoteIn the first test case of the example, one of the possible answers is $$$x=1, k=2$$$. Then $$$1 \cdot 1 + 2 \cdot 1$$$ equals $$$n=3$$$.In the second test case of the example, one of the possible answers is $$$x=2, k=2$$$. Then $$$1 \cdot 2 + 2 \cdot 2$$$ equals $$$n=6$$$.In the third test case of the example, one ... | PASSED | 900 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 10^9$$$) β the number of candy wrappers Vova found. It is guaranteed that there is some positive integ... | ["1\n2\n1\n7\n4\n333333333\n333333328"] | #include <stdio.h>
#include<math.h>
int main(void) {
long int t,x,i,j,n,ans=0;
scanf("%ld",&t);
long c[t];
for(i=0;i<t;i++)
scanf("%ld",&c[i]);
for(i=0;i<t;i++){
n=0;
for(j=2;n<=c[i];j++){
n=pow(2,j)-1;
x=c[i]%n;
if (x==0)
{ans=c[i]/n;
break;}}
printf("%ld\n",ans);
}
r... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | cfd78b31d3adc942a9199f9ad5277d24 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include<stdio.h>
#include<string.h>
int p[1000001];
char s[1000005];
int x[27];
int main()
{
scanf("%s",&s);
int len=0;
p[len]=0;
int i=1;
int length=strlen(s)-1;
while(i<strlen(s))
{
if(s[i]==s[len])
{
len++;
p[i]=len;
i++;
}
... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | 5322dc0711dec1a1e1253b588e9602ce | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
#define D 10007
char in[1100000];
ull hs, st[1100000], ed[1100000];
ull pw[1100000];
int main(){
int i,j,k,l,m,n,ok,res;
while(sc... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | 3429c7a868d382b98e82df7daceabc1f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char s[1000005];
int kmp[1000005];
int n;
int
main(void)
{
while(isalpha(s[++n] = getchar()))
;
--n;
kmp[1] = 0;
int i;
for(i = 2; i <= n; ++i){
int len = kmp[i - 1];
while(len > 0 && s[len + 1] != s[i]){
... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | 4c2421f8def60f19d46ae16f830b6ee9 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include <stdio.h>
#include <string.h>
#define EMPTY -1
char s[1000005];
int next[1000005]={EMPTY};
int sum[1000005],lens;
void getnext(void)
{
int i=0,j=EMPTY;
while (i<lens)
if (j==EMPTY || s[i]==s[j]) {
++i;
++j;
next[i]=j;
} else
j=next[j];
... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | 18a162f36ff876981253e2056d0b6183 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define MAX 10001000
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
char str[MAX];
bool valid[MAX];
int n, Z[MAX], ar[MAX];
int main(){
int i, j, k, l, r, p;
while (scanf("%s", str) != EOF){
n = strl... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | ec6114bbd846a99a1f8d37726c6c437b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 1000009
int z[N];
char str[N];
int maxz[N];
int max(int a,int b){return a>b?a:b;}
int main()
{
int n,i,j;
int L=0,R=0;
scanf("%s",str);
n = strlen(str);
for(i=1;i<n;i++)
{
if(i>R)
{
L=i;
R=i... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | d5e0ab2fd0aeb1afa84652c0d0d6e93e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | // Author: Ernesto Carvajal Lastres. Madrid, Spain.
#include <stdio.h>
#include <string.h>
#define maxn 1000002
char s[maxn]; int pre[maxn]; int mark[maxn];
int main()
{
gets(s + 1);
int len = strlen(s + 1) + 1;
int j = 0, i;
for (i = 2; i < len; i++)
{
while (j > 0 && s[j + 1] != s[i]) j ... | |
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | C | fd94aea7ca077ee2806653d22d006fb1 | 9fe195217727deac41dfea6bb9c16a0a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | 1320858000 | ["fixprefixsuffix", "abcdabc"] | null | PASSED | 1,700 | standard input | 2 seconds | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | ["fix", "Just a legend"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAXN 2000015
void KMP (char data[MAXN], int N, int a[MAXN])
{
a[0] = 0;
int i, j, cnt;
for (i = 1; i < N; i++)
{
j = a[i-1];
while (j > 0)
{
if (data[j] == data[i]) break;
j = a[j-1];
}
cnt = j;
if (data[j] == data[i]) cnt++;
a[... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 23753ebae7b8aa6fd4a1eb29c4ed9e37 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
long n,i,s,max=-20;
scanf("%ld",&n);
long a;
for(i=0;i<n;i++){
scanf("%ld",&a);
if(max<a)
max=a;
}
printf("%ld",max);
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 8a355be22903df6a670f7bd7a688fdfc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main ()
{
int n,i,max=-9999,x;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d",&x);
if(max<x) max=x;
}
printf("%d",max);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 526f0a860bbe25cc91e9ca3f9d046dfc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
main () {int i,a,max=0,c; scanf("%d",&a);for(i=0;i<a;i++){scanf("%d",&c);if(c>max)max=c;}printf("%d",max); return 0;}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 24eff8b4fa14527b33808d57ad36cea9 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int m(int prev,int money,int energy,int itr,int size);
int main()
{
int n,i;
scanf("%d",&n);
i= m(0,0,0,0,n);
printf("%d\n",i);
return 0;
}
int m(int prev,int money,int energy,int itr,int size){
if(itr==size) return money;
int curr,energyn; scanf("%d",&curr);
energyn= energy+ prev-curr;
if(e... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | d3f25a807a165a8590c29d891fcf9d36 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int m(int prev,int money,int energy,int itr,int size);
int main()
{
int n,i;
scanf("%d",&n);
i= m(0,0,0,0,n);
printf("%d\n",i);
return 0;
}
int m(int prev,int money,int energy,int itr,int size){
if(itr==size) return money;
int curr,energyn; scanf("%d",&curr);
energyn= energy+ prev-curr;
if(e... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | f805fb8203efe2612ce2aa9c6887aadc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int h[100000], i;
for(i = 0; i < n; ++i) scanf("%d", &h[i]);
long long sum = -h[0], min = -h[0];
for(i = 1; i < n; ++i){
sum += h[i-1] - h[i];
if(sum < min) min = sum;
}
printf("%I64d\n", -min);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | aa375cce3002494e1b5ef7eae405c1c7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main(){
int n, in, max = 0;
scanf("%d", &n);
while(n-- > 0){
scanf("%d", &in); if(in > max) max = in;
}
printf("%d\n", max);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 6228fc7e77e2b976f095494a30721230 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
int dollars,n,pylon[100000],i,energy,height,flag;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
scanf("%d",&pylon[i]);
energy=0;
height=0;
dollars=0;
for(i=0;i<n;i++)
{
flag=0;
if(energy>=(py... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | bf494e54f1bc4d267c5219b8d946fa2b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | /*BISMILLAHIRRAHMANIRRAHIM*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<time.h>
#define max(x,y) ((x>y) ? (x) : (y))
#define min(x,y) ((x<y) ? (x) : (y))
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define ROF(i,a,b) for(i=a;i>=b;i--)
#define Pi(x) printf("%d",x)
#define S1(x) scanf("%... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 075b2c1ecba492e758afc20b60328b1c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main()
{
int n,i,j,sum=0,energy=0;
scanf("%d",&n);
int a[n+1];
a[0]=0;
for(i=1;i<n+1;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
if(a[i]<a[i+1] && energy==0)
sum = sum + a[i+1]-a[i];
else if(a[i]>=a[i+1])
energy = energy +a[i]... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 1ad1a3d4a7581199badc2b224dd9df6d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
long long int n,i,j,t,max=0;
scanf("%lld",&n);
long long int ara[100000];
for(i=0;i<n;i++)
{
scanf("%lld",&ara[i]);
if(ara[i]>max)
{
max=ara[i];
}
}
printf("%lld\n",max);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | e0a87d57779d86fb9078a02145b7b8dc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
int n,i,count=0,count1=0;
scanf("%d",&n);
int arr[n+1],check[n];
arr[0] = 0;
for(i=1;i<=n;i++)
{
scanf("%d",&arr[i]);
check[i-1] = arr[i-1] - arr[i];
}
//for(i=0;i<n;i++)
// printf("%d\n",check[i]);
for(i=0;i<n;i++)
{
if(check[i]>=0)
count += check[i];
// printf("%d\... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 96b4105b8d4c6b6d1f65329cb175abfc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
int n,i,s=0,a;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
if(a>s)
s=a;
}
printf("%d",s);
} | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | d51bc50c28c6dbfd0732526a68783ef0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
long long int n,i,s=0,a,b=0;
scanf("%I64d",&n);
for(i=1;i<=n;i++)
{
scanf("%I64d",&a);
if(a>s)
s=a;
}
printf("%I64d",s);
} | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 2939a62ea33dda5d4108c0d381d3d1f1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | p,m;main(n){scanf("%d",&n);while(n--){scanf("%d",&p);m=m<p?p:m;}return printf("%d",m)?0:0;} | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 13d13509d770347acc1e0d239957a7fe | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | p,m;main(n){scanf("%d",&n);while(n--){scanf("%d",&p);m=m<p?p:m;}printf("%d",m);return 0;}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | fd8129642eca38d30ff7e7b3e2d5bc26 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int i;
int minmoney = 0 ;
int h[100010];
h[0] = 0;
for ( i = 1 ; i < n+1 ; i ++){
scanf("%d",&h[i]);
}
int energy = 0;
for ( i = 0 ; i < n ; i ++ ){
if ( energy + h[i] - h[i+1] < 0 ){
minmoney +... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 89d9e8409a7bc695a8d7ba7d2689a731 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main ()
{
int i,n,x[200000],cost,z,e,max=-1;
scanf("%d",&n);
for(i=1;i<=n;i++) {
scanf("%d",&x[i]);
if(x[i]>max) {
max=x[i];
}
}
cost=max;
printf("%d\n",cost);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | bfd601efcc118bf08b04ac7d37e6efa1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main()
{
int i,n,a,max;
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&a);
if (a>max) max=a;
}
printf("%d",max);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | e58373557f0977a7d0c889f0b2eb8844 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main()
{
int n;
int i,j,val;
int money = 0,energy = 0;
scanf("%d",&n);
int hPrev = 0;
for(i=0;i<n;i++){
scanf("%d",&val);
if((hPrev - val)>=0){
energy += (hPrev - val);
// printf("Energy1 = %d\n",energy);
}
else{
int a = val- hPrev;
if(energy - a >=0){
energy -=... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 229c0be7926335e35aa3115f1c96618d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
int n, num, hold=0, sum=0, i, prev=0;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &num);
if(hold<=num-prev){
sum+= num - prev ;
sum += - hold;
hold=0;
}
else{
hold+=prev-num;
}
... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | c4e14e3719c4d5701948aeb4033b1374 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main(){
int n, prev = 0, actual, res = 0, energy = 0;
scanf("%d", &n);
while(n--){
scanf("%d", &actual);
energy += -(actual-prev);
if(energy < 0){
res -= energy;
energy = 0;
}
prev = actual;
}
printf("%d\n", res);
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 07ef9033bb936a46e9db69a6daaa32ac | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
#define MAX(a, b) ((a > b) ? a : b)
int main(){
int n, res = 0, aux;
scanf("%d", &n);
while(n--){
scanf("%d", &aux);
res = MAX(res, aux);
}
printf("%d\n", res);
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | f45d1dfcd62fc0ee9f3c05749434292c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main(){
long int n,m=0,k=0;
scanf("%ld",&n);
int i;
for(i=0;i<n;i++)
{
scanf("%ld",&k);
if(m<k)
m=k;
}
printf("%ld",m);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | b9febb2420e7d210f51fd8854847d9e8 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
#include<math.h>
int height[100001];
int main()
{
int n,i,abso,diff=0;
int ans=0,energy=0;
scanf("%d",&n);
height[0]=0;
for(i=1;i<=n;i++)
{
scanf("%d",&height[i]);
}
ans=0,energy=0;
for(i=1;i<=n;i++)
{
diff=height[i-1]-height[i];
if(diff>=0)
energy+=diff;
else
{
abso=-diff... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | c7a0a32c168adadbd2da1e15255cd654 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
long long n,x,temp,diff,i,energy=0,amt=0;
scanf("%lld",&n);
for(i=0;i<n;++i)
{
scanf("%lld",&x);
if (i==0)
{ amt+=x;
temp=x;
}
else
{
diff=temp-x;
temp=x;
energy+=diff;
if (energy<0)
{ amt+=(-energy);
energy=0;}
}
... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 50ea99d6bdf1d97b1366afce56839c5f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | /*
* util.c
*
* Created on: 30 οΏ½οΏ½οΏ½οΏ½ 2014 οΏ½.
* Author: ulgish
*/
#define DEBUG
#define TIME_COMPUTE
#define START_TIME \
clock_t _start_time = clock();
#define END_TIME \
_start_time = (clock() - _start_time);\
long ms = _start_time % CLOCKS_PER_SEC;\
_start_time = _start_time / CLOCKS_PER_SEC;\
printf... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 5a7ef0be0c07736679086687110ad8b2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
long long int n,a[1000000],i;
a[0]=0;
scanf("%I64d",&n);
for(i=1;i<=n;i++)
{
scanf("%I64d",&a[i]);
}
int count=0,e=0;
for(i=1;i<(n+1);i++)
{
e=e-a[i]+a[i-1];
while(e<0)
{
e++;
count++;... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 67c153111dba936057ff7ef9929c54d8 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main(){
int n,a[1000005],i,b,max=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
if(max<a[i])
max=a[i];
}
printf("%d\n",max);
return 0;
} | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 6f20fba0fe9fac9431dbd50d95d9afe2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | /*#include<stdio.h>
int n,s,x[105],y[105],i,j,t=0,b=0,min;
int main(){
scanf("%i%i",&n,&s);
for(i=1;i<=n;i++){
scanf("%i%i",&x[i],&y[i]);
if(y[i]!=0)b=i;
}
for(i=1;i<=n;i++){
if(x[i]+1*(y[i]>0)>s)t++;
}
if(t==n)printf("-1\n");
else{
min=y[b];
for(i=1;i<=n;i++){
if(y[i]<min&&y[i]!=0&&x[i]<=s)min=y[i]... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 092496b7f0494b601ee0f8f4d7bb9caa | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
int i;
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
}
int energy =0;
int min_energy=10000;
for(i=0;i<n-1;i++){
energy = energy + (arr[i]-arr[i+1]);
if(min_energy > energy){
... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 093c5ba5a7dbf72b828d8d01c4895332 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
long ans,n,s,i,j,energy,cuenergy;
long h[100002];
scanf("%ld",&n);
for(i=0;i<n;i++)
scanf("%ld",&h[i]);
energy = 0;
cuenergy = 0;
for(i=0;i<n-1;i++){
if(h[i+1]-h[i]>0)
{
if(cuenergy>=h[i+1]-h[i])
cuenergy = cuenergy - (h[i... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (nβ+β1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (iβ>β0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 7b72193499e7a34dd58e94c564b6c436 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β105). The next line contains n integers h1, h2,β..., hn (1βββ€ββhiβββ€ββ105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int dollars(int a[],int n)
{
int m = a[0] - a[1],i;
int sum = 0;
for(i = 0;i < n - 1;i++)
{
sum += a[i] - a[i+1];
if(sum < m)
m = sum;
}
if(m >= 0)
return a[0];
else
return -(m-a[0]);
}
int main()
{
int n;
scanf("%d",&n);
if(n == 1)
{
int x;
scanf("%d",&x);
printf("%d\n"... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | a366ecdd7ef11572423837636ef362cc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include<stdio.h>
#include<stdlib.h>
void swap(int *v1,int *v2)
{
int t;
t=*v1;
*v1=*v2;
*v2=t;
}
int main()
{
int n,i,j,pos,count=0;
int *p,*t;
scanf("%d %d",&n,&pos);
p=(int*)malloc(n*sizeof(int));
t=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
scanf("%d %d",&p[i],&t[i]);
for(i=0;i<n-1;i++)
{
for... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | 47610a9d06b7e9d613472a33d53cca48 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include<stdio.h>
#define swap(a,b) a^=b; b^=a; a^=b;
int main ()
{
int s=0,i,j,n,k,r[51][2];
scanf("%d%d",&n,&k); k--;
for(i=0;i<n;i++)
scanf("%d %d",&r[i][0],&r[i][1]);
for(i=0;i<n;i++)
{
for(j=0;j<n-i-1;j++)
{
if( r[j][0]<r[j+1][0] || (r[j][0]==r[j+1][0] && r[j][1]>r[j+1][1]) )
{
swap(r[j][0],r... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | 389d170079e8a6675d820cae067a51c3 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include <stdio.h>
int main(){
int temp,n,k,max,count,i,j;
scanf("%d%d",&n,&k);
int p[n];
int t[n];
for(i=0;i<n;i++)
scanf("%d%d",&p[i],&t[i]);
for(i=0;i<n;i++){
max = i;
for(j=i;j<n;j++){
if(p[j]>p[max])
max = j;
else if(p[j]==p[max] && t[j]<t[max])
max = j;
}
temp = p[i];
p[i] = p[... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | 641fc962b29886538d6c84c53fa09b3b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i, a[51][51], num, k, p, t, maxP = 0, count = 0, j, maxT = 0, test = 0;
for (i = 0; i < 51; i++){
for (j = 0; j < 51; j++){
a[i][j] = 0;
}
}
scanf("%d %d", &num, &k);
for (i = 0; i < num; i++){
scanf("%d %d"... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | 2179421f0c33c5027e0439e1da13551f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include <stdio.h>
#include <stdlib.h>
struct team
{
int prob ;
int penality;
};
int main()
{
int n , k , i , counter = 0 , j ;
scanf("%d%d",&n ,&k);
struct team array[n];
struct team temp ;
for(i=0 ; i < n ; i++)
{
scanf("%d",&array[i].prob);
scanf("%d",&array[i].pe... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | 4cb04944b3a610155e35501710bf8a6f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include"stdio.h"
#include"ctype.h"
#include"stdlib.h"
#include"string.h"
struct pair{
long first;
long second;
};
int bm=0;
int k;
struct node{
int c;
struct pair p;
struct node *left;
struct node *right;
};
int compare(struct pair p1,struct pair p2){
if((p1.first>p2.first)|| (p1.first==p2.first && p1.second<p2... | |
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | In the only line print the sought number of teams that got the k-th place in the final results' table. | C | 63e03361531999db408dc0d02de93579 | 9eb60777375cc9e69b14a5b6033e7f98 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"sortings",
"binary search",
"implementation"
] | 1332516600 | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | PASSED | 1,100 | standard input | 2 seconds | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | ["3", "4"] | #include<stdio.h>
void merge_sort(int,int);
struct result
{
int prob;
int time;
};
struct result score[100];
struct result dummy[100];
int main()
{
int i,n,k,j,shared;
shared=-1;
scanf("%d %d",&n,&k);
k--;
for(i=0;i<n;i++)
{
scanf("%d %d",&score[i].prob,&score[i].time);
}
merge_sort(0,n-1);
// for(i=0;i<n;i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.