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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 95e909fe3fb62cecbd7b020d8eec832e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int cmp(const void *a,const void *b)
{
return *(int *)a- *(int *)b;
}
int max(int a,int b)
{
if(a>b)
return a;
return b;
}
int min(int a,int b)
{
if(a<b)
return a;
return b;
}
int mod(int a)
{
if(a<0)
return -a;
return a;
}
int ma... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 3d98b64abeb9a0ddcf92eaf52d4f0e34 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] |
#include <stdio.h>
int main()
{
int n,m;
scanf("%d%d",&n,&m);
int c[n];
for(int i=0;i<n;i++)
{
scanf("%d",&c[i]);
}
int a[m];
for(int i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
int *bill=&a[0];
int count=0;
for(int i=0;i<n;i++)
{
while(bill<=&a[m... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | f448b2a76780c64677b7d62d69f43744 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n,m,i,c,p=0;
long long int sum=0;
scanf("%d %d",&n,&m);
int a[n];
int b[m];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<m;i++)
scanf("%d",&b[i]);
c=b[p];
for(i=0;i<n;i++)
{
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 3f2ff5a3e38925d42751d4b83767e9e5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int m,n,j,i,count=0,a[1001],b[1001];
scanf("%d%d",&m,&n);
for(i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
for(j=0;j<n;j++)
{
scanf("%d",&b[j]);
}
j=0;
for(i=0;i<m;i++)
{
if(a[i]<=b[j])
{ count++;
j++;}
}
printf("%d",count);
return 0;
}
| |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 4e5fab317a662092c05725a34a0aacf1 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n,m,bill[1001],game[1001],j,i,bought=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&game[i]);
}
for(i=0;i<m;i++)
{
scanf("%d",&bill[i]);
}
for(i=0;i<n;i++)
{ if(j<=m){
if(bill[j]>=game[i])
{
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 92bca65d171e56f3aadefdabb999ad5c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
int main()
{
int m, n, c, i, j;
scanf("%d %d", &n, &m);
int a[n], b[m];
for(i = 0; i < n; i++) scanf("%d", a+i);
for(i = 0; i < m; i++) scanf("%d", b+i);
for(i = 0, c = 0, j = 0; i < n && j < m; i++){
if(b[j] >= a[i]){
c++;
j++;
}
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 04b6f6552b3048d20c4d5d0b253a5810 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
//#include<stdlib.h>
int main()
{
int n=0,m=0,i=0,j=0,count=0,a[1000],c[1000];
scanf("%d %d",&n,&m);
//a=(int *)malloc(sizeof(int)*n);
//c=(int *)malloc(sizeof(int)*m);
for(i=0;i<n;i++)
{
scanf("%d",&c[i]);
}
for(i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(c[i]<=a[j])
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 858b79d99b3ab72ae08d554aaf0e4687 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n=0,m=0,i=0,j=0,count=0,*a,*c;
scanf("%d %d",&n,&m);
a=(int *)malloc(sizeof(int)*m);
c=(int *)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
{
scanf("%d",&c[i]);
}
for(i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(c[i]<=a[j])
{
count++;
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 1a5018d3b1ca7aca7c256056d5722184 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n,m;
scanf("%d%d",&n,&m);
int aran[n];
int aram[m];
int flag=0,x=0;
for(int i=0;i<n;i++){
scanf("%d",&aran[i]);
}
for(int i=0;i<m;i++){
scanf("%d",&aram[i]);
}
for(int i=0;i<m;i++){
for(int j=x;j<n;){
if(aram[... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 3a7f6ce8f37915c7ea57c8babd4f8dfa | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
int main()
{
int n,m,a[1001],b[1001],i,j,cnt=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<m;i++){
scanf("%d",&b[i]);
}
i=0;j=0;
while(i!=n&&j!=m){
if(a[i]<=b[j]){
i++;
j++;
cnt++;... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 14972ab0fd2418a6eb43204b5125c553 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, m;
int *c, *a;
int i, j, count = 0;
scanf("%d %d", &n, &m);
c = malloc(sizeof(int) * n);
a = malloc(sizeof(int) * m);
for(i = 0; i < n; i++)
{
scanf("%d", &c[i]);
}
for(i = 0; i < m; i++)
{
scanf("%d", &a[i]);
}
for(i = 0, j = 0; i... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | b76d6b971371b109056dc86c38acd5a4 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int a,b,count=0;
scanf("%d %d",&a,&b);
int aa[a],ab[b],i,j=0;
for(i=0;i<a;i++)
scanf("%d",&aa[i]);
for(i=0;i<b;i++)
scanf("%d",&ab[i]);
for(i=0;i<a;i++){
for(;j<b;){
if(aa[i]<=ab[j]){
count++;
j++;... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 38e380c90fa359402b2d40652eb60f8a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int i,j,k[10000],a,b,count=0,l[10000],c=0;
scanf("%d %d",&a,&b);
for(i=0;i<a;i++)
{
scanf("%d",&k[i]);
}
for(j=0;j<b;j++)
{
scanf("%d",&l[j]);
for(c=c;c<a;c++)
{
if(l[j]>=k[c])
{
count++;
c=c+1;
break;
}
}
}
p... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 49041abfe8f3caa893588a1eee3c12ca | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
#include <math.h>
int main ()
{int n,m,i,j,a[1000],c[1000];
scanf ("%d",&n);
scanf ("%d",&m);
for (i=0;i<n;i++)
scanf ("%d",&c[i]);
for (j=0;j<m;j++)
scanf ("%d",&a[j]);
int com=0;
i=0;
j=0;
while(i<n && j<m)
{if (a[j]>=c[i])
{i++;
j++;
com++;}
else
i++;}
printf ("%d",com);
} | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | a93373b54399dc3c32fb94521b9e5dcc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*********... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 71c3083dacd0d78ea5ec077cb4fce5e0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
int main(){
int n = 0, m = 0, j[1001]={}, d[1001]={}, i =0, z = 0;
scanf("%d %d", &n, &m);
for(i=0;i<n;i++){
scanf("%d", &j[i]);
}
for(i=0;i<m;i++){
scanf("%d", &d[i]);
}
for(i=0, z = 0;i<m && z<n;z++){
if(d[i]>=j[z]){
i++;
}
}
printf("%d\n", i);
return 0;
}
| |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 04bb37502a0b5a54387374bb3c8b8377 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n,m,i,j;
int count=0;
scanf("%d %d",&n,&m);
int c[1010];
int a[1010];
for(i=0;i<n;i++)
{
scanf("%d",&c[i]);
}
i=0;
for(j=0;j<m;j++)
{
scanf("%d",&a[j]);
}
j=0;
for(i=0;i<n;i++)
{
if(a[j]>=c[i])
{
count+=1;
j+=1;
}
if(j>=m)
break;
}
printf("%d... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | a37d47ff31a9e2777302f429a3287b0c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n,m;
int i,j,k=0,games=0,count=0;
int w[1001], c[1001];
scanf("%d %d", &n, &m);
for(i=0; i<n; i++)
{
scanf("%d", &c[i]);
}
for(i=0; i<m; i++)
{
scanf("%d", &w[i]);
}
// First condition
for(i=0; i<n; i++)
{
if(w[0] < c[i])
{
count++;
}
}
if(count==n)
{
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | cd0aa997dbfe77c770d7cd14acc99eb7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int i,j,m,n,count=0;
scanf("%d %d",&n,&m);
int c[n],a[m];
for(i=0;i<n;i++){
scanf("%d",&c[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a[i]);
}
for(i=0,j=0;i<n;i++){
if(j==m) break;
if(a[j]>=c[i]){
count++;
j+... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | bd2f445d95cf4892284733a320a921e2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
#define max 1007
int main()
{
int n, i, count = 0, m, c[max], a[max], front = 0;
scanf("%d %d", &n, &m);
for(i = 0; i < n; i++)
scanf("%d", &c[i]);
for(i = 0;i < m; i++)
scanf("%d", &a[i]);
for(i = 0; i < n && front < m; i++){
if(a[front] >= c[i]){
count++;
front... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 2894bc3d9844ad7c17db1b6c35a97228 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
#define ll long long
int main()
{
int i, j, n, k, r=0, cnt =0,a[10005], b[10005];
scanf("%d%d",&n,&k);
for (i=0;i<n;i++){
scanf("%d",&a[i]);
}
for (i=0;i<k;i++){
scanf("%d",&b[i]);
}
i=0,j=0;
while (j<n){
if(b[i]>=a[j]){
cnt++;
i++;
j++;
}
else j++;
}
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 39a029b48e5fd0864f3f47d45542f6d1 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*int main()
{
char a[100];
int i,j;
scanf("%d",&i);
for(j=0;j<i;j++)
{
scanf("%s",a);
if(strlen(a)>10)
{
printf("%c%d%c\n",a[0],strlen(a)-2,a[strlen(a)-1]);
}
else
printf("%s\n... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 5415d621c645048ed1509dc131e4f5de | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int i=0,j=0,n,a[10000],m,b[10000],c=0,k=0,d[10000],min,e[10000],l=0;
scanf("%d %d",&n,&m);
min=d[0];
e[0]=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<m;i++)
{
scanf("%d",&b[i]);
}
for(i=0;i<n;)
{
for(j=0;j<m;)
{
if(b[j]>=a[i]... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 5dcc034faaef5e6a8d6a153e9cf1ad7b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int x=0,n,m,a[1000],c[1000],i,j=0;
do
scanf("%d%d",&n,&m);
while(n>1000 || m>1000 || n<1 || m<1);
for(i=0;i<n;i++)
scanf("%d",&c[i]);
for(i=0;i<m;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
if(c[i]<=a[j])
{
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 98cb1d18b00c96fdf3980d3703a94149 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n,m;
int i,j,k=0,games=0,count=0;
int w[1001], c[1001];
scanf("%d %d", &n, &m);
for(i=0; i<n; i++)
{
scanf("%d", &c[i]);
}
for(i=0; i<m; i++)
{
scanf("%d", &w[i]);
}
// First condition
for(i=0; i<n; i++)
{
if(w[0] < c[i])
{
count++;
}
}
if(count==n)
{
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 997e267eec555130fd398b14e4e8d2c5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
main()
{
int n,m,i,c,k,j;
scanf("%d %d",&n,&m);
c=0;
k=0;
int a[n];
int b[m];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<m;i++)
scanf("%d",&b[i]);
for(i=0;i<m;i++)
{
for(j=k;j<n;j++)
{
if(b[i]>=a[j])
... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 5719fa6c6766349bd37b2df92a8bcb5a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int c[1000], a[1000], n, m, i, j, count = 0;
scanf("%d %d", &n, &m);
if (n >= 1 && m <= 1000)
{
for (i = 0; i < n; i++)
{
scanf("%d", &c[i]);
}
for (j = 0; j < m; j++)
{
scanf("%d", &a[j]);
}
j=0;
for (i = 0; i < n; i++)
{
if (a[j] >= c[i])
{
cou... | |
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,... | Print a single integer — the number of games Maxim will buy. | C | c3f080681e3da5e1290ef935ff91f364 | 5088d7b72804f3c620d0f6c026b951a0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1531578900 | ["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"] | NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti... | PASSED | 800 | standard input | 1 second | The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g... | ["3", "0", "4"] | #include<stdio.h>
int main()
{
int n, m, cost[1010], bill[1010], i, count=0, j;
scanf("%d%d", &n, &m);
for(i=0; i<n; i++)
{
scanf("%d",&cost[i]);
}
for(i=0; i<m; i++)
{
scanf("%d", &bill[i]);
}
for(i=0,j=0; i<n; i++)
{
if(cost[i]<=bill[j])
{
... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | cab1038b9038f1c5e1f396ce4fe05cbc | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
void Find(int L,int v,int l,int r)
{
int AL,HL,SL;
AL=L/v;
HL=r/v - l/v;
if(l%v==0)
{
HL++;
}
SL=AL-HL;
printf("%d\n",SL);
}
int main()
{
int i,L,v,l,r,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&L);
scanf("%d",&v);
scanf("%d",&l);
scanf("%d",&r);
Find(L,v,l,r);
}
retur... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 65e5b2b37663b47b4edb4efcd7d6cdb0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main ()
{
long long int l,t,v,r,s,x,y,z;
scanf("%lld",&t);
for ( int i=0;i<t;++i)
{
scanf("%lld %lld %lld %lld",&l,&v,&r,&s);
x=l/v;
y=r/v;
z=s/v;
if ((r%v)==0 && (s%v)==0)
{
printf("%lld\n",(x+y-z-1));
}
else if((r%v)==0 && (s%v)!=0)
{
printf("%lld\n",(x+y-z-1));... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 55a9ef96ce3cd199eff995b8bea2a9c7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main (){
int t,l,v,a,b,i=0,m;
scanf("%d",&t);
while(i<t){
scanf("%d %d %d %d",&l,&v,&a,&b);
m=(l/v)-((b/v)-(a/v));
if(a%v==0){
m=m-1;}
i++;
printf("%d\n",m);
}
return 0;
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 892757558fd4459659b80195fe8dbaed | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
long long t,l,v,a,b,x,k;
scanf("%lld",&t);
for(int i=0;i<t;i++)
{
scanf("%lld %lld %lld %lld",&l,&v,&a,&b);
k=l/v;
x=b/v-a/v;
if(a%v==0)
printf("%lld \n",k-x-1);
else
printf("%lld \n",k-x);
}
return 0;
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | b8ebf5e0f07ff7642d972e35e77e08e9 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int t,L,v,r,l,i;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d %d %d %d",&L,&v,&l,&r);
printf("%d\n",(L/v)-(r/v)+((l-1)/v));
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 1ef882f4c2c788cb8d7ba51d45a294e4 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int T;
scanf("%d", &T);
while(T--)
{
int x,n,v,l,r,x1,x2,x3;
scanf("%d%d%d%d", &n,&v,&l,&r);
x=(n-r+l);
x1=n/v;
x2=l/v;
x3=r/v;
if(n-r+l<0)
printf("0\n");
else
{ if(l%v==0)
printf("%d\n", x1+x2-x3-1);
else if(l==r && l%v==0)
{
x1=n/v;
x2=l/v;... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | a87aa80089f32956a8b42b8a0538bc25 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int t,L,v,l,r,i,j,p;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d%d%d%d",&L,&v,&l,&r);
printf("%d\n",(L/v)-(r/v)+(l-1)/v);
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 1f91ac82488aef19e023e0852fa6b244 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
int main() {
int n;
scanf("%d",&n);
for (int i=0;i<n;++i)
{
int k,v,l,r;
scanf("%d %d %d %d",&k,&v,&l,&r);
printf("%d\n",k/v-r/v+(l-1)/v);
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 6635bde654f6103d25ccc187ee90428f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] |
#include <stdio.h>
int main() {
int t;
scanf("%d",&t);
for (int i=0;i<t;++i)
{
int L,v,l,r;
scanf("%d %d %d %d",&L,&v,&l,&r);
printf("%d\n",L/v-r/v+(l-1)/v);
}
return 0;
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | b055ce28c215f153009412e1e7449eb7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
long long int t,L,v,l,r,s,u;
int i,j,k;
scanf("%lld", &t);
for(i=0; i<t; i++)
{
scanf("%lld %lld %lld %lld", &L, &v, &l,&r);
s=(L/v);
if(l%v==0)
{
u=(r/v)-(l/v)+1;
}
else
u=(r/v)-(l/v);
... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | f4f4c5d6df7fc525f51a459bb28db598 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
#include <stdlib.h>
#define MAX 1000001
int compare(const void* a, const void *b){
return (*(int*)a-*(int*)b);
}
void countingSort(int n, int (*v)[MAX]){
int A[MAX], i;
for(i=0;i<MAX;i++){
A[i] = 0;
}
int C[n];
for(i=0;i<n;i++){
A[(*v)[i]]++;
}
for(i=1;i<MAX;i++){
A[i] += A[i-1];
... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | c4339b77486add9ec92f90809d19eb90 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int t;
long L,v,l,r,a,b,c,n;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%ld %ld %ld %ld",&L,&v,&l,&r);
a=L/v;
b=r/v;
c=(l-1)/v;
n=a-(b-c);
printf("%ld\n",n);
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 5fefeb846a4aa4ef7ee53fe81181885c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
int main()
{
int tc;
scanf("%d",&tc);
while(tc--){
long long L,V,l,r,lan,ans,ll,rr;
scanf("%lld%lld%lld%lld",&L,&V,&l,&r);
lan=L/V;
if(V<l){
ll=l%V;if(!ll)lan--;
lan-=((r-l+ll)/V);
}
else if(V>=l&&V<=r){
lan--;
lan-=(r-V)/V;
}
printf("%lld\n",lan);
}
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 973787a8525dadbf0defa66345cf8fae | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
#include<math.h>
int main()
{
int i,t;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
long long int h,v,l,r;
scanf("%I64d %I64d %I64d %I64d",&h,&v,&l,&r);
printf("%I64d\n",(h/v)-(r/v)+(l-1)/v);
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 3a162e320de8739b62346d171d084a16 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int t, L, v, l, r, i,p,q,o;
scanf("%d", &t);
for (i=0; i<t; i++)
{scanf("%d%d%d%d", &L, &v, &l, &r);
p=L/v;
q=r/v;
o=(l-1)/v;
p=p-q+o;
printf("%d\n",p);
}
return 0;
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | e293497e93a747f7e2aa1f978b2e570f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
int main(){
int t;
scanf("%i", &t);
while(t--){
int l, v, s, e, c = 0, le;
scanf("%i %i %i %i", &l, &v, &s, &e);
c = ((s-1)/v);
if((e+1)%v == 0){
le = (e+1);
}
else{
le = ((e/v)+1)*v;
}
if(le>l){
... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 82b69b81d61f75af9fadb9a8a1a483de | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
#include <math.h>
int main()
{
int n;
int s, v, l, r;
scanf("%d", &n);
int counts;
while(n--){
scanf("%d%d%d%d", &s, &v, &l, &r);
counts = s / v;
int left = l / v;
if(l % v) left++;
int right = r / v;
counts -= (right - left + 1);
printf("%d\n", counts);
}
return 0... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 2276f5df9cbe7a34acb497a25fa1bceb | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
#include <math.h>
int main()
{
int n;
int s, v, l, r;
scanf("%d", &n);
int counts;
while(n--){
scanf("%d%d%d%d", &s, &v, &l, &r);
counts = s / v;
int left = l / v;
if(l % v && l > 0) left++;
int right = r / v;
if(r % v && r < 0) right--;
counts -= (right - left + 1);
... | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | df18c27bb8b9bfde0d6c4ebe41ccfccc | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main(){
int t,L,v,l,r,i,a,b,d;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&L);
scanf("%d",&v);
scanf("%d",&l);
scanf("%d",&r);
a=L/v;
b=r/v;
d=(l-1)/v;
r=a-(b-d);
printf("%d\n",r);
}
return 0;
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 284cc7516709e1c2ee3f6d576c830f3d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
int main(){
int n, L, v, l, r, k, x;
scanf("%d", &n);
for ( int i=1; i <= n; i++){
scanf("%d %d %d %d", &L, &v, &l, &r );
k=( L / v ) + ( l / v ) - ( r / v );
if ( l % v == 0 )
k--;
printf("%d \n", k);
}
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | bc3a20ae3be4cb5cf0be4c57f65fde85 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
int i;
for(i=0;i<t;i++)
{
int L,v,l,r;
scanf("%d %d %d %d",&L,&v,&l,&r);
int no= (L/v) - (r/v) + ((l-1)/v);
printf("%d",no);
if(i!= t-1)printf("\n");
}
return 0;
} | |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 803b106ca83b852ca45c744d949122ca | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
long long int N,x,l,r,m=0,i,j;
scanf("%I64d%I64d%I64d%I64d",&N,&x,&l,&r);
i=(l-1)/x;
j=(N/x)-(r/x);
printf("%I64d\n",i+j);
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 6736608e80dd3a2ac58ecd544c0c9917 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include<stdio.h>
int main (){
int t,l,v,a,b,i=0,m;
scanf("%d",&t);
while(i<t){
scanf("%d %d %d %d",&l,&v,&a,&b);
m=(l/v)-((b/v)-(a/v));
if(a%v==0){
m=m-1;}
i++;
printf("%d\n",m);
}
return 0;
}
| |
Vova plans to go to the conference by train. Initially, the train is at the point $$$1$$$ and the destination point of the path is the point $$$L$$$. The speed of the train is $$$1$$$ length unit per minute (i.e. at the first minute the train is at the point $$$1$$$, at the second minute — at the point $$$2$$$ and so o... | Print $$$t$$$ lines. The $$$i$$$-th line should contain one integer — the answer for the $$$i$$$-th query. | C | 5194846a503c2087fcd299eaf3c20b2b | 1bdd515253afe3ae321cd17640ddb007 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1539354900 | ["4\n10 2 3 7\n100 51 51 51\n1234 1 100 199\n1000000000 1 1 1000000000"] | NoteFor the first example query, the answer is $$$3$$$. There are lanterns at positions $$$2$$$, $$$4$$$, $$$6$$$, $$$8$$$ and $$$10$$$, but Vova didn't see the lanterns at positions $$$4$$$ and $$$6$$$ because of the standing train.For the second example query, the answer is $$$0$$$ because the only lantern is at the ... | PASSED | 1,100 | standard input | 1 second | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of queries. Then $$$t$$$ lines follow. The $$$i$$$-th line contains four integers $$$L_i, v_i, l_i, r_i$$$ ($$$1 \le L, v \le 10^9$$$, $$$1 \le l \le r \le L$$$) — destination point of the $$$i$$$-th path, the period of the l... | ["3\n0\n1134\n0"] | #include <stdio.h>
int main(int argc, char **argv)
{
long long t,l,v,a,b,x,k;
scanf("%lld",&t);
for(int i=0;i<t;i++)
{
scanf("%lld %lld %lld %lld",&l,&v,&a,&b);
k=l/v;
x=b/v-a/v;
if(a%v==0)
printf("%lld \n",k-x-1);
else
printf("%lld \n",k-x);
}
return 0;
} | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | c626e9dd4302ea70f7261a8cbda8cd56 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] | #include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <limits.h>
typedef struct adj {
int vertex;
struct adj *next;
} adjList;
typedef struct {
adjList **vertices;
long long int count[2];
} graph;
graph *newGraph(size_t tam) {
graph *graph = malloc(sizeof(graph));
int i;
gr... | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | 783645d76d7effbda190d8184a2b658e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define maxn 100000
struct node
{
long d;
struct node *next;
}*point[maxn+10];
bool vis[maxn+10];
long count[2]={0};
void dfs(long d,long value)
{
struct node *p=point[d];
count[value]++;
vis[d]=false;
while (p)
{
if (vis... | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | db634a72ae3a0c72e1e187b365c3c4ea | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] | //Date:16-09-17
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<float.h>
#include<math.h>
#include<inttypes.h>
#include<assert.h>
#include<ctype.h>
#include<limits.h>
#include<time.h>
#define ll long long
#define For(i,n) for(i=0;i<n;i++)
#define rep(i ,a ,b) for(i=(a);i<=(b);i++)
... | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | f2a2f50c4de9372b241d509e3416ed1f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] | #include <stdio.h>
#include <string.h>
#include <malloc.h>
int* _mstack_data;
int* _mstack_next;
int* _mstack_heads;
int _mstack_free;
char* vis;
int* e_count;
int* set1;
int* set2;
int set1count;
int set2count;
void dfs(int u, char set)
{
if (set)
{
set1[set1count] = u;
set1count++;
}
... | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | c0cad56587b6f1705eea4cf2ef8af374 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] |
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int ret=0,c1=0;
int vis[100009]={0};
int col[100009]={0};
int a[100009],b[100009],count[100009]={0},deg[100009]={0};
int *g[100009];
void dfs(int i)
{
ret++;
int j,x;
vis[i]=1;
//printf("%d ",i);
for(j=0;j<deg[i];j++)
{
x=g[i][j];
if(vis[x]==0)
{
i... | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | c44ab4d0261a449427d8ceea27541cde | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] | #include <stdio.h>
#include <stdlib.h>
typedef struct Node {
struct Node* next;
long long int val;
}node;
node* v[500001];
long long int N, M, i, is[100001], q[100001],a11=0,b11=0, yes = 1;
int main() {
scanf("%lld", &N);
M=N-1;
for(i=1; i<=N; ++i) v[i] = NULL;
for(i=1; i<=M; ++i){
long long int x, y; scanf(... | |
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ... | Output one integer — the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions. | C | 44b9adcc9d672221bda3a1cada81b3d0 | bab77e6b16f33803ca197ed392b52d0f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar",
"trees",
"graphs"
] | 1505833500 | ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"] | NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi... | PASSED | 1,300 | standard input | 2 seconds | The first line of input contains an integer n — the number of nodes in the tree (1 ≤ n ≤ 105). The next n - 1 lines contain integers u and v (1 ≤ u, v ≤ n, u ≠ v) — the description of the edges of the tree. It's guaranteed that the given graph is a tree. | ["0", "2"] | #include <stdio.h>
#include <stdlib.h>
typedef struct node *node_t;
struct node{
long long int index;
node_t next;
};
struct vert{
long long int index;
long long int level;
node_t list;
};
node_t add(node_t list, long long int index){
node_t new = calloc(1, sizeof(struct node));
new->index = index;
... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | b7905c63f09bc6185220fea1f960ff58 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include<stdlib.h>
int a[100000][3],b[100000];
int main()
{
int n,m,k,i,t,min=1000000001;
scanf("%d %d %d",&n,&m,&k);
for(i=0;i<m;i++) scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
for(i=0;i<k;i++)
{
scanf("%d",&t);
b[t]=1;
}
for(i=0;i<m;i++) if(b[a[i][0]]+b[a[i][1]]==1&&a[i]... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 5e4c6888c1f04225affdef8d7d77f617 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | int n,m,k,a=2e9,s[543210],i,j,J;main(){n||scanf("%d%d%d",&n,&m,&k);i-3*m-k?scanf("%d",s+i++):j-k?s[s[j+++3*m]+3*m+k]=1:(a<s[3*J+2]||s[s[3*J+1]+3*m+k]==s[s[3*J]+3*m+k]||(a=s[3*J+2]),J++);J-m&&main();exit(!printf("%d",a>1e9?-1:a));} | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | f39664c5eb6c227dd02ccb6799bba074 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | int n,m,k,a=2e9,s[1<<20],i,j,J;main(){n||scanf("%d%d%d",&n,&m,&k);i-3*m-k?scanf("%d",s+i++):j-k?s[s[j+++3*m]+3*m+k]=1:(a<s[J+2]||s[s[J+1]+3*m+k]==s[s[J]+3*m+k]||(a=s[J+2]),J+=3);J-3*m?main():printf("%d",a>1e9?-1:a);} | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 10c39a4e7e89a4323201b154782412de | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | int n,m,k,a=2e9,s[1<<20],i,j,J;main(){n||scanf("%d%d%d",&n,&m,&k);i-3*m-k?scanf("%d",s+i++):j-k?s[s[j+++3*m]+3*m+k]=1:(a<s[J+2]||s[s[J+1]+3*m+k]==s[s[J]+3*m+k]||(a=s[J+2]),J+=3);J-3*m&&main();exit(!printf("%d",a>1e9?-1:a));} | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | bb29f0f9e91302d43249d06736057e9c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include <stdio.h>
char isStorageCity[100001];
int road[100000][2];
long roadLength[100000];
int main(void) {
int n,m,k;
scanf("%d %d %d",&n,&m,&k);
for (int i=0; i<m; i++) {
int u,v;
long l;
scanf("%d %d %ld",&u,&v,&l);
road[i][0]=u;
road[i][1]=v;
roadLengt... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 7fb416fca41a66160ca8577971f8364c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | /* Coached by rainboy */
#include <stdio.h>
#define N 100000
#define M 100000
#define INF 0x3f3f3f3f
int main() {
static int uu[M], vv[M], ll[M], flour[N];
int n, m, k, i, min;
scanf("%d%d%d", &n, &m, &k);
for (i = 0; i < m; i++)
scanf("%d%d%d", &uu[i], &vv[i], &ll[i]), uu[i]--, vv[i]--;
while (k--) {
int a... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | c1d07dcfd5d4f9a201c0f7b55108379c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include <stdio.h>
struct ut{
int be;
int ki;
int hossz;
};
int main(){
int n, m, k;
scanf("%d %d %d", &n, &m, &k);
struct ut utak[m];
for(int i = 0; i < m; i++) scanf("%d %d %d", &(utak[i].be), &(utak[i].ki), &(utak[i].hossz));
int raktar[n+1];
for(int i = 0; i <= n; i++) raktar[i] = 0;
for(int i... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 27b47fdfdfb58af13606b9f3e85d0b23 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct route {
unsigned a, b, c;
} route;
route neigh[100001];
unsigned baks[100001] = {0};
int main() {
unsigned n, m, k;
scanf("%u%u%u", &n, &m, &k);
for (unsigned i = 0; i < m; i++)
scanf("%u%u%u", &neigh[i].a, &neigh[i].b,... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 9ba072c068ea909717be3f7a9847d03d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | m,i,j,y[1<<18],x[1<<18][3],r=1e10,a=1e10;
main(k){scanf("%d%d%d",&j,&m,&k);for(i=0;i<m;i++)scanf("%d%d%d",&x[i][0],&x[i][1],&x[i][2]);for(i=0;i<k;i++){scanf("%d",&j);y[j]=1;}for(i=0;i<m;i++)if(y[x[i][0]]^y[x[i][1]])r=r<x[i][2]?r:x[i][2];printf("%d",(r==a?-1:r));}
| |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 6050a9a625b50a5aee23bca3ebb5852f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include<stdio.h>
#include<math.h>
int b[1000000],c[1000000];
const int MAX = 1e5 + 1;
int main()
{
int n,m,k,i,j,l,flag=0,mini=1e9 + 2,check=0;
int bakery[MAX];
//printf("%d.", bakery[29]);
scanf("%d%d%d",&n,&m,&k);
int a[m+1][4];
for(i=0;i<m;i++){
for(j=0;j<3;j++){
scanf("%d",&a[i][j]);
}
}
if(k>0){
... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 9f32c18c359bd4a0f289b20b6ea5f23c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include<stdio.h>
int main()
{
int n,m,k,i,a,j;
scanf("%d%d%d",&n,&m,&k);
int arr[100001][3];
int bal[100001]={0};
for(i=0;i<m;i++)
{
scanf("%d%d%d",&arr[i][0],&arr[i][1],&arr[i][2]);
}
int min=1000000009;
if(k>0)
{
for(i=0;i<k;i++)
{
scanf("%d",&a);
bal[a]=1;
}
}
for(i=0;i<m;i++)
{
if(... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | f15480507e72953bbe96fb0eca4fb3fa | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include <stdio.h>
#define N 100000
int stg[N + 1];
struct info{
int u;
int v;
int l;
}edge[N + 1];
int main(){
int n, m, k, a, u, v, l, i;
scanf("%d%d%d", &n, &m, &k);
for(i = 0; i < m; i++){
scanf("%d%d%d", &edge[i].u, &edge[i].v, &edge[i].l);
}
for(i = 0; i < k; i++){
scanf("%d", &a);
stg[a] = 1... | |
Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only k storages, located in different cities numb... | Print the minimum possible amount of rubles Masha should pay for flour delivery in the only line. If the bakery can not be opened (while satisfying conditions) in any of the n cities, print - 1 in the only line. | C | b0e6a9b500b3b75219309b5e6295e105 | 7a268f73ce41f09e8684e247a4c15286 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"graphs"
] | 1471698300 | ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3"] | NoteImage illustrates the first sample case. Cities with storage located in and the road representing the answer are darkened. | PASSED | 1,300 | standard input | 2 seconds | The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 105, 0 ≤ k ≤ n) — the number of cities in country Masha lives in, the number of roads between them and the number of flour storages respectively. Then m lines follow. Each of them contains three integers u, v and l (1 ≤ u, v ≤ n, 1 ≤ l ≤ 109, u ... | ["3", "-1"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 100000
char stg[N + 1];
struct info{
int *a;
int cnt;
} edge[N + 1];
int traverse(int u, int v){
for(int i = 0; i < edge[u].cnt; i += 2){
if(edge[u].a[i] == v){
return i;
}
}
return -1;
}
void rlc(int u, int v, int c1, int c2){
edge[... | |
You are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We choose the smallest value $$$x$$$ that occurs in the array $$$2$$$ or more times. Take the first two occurrences of $$$x$$$ in this array (the two leftmost occurrences). Remove the left ... | In the first line print an integer $$$k$$$ — the number of elements in the array after all the performed operations. In the second line print $$$k$$$ integers — the elements of the array after all the performed operations. | C | 297d68c8be0c3358548949f277b9c087 | 58a6342330acc68fe8b9401592db4734 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation"
] | 1523370900 | ["7\n3 4 1 2 2 1 1", "5\n1 1 3 1 1", "5\n10 40 20 50 30"] | NoteThe first two examples were considered in the statement.In the third example all integers in the given array are distinct, so it will not change. | PASSED | 1,600 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 150\,000$$$) — the number of elements in the array. The second line contains a sequence from $$$n$$$ elements $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^{9}$$$) — the elements of the array. | ["4\n3 8 2 1", "2\n3 4", "5\n10 40 20 50 30"] | #include <stdio.h>
#define N 150000
struct X {
int i; /* for heap */
long long a;
int i_;
} xx[N], *pq[1 + N];
int cnt;
#define LT(x, y) ((x)->a != (y)->a ? (x)->a < (y)->a : (x)->i_ < (y)->i_)
int i2(int i) {
return (i *= 2) > cnt ? 0 : i < cnt && LT(pq[i + 1], pq[i]) ? i + 1 : i;
}
void pq_up(struct X *x) {... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 022f92c83a9ad9656b4dc60d41598b5f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
int a[1000],b[1000],n,i,ans,max=0,k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d",&a[i],&b[i]);
ans=b[i]-a[i]+k;
k=ans;
if(ans>max)
max=ans;
}
printf("%d\n",max);
return 0;
}
| |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 57394a718badcd6fbd7bae05f017df64 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
int n,a[1000],b[1000],ans,i,k,maxx=0;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d%d",&a[i],&b[i]);
}
k=a[0];
for(i=0; i<n; i++)
{
ans=b[i]-a[i]+k;
k=ans;
if(ans>maxx)
maxx=ans;
}
printf("%d\n",maxx);
... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 9205a00d57b250b26275c9ded9685768 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main(){
int n, num1, num2, first = 0, last = 0;
scanf("%d", &n);
while(n--){
scanf("%d %d", &num1, &num2);
first -= num1;
first += num2;
if(first > last){
last = first;
}
}
printf("%d\n", last);
return 0;
} | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | b1ab29b4f791fa8a77b3b08dd886cefb | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]) {
int n,i,j,tab[10000],mont[10000],desc[10000],a,bat[10000],x;
scanf("%d",&n );
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&tab[j] );
}
desc[i]=tab[0];
mont[i]=tab[1];
}
... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 5acbe89f0c56c16f48171bfabc030516 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include <stdio.h>
int main(void)
{
int n;
int a,b;
int total=0,tt=0;
scanf("%d\n", &n);
for(int i=0; i<n ; i++)
{
scanf("%d %d", &a, &b);
//if((b-a)>0)
tt=tt-a+b;
if(total<tt)
total=tt;
//printf("%d\n",total);
}
printf("%d",total);
return 0;
} | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 51920cc34531fd0c0971b496a4a8e1a5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
long long int i,j,n,x=0,sum=0,a[1000][2],b[1001];
scanf("%lld",&n);
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
scanf("%lld",&a[i][j]);
}
sum=sum-a[i][0]+a[i][1];
b[i]=sum;
if(b[i]>x)
x=b[i];
}
... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | bfcd5988799ff37938b1bfab78f67d4a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include <stdio.h>
int main()
{
int n, a, b, c=0,m=0;
scanf("%d", &n);
while (n--)
{
scanf("%d%d", &a, &b);
c -= a;
c += b;
if (c > m)
{
m = c;
}
}
printf("%d\n", m);
return 0;
} | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 905496ada627a5a7c145dc4863e655d2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
int a,b,c,d,i,j,k,n;
scanf("%d",&n);
c=0;d=0;j=0;
for(i=0;i<n;i++)
{
scanf("%d%d",&a,&b);
c=d+b-a;
if(c>j)
{
j=c;
}
d=c;
}
printf("%d",j);
return 0;
}
| |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | a4c90c5f30a306751fe421dec773cb81 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int *a, *b, i, n, *d, j, sum, max, fl = 0;
scanf("%d", &n);
a = (int *)malloc((n+1)*sizeof(int));
b = (int *)malloc((n+1)*sizeof(int));
d = (int *)malloc((n+1)*sizeof(int));
for (i=0; i < n+1; i++)
{
d[i] = 0;
}
for (i = 0;... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | a1b7d6152bf2a7e8a61c19d47f79e96e | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main(){
int i,j,k;
int a[1000];
int b[1000];
int c[1000];
c[0]=0;
int n;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&a[i],&b[i]);
c[i+1]=c[i]+(b[i]-a[i]);}
for(i=0;i<n+1;i++){
k=0;
for(j=0;j<n+1;j++){
if(c[i]>=c[j]... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 28f7f14065955b2e741eb50dde3ae905 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
int a[1000],b[1000],c=0,i,n,max=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d %d",&a[i],&b[i]);
}
for(i=1;i<=n;i++)
{
c=c-a[i];
c=c+b[i];
if(c>max)
max=c;
}
printf("%d",max);
return 0;
//😂😂😂�... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 8a0a87cdaab287adb9f3c938ac4545d5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include <stdio.h>
#include <math.h>
int main( int argc, char **argv )
{
int i;
int a;
int c;
int d;
int e=0;
int f=0;
scanf("%d", &a);
for (i=0;i<a;i++)
{
scanf("%d%d", &c, &d);
e=e-c+d;
if(e>f)
{
f=e;
}
}
printf("%d", f);
return 0;
}
/*
int b[a][2];
for (i=0;i<a;i++)
{
scanf("%d"... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | c325f15f9f73b188e18be00bc797fad4 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
int n,i,ara[10000],ara2[10000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&ara[i],&ara2[i]);
}
int t=ara2[0];
int temp=ara2[0];
for(i=0;i<n;i++){
t=t-(ara[i+1]-ara2[i+1]);
if(t>temp)
temp=t;
} printf("%d",temp);... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | b356df0ce7d4656c850e261d30619745 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
#include<math.h>
int main()
{
int arr[1000][2];
int nr[1000][2];
int i,j,p,n,sum,max,t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&arr[i][j]);
}
}
for(i=0;i<n-1;i++)
{
for(j=1; j<2; j++)
... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | 0cdbd9388e0de27f88b231fe4d1104cd | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
#include<math.h>
int main()
{
int arr[1000][2];
int nr[1000][2];
int i,j,p,n,sum,max,t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&arr[i][j]);
}
}
for(i=0;i<n-1;i++)
{
for(j=1; j<2; j++)
... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | b62a75e562d23114f64e902efcc60b5c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include <stdio.h>
#include <stdlib.h>
int main(){
int n=0;
scanf("%d",&n);
int pass=0;
int capacity=0;
//int change=enter-exitt;
for(int i=0;i<n;i++){
int exitt=0;
int enter=0;
scanf("%d %d\n",&exitt,&enter);
pass = pass+enter-exitt;
if(pass>capacity){
capacity=pass;
}
}
printf("%d",capacity);... | |
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers exit so that it ... | Print a single integer denoting the minimum possible capacity of the tram (0 is allowed). | C | 74b90fe9458b147568ac9bd09f219aab | c28079bf6370345339e4367e8883d4c6 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1316098800 | ["4\n0 3\n2 5\n4 2\n4 0"] | NoteFor the first example, a capacity of 6 is sufficient: At the first stop, the number of passengers inside the tram before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3. At the second stop, 2 passengers exit the tram (1 passenger remains inside). Then, 5 p... | PASSED | 800 | standard input | 2 seconds | The first line contains a single number n (2 ≤ n ≤ 1000) — the number of the tram's stops. Then n lines follow, each contains two integers ai and bi (0 ≤ ai, bi ≤ 1000) — the number of passengers that exits the tram at the i-th stop, and the number of passengers that enter the tram at the i-th stop. The stops are give... | ["6"] | #include<stdio.h>
int main()
{
int a,d,b,c,e,f=0,g=-1;
scanf("%d",&a);
for(b=1;b<=a;b++)
{
scanf("%d %d",&c,&e);
f=f-c;
f=f+e;
if(g<f)
g=f;
}
printf("%d",g);
}
| |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 43cd225ae5432fad46d3ae6df857b97d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int tc;
scanf("%d",&tc);
while(tc--){
long long n,k,i,d,dd,ans;
scanf("%lld%lld",&n,&k);
if(n<=k){
printf("1\n");
continue;
}
ans=n;
for(i=1;i<=ceil(sqrt(n));i++){
if(!(n%i)){
d=n/i;
if(d<=k){
ans=i;
break;
... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 2bb4c1edbe9ddd501ef217572cb07cb1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int T,t;
scanf("%d",&T);
for(t=0;t<T;t++)
{
long int n,k;
scanf("%ld %ld",&n,&k);
long int i,max=1;
if(k>=n)
{
printf("1\n");
}
else
{
long int m;
... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 81b5a2e344b8e61f100d1d4fffc0684a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
typedef unsigned long long int ull;
int compare(const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
void swap(int *x,int *y)
{
int temp=*x;
*x=*y;
*y=temp;
}
int max(int x,int y)
{
... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 3ee89683c5c22aac4dbfb57261d9acd8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int arr[100];
void result(int n1)
{
int i;
for(i=0; i<n1; ++i)
{
printf("%d\n", arr[i]);
}
}
void timUoc(int m, int k, int n)
{
int i;
for(i=1; i<= sqrt(m); ++i)
{
if(m%i==0)
{
if(m/i <= k)
... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 9b57593fc20e4011be967485e92a60d0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include<stdio.h>
#include<math.h>
#include<limits.h>
long long int min(long long int a,long long int b)
{
if(a>b)
return b;
else
return a;
}
int main()
{
int t ,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
long long int n=0,k=0,j=0,z=0;long long int b=LLONG_MAX;
scanf("%lld %l... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | bbc9ccff12df4de81e5b4f3995c8c4d7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int n,k,k1,i,r;
scanf("%lld%lld",&n,&k);
if(k>=n)
printf("1\n");
else
{
i=2;
k1=k;
while(1)
{
if(k1<=k&&n%k1==0)
break;
k1=n/i;
r=n%i;
r/=k1;
if(r!=0)
i+=r;
else
i++;
// printf... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | bedf29f4dab1dd9d5ee9e4260fa70ee2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
long long int n, k;
long long int i;
long long int ans;
for (; t > 0; t--)
{
scanf("%lld %lld", &n, &k);
ans = n;
for (i = 1; i * i <= n; i++)
{
if (n % i == 0)
{
if (i <= k)
{
if (ans > n / i)
ans = n / i;
}
if (n / ... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 6105cb72d5a6fb7e79328c72600e775c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include <stdio.h>
#include <math.h>
#include <string.h>
int main()
{
int i,j,k,n,t,z;
scanf("%d",&t);
for(int z1=0;z1<t;z1++)
{
scanf("%d%d",&n,&k);
j=n;
for(i=1;i<=sqrt(n);i++)
{
z=i;
if(n%z==0&&z<=k)
{
z=n/z;
if(z<j)
j=z;
}
z=n/i;
if(n%z==0&&z<=k)
{
z=n/z;
if(z<j)... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 1a51541bff4d78c61a20b01519aca9df | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int cmp(const void* _a , const void* _b)
{
int* a = (int*)_a;
int* b = (int*)_b;
return *a - *b;
}
int main()
{
int t;
int i,j;
int k,n;
int sum[2]={0};
int max;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&k);
max=1;
if... | |
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa... | Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages. | C | f00eb0452f5933103f1f77ef06473c6a | 0cd5751112ddaaed329d1ae9c681c8c3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"number theory",
"math"
] | 1590327300 | ["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"] | NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels. | PASSED | 1,300 | standard input | 2 seconds | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type... | ["2\n8\n1\n999999733\n1"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
long long int min(long long a,long long b){
if(a<b)return a;
else return b;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long n,k;
scanf("%lld %lld",&n,&k);
if(n<=k)
printf("%d\n",1 );
else{
long long int max=2000000000;
for(lo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.