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
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
a932df316c5c29ff023463e0f543b7ed
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#include <stdio.h> int main() { int n, k; double m = 0.0, max = 0.0; int a[5005]; while(scanf("%d%d", &n, &k) != EOF) { a[0] = 0.0; for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++) a[i] = a[i] + a[i-1]; //for(int i = ...
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| &lt; 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
1b10d68d39c95158dd3f43e9ac440d2a
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#include<stdio.h> int main() { int n,k; scanf("%d",&n); scanf("%d",&k); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=1;i<n;i++) a[i]+=a[i-1]; float max=0,sum; while(k<=n){ for(int i=0;i+k-1<n;i++) { if(i==0){ sum=(float)(a[i+k-1])/k; } else { sum=(float)(a[i+k-1]-a[i...
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| &lt; 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
2d01f0dc8bd5c84000f84f1c771e8340
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#include <stdio.h> #include <stdlib.h> #include <math.h> #define MAX 5002 int main() { int n, k, i, j, x; double a[MAX]; scanf("%d%d", &n, &k); a[0] = 0; for (i = 1; i <= n; i++) { scanf("%d", &x); a[i] = a[i - 1] + x; } double sum, max = 0; for (i = 1; i <= n-k+1; i++) { for (j = k + i - 1; j <= n;...
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| &lt; 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
826086d166f22b63691221803b942f20
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#include<stdio.h> double max(double a,double b){ double t; t=a; if(b>t){ t=b; } return t; } int main(){ int n,k,i,j; scanf("%d%d",&n,&k); int a[n];a[0]=0;double ans=0; for(i=1;i<=n;i++){ scanf("%d",&a[i]); a[i]=a[i]+a[i-1]; } for(i=0;i<=n;i++){ for(j=i+k;j<=n;j++){ ans=max(ans,1.0*(a[j]-a[i])/(j-i)); } ...
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| &lt; 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
19098ab5c873cf9443cfbcb65ddc8caf
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#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; } double max(double a,double b) { if(a<b) return b; return a; } int min(int a,int b) { if(a>b) return b; return a; } int mod(int a) { if(a<0) return -a; return ...
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| &lt; 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
6347bb18e75f32846c5b5aefc0d0d19d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#include<stdio.h> int main() { int i,n,k; double max=0; int a[5005]; scanf("%d%d",&n,&k); for(i=0;i<n;i++) scanf("%d",a+i); for(i=1;i<n;i++) a[i]+=a[i-1]; while(k<=n) { if(max<a[k-1]*1.0/k) max=a[k-1]*1.0/k; for(i=k;i<n;i++) if(max<(a[i]-a[i-k])*1.0/k) max=(a[i]-a[i-k])*1.0/k; k++; } pri...
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal...
Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| &lt; 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ...
C
7bdb68ab0752f8df94b4d5c7df759dfb
77a83aec5804ddd38d9c04b667a550d7
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "math" ]
1530628500
["4 3\n3 4 1 2"]
null
PASSED
1,300
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($...
["2.666666666666667"]
#include <stdio.h> #include <stdlib.h> int main() { int n; int *a; int k; int sum_k = 0; float result = 0; scanf("%d %d", &n, &k); a = (int *)(malloc(sizeof(int) * n)); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); if (i < k) { sum_k += a[i]; ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
440c4ad43d405ca1331103d6ef07415d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main(){ int m,n,ans1=0,ans2=0,count=0; scanf("%d %d",&m,&n); int b[m][n],a[m][n],i,j,k,test[m][n]; for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%d",&b[i][j]); a[i][j]=1; } } for(i=0;i<m;i++){ for(j=0;j<n;j++){ if(b[i][j]==...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
51465716f288e8947b9c4a0513044dd3
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
# include <stdio.h> int main(){ int n,m,i,j,k,y,flag=0; scanf("%d%d",&n,&m); int a[n][m],b[n][m]; for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&a[i][j]); } } for(i=0;i<n;i++){ for(j=0;j<m;j++){ y=1; for(k=0;k<m;k++){ y=y&a[i][k]; } for(k=0;k<n;k++){ y=y&a[k][j]; } if(y==1)b[...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
c72d524ac9f66fd1c8ca7035ffe03cd3
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> #include<math.h> int n,m,a[200][200],b[200][200]; void setit(int x,int y){ int i; for (i = 0; i < n; i++) { a[i][y]=0; } for (i = 0; i < m; i++) { a[x][i]=0; } } int checkit(int x,int y){ int i; for (i = 0; i < n; i++) { if (a[i][y]==1)return 1; } for (i = 0; i < m; i++) { if(a[x][i...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
09ab12e1a19f833be4accb5d6bb7fe3c
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> int main(void) { int i, j, k; int m, n; int a[100][100], b[100][100]; scanf("%d %d", &m, &n); for (i = 0; i < m; i++) for (j = 0; j < n; j++) scanf("%d", b[i] + j); for (i = 0; i < m; i++) for (j = 0; j < n; j++) a[i][j] = 1; for...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
3f826eb88e6ee9ed6221af5dfeaea7a1
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int row,col; int arr[101][101]; int ans[101][101]; int real[101][101]; void printM(int arr[][101]) { int i,j; for(i=1;i!=row+1;i++) { for(j=1;j!=col+1;j++) { printf("%d ",arr[i][j]); } printf("\n"); } return ; } void insert(int arr[][101],int k) { int i,j; for(i=1;i!=row+1;i+...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
a516b4e578a0ff92db4ae1ecfe92d7c1
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> int main(void) { int m, n; scanf("%d", &m); scanf("%d", &n); int a[m][n], b[m][n]; int i, j, i2, j2; for (i = 0; i < m; i++) for (j = 0; j < n; j++) { a[i][j] = 3; scanf("%d", &b[i][j]); } for (i = 0; i < m; i++) for...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
92b427f80b8509072d67bb3b509901cc
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int m,n,a[110][110],b[110][110]; int i,j,k,k1,k2,t=1; scanf("%d%d",&m,&n); for(i=0;i<m;i++) for(j=0;j<n;j++) b[i][j]=1; for(i=0;i<m;i++) for(j=0;j<n;j++) { scanf("%d",&a[i][j]); if(!a[i][j]) { ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
e60c0dc5b51989c72b6bf7b8a2499017
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int n,m,b[105][105],a[105][105],i,j,k,check=0; scanf("%d %d",&m,&n); for(i=0;i<m;i++) for(j=0;j<n;j++) a[i][j]=500; for(i=0;i<m;i++) for(j=0;j<n;j++) { scanf("%d",&b[i][j]); if(b[i][j]==1) { check=1; } else { for(k=0;k<m;k++) a[k][j]=0; for(k=0;k<n;k++) a...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
73d77f7bed48856430adf11d43549776
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> int main() { int i, j, m, n, a[101][101], ans[101][101]; scanf("%d %d", &m, &n); for(i=0; i<m; i++) { for(j=0; j<n; j++) { scanf("%d", &a[i][j]); ans[i][j]=1; } } for(i=0; i<m; i++) { for(j=0; j<n; j++) { ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
12faa9ff6e1a1d2aa7f7f7931c0d7cfc
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int k,flag=0,a[100][100], b[100][100], m,n,i,j,c[100][100]; scanf("%d %d", &m, &n); for(i=0; i<m; i++) { for(j=0; j<n; j++) { scanf("%d", &b[i][j]); a[i][j] = 1; c[i][j]=0; } } for(i=0; i<m; i++) { for(j=0; j<n; j++) { if(b[i][j] == 0) { for(k=0; k<n; k...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
c6055c601a2da36a3145bf6696ce5a3e
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> #include <stdlib.h> int main() { int m,n,i,j,allZeros=1,allZeros1=1; scanf("%d %d",&m,&n); int B[m][n],A[m][n]; int rowArray[m],colArray[n]; for(i=0;i<m;i++) { rowArray[i] = 0; } for(i=0;i<n;i++) { colArray[i] = 0; } for(i=0;i<m;i++) ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
5f4ede69a7462a9286fea8d033d626f3
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
/*OR in Matrix*/ #include<stdio.h> int main() { int A[100][100], B[100][100], C[100][100]; int found, i, j, k, m, n; scanf("%d %d", &m, &n); for (i = 0; i < m; i++) for (j = 0; j < n; j++) scanf("%d", &B[i][j]); for (i = 0; i < m; i++) for (j = 0; j < n; j++) A[i][j] = 1; for (i = 0; i < m; i++) { ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
878ae77e74c9c5acde94693398e177aa
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int a[100][100],b[100][100]; int i,j,k,m,n; int z,z1,tmp,t,y; int f,g; scanf("%d %d", &m,&n); for(i=0; i<m; i++) { for(j=0; j<n; j++) { scanf("%d", &a[i][j]); } } for(i=0; i<m; i++) { for(j=0; j<n; j++) { b[i][j] = 1; } } z=0; f...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
9a82e9a80e31ff09bb94dd158e1d3517
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int m,n,a[100][100],b[100][100],h,k,l,i,j; while(scanf("%d%d",&m,&n)!=EOF) { l=0; for(i=0; i<m; i++) { for(j=0; j<n; j++) { a[i][j]=1; } } for(i=0; i<m; i++) { for(j...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
e8c142ea6af93d01d0c47aca0b86754d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int D[500][500]; int main() { int i,h,j,k,a,b,c,m,n; int D[500][500],A[500][500],C[500][500]; scanf("%d%d",&m,&n); for(i=0;i<m;i++){ for(j=0;j<n;j++){ C[i][j]=1; } } //printf("A Matrix\n"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%d",&A[i][j]); //printf("%d ",A[i][j]); if(A...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
f45cd8fdd93e40d71e1da558a7039b1d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> int main(void){ int n=0,m=0,i=0,j=0,k=0,l=0,arr[100][100],arr1[100][100],arr2[100][100]; scanf("%d %d",&m,&n); for(i=0;i<m;i++) for(j=0;j<n;j++){ arr1[i][j]=1; arr2[i][j]=0; } for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
fd0aa872dc2218d59edaf57d954e1501
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main(){ int n,m,i,j,k,flag=0; scanf("%d%d",&m,&n); int arr[m][n], ans[m][n]; for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%d",&arr[i][j]); ans[i][j] = 0; } } for(i=0;i<m;i++){ for(j=0;j<n;j++){ if(arr[i][j]){ for(k=0;k<m;k++){ if(!arr[k][j])break; } if(k==m){ ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
5b81de8b8e6589c733284f535a5422ba
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> #define SIZE 100 int B[100][100],MARK[100][100] = {0}; int main(void){ int m,n,i,j,state=1,substate = 0,sum =0; scanf("%d%d",&m,&n); for(i=0;i<m;i++){ for(j=0;j<n;j++) scanf("%d",&B[i][j]); } for(i=0;i<m;i++){ for(j=0;j<n;j++){ if(B[i][j] == 1 && MARK[i][j] == 0){ if(! judge(i,j,m,...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
10054e728b9aa72bd8b9b8f9003f1bc2
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int A[100][100], B[100][100], temp[100][100]; int row, col; int i , j, k, flag = 1; scanf("%d %d", &row, &col); for(i = 0; i < row; i++) { for(j = 0; j < col; j++) { scanf("%d", &B[i][j]); A[i][j] = 1; temp[i][j] ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
7ce353c4e37d25cfd47d695cc6713663
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> #include<stdlib.h> int main(){ int a[105][105],m,n,i,j,k,b[105][105],count=0,flag=0,c[105][105]; scanf("%d%d",&m,&n); for(i=1;i<=m;i++) for(j=1;j<=n;j++) scanf("%d",&a[i][j]); for(i=1;i<=m;i++) for(j=1;j<=n;j++){ b[i][j]=-2; c[i][...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
122540ec51c185a8a8dcecd68df182a3
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int m,n,i,j,x,state=0; scanf("%d%d",&m,&n); int a[m][n],b[m][n]; for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&b[i][j]); for(i=0;i<m;i++) for(j=0;j<n;j++) a[i][j]=1; for(i=0;i<m;i++) { for(j=0;j<n;j++) { if(b[i][j]==0) { for(x=0;x<m;x++) a[x][j]=0; ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
4831cf6dc3286a6edc507fd655000c1a
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> int main(void) { int i,j,m,n,check=3,checkagain=3,checkin=3; scanf("%d %d",&m,&n); int in[m][n],out[m][n]; for (i=0;i<m;i++) for (j=0;j<n;j++) scanf("%d",&in[i][j]); for (i=0;i<m;i++) for (j=0;j<n;j++) out[i][j]=1; for (i=0;i<m;i++) ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
ee1610d261f5f1e95d9b14c9be364f1a
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> #include <stdlib.h> int main() { int i, j, k, good, n, m, **b, **a; scanf("%d%d", &m, &n); a = malloc(m * sizeof(*a)); b = malloc(m * sizeof(*b)); for (i = 0; i < m; i++) { a[i] = malloc(n * sizeof(*a[i])); b[i] = malloc(n * sizeof(*b[i])); } for (i = 0; i < m; i++) for (j = 0; j < n; ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
1a3e77ef05b4d213060dc1f0b1c8e9a5
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int m,n,i,i1,j1,f,j,k,l,p,q,a[1001][1001],b[1001][1001],b1[1001][1001]; scanf("%d%d",&m,&n);f=0; for(i=0;i<m;i++) { for(j=0;j<n;j++) scanf("%d",&b[i][j]); } for(i=0;i<m;i++) { for(j=0;j<n;j++) ...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
5d104f5c64f770672288dd158bd63034
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include <stdio.h> int main(void) { int m,n,arr[104][104],i,j,num[104][104],number[104][104],k,d; scanf("%d %d",&m,&n); if(m>=n) { d=m; } else { d=n; } //printf("%d ",d); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&arr[i][j]...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
a150367c95444ed120dba7762b9dfd06
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
int a[100][100],b[100][100]; main() { int m,n,i,j,k; scanf("%d%d",&m,&n); for(i=0;i<m;i++) for(j=0;j<n;j++) {scanf("%d",&a[i][j]);b[i][j]=-1;} for(i=0;i<m;i++) for(j=0;j<n;j++) { if(a[i][j]==0) { for(k=0;k<n;k++) b[i][k]=0; for(...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
f9c5c6cf945a543d9e2e448321c651f0
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int m,n,a[100][100],b[100][100],flag,i,j,x; for(i=0;i<100;i++) { for(j=0;j<100;j++) { a[i][j]=1; } } scanf("%d %d",&m,&n); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&b[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { if(b[i][j]==0) { for(x=0...
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
C
bacd613dc8a91cee8bef87b787e878ca
9ab1e6ba54deb59a10a5979c051c5524
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "greedy" ]
1415718000
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
null
PASSED
1,300
standard input
1 second
The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
#include<stdio.h> int main() { int n,m,i,j,a[105][105]; int f=0,b[105][105],c[105][105],k; scanf("%d%d",&m,&n); for(i=1;i<=m;i++) { for(j=1;j<=n;j++){ a[i][j]=1; c[i][j]=0; } } for(i=1;i<=m;i++) { //printf("yes\n"); for(j=1;j<=n;j++){ scanf("%d",&b[i][j]); if(b[i][j]==0) { for(k=1;k<=n;k++) ...
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
Print a single integer — the number of golden coins needed to raise all the soldiers to the maximal rank.
C
3d6411d67c85f6293f1999ccff2cd8ba
9bf9b11f8d9fcc7624b8b1f5d134d9da
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1298908800
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
PASSED
1,200
standard input
2 seconds
The first line contains two integers n and k (1 ≤ n, k ≤ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≤ i ≤ n, 1 ≤ ai...
["4", "5"]
#include <stdio.h> int Cnt[101]; int main() { int n, k, a, ans = 0; scanf("%d %d", &n, &k); for(int i = 0; i < n; ++i) { scanf("%d", &a); ++Cnt[a]; } while(1) { char update = 0; for(int i = k - 1; i >= 1; --i) { if(Cnt[i]) { --Cnt[i]; ...
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
Print a single integer — the number of golden coins needed to raise all the soldiers to the maximal rank.
C
3d6411d67c85f6293f1999ccff2cd8ba
1b2dcafaafd00ea70eba5e0ecb0ebf13
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1298908800
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
PASSED
1,200
standard input
2 seconds
The first line contains two integers n and k (1 ≤ n, k ≤ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≤ i ≤ n, 1 ≤ ai...
["4", "5"]
#include<stdio.h> int comp(const void *a,const void *b) { return (*(int *)a-*(int *)b); } int main() { int n,k,i,j,ara[1000],x=0; scanf("%d%d",&n,&k); for(i=0;i<n;i++){ scanf("%d",&ara[i]); } while(1){ qsort(ara,n,sizeof(int),comp); if(ara[0]==k){ break; ...
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
Print a single integer — the number of golden coins needed to raise all the soldiers to the maximal rank.
C
3d6411d67c85f6293f1999ccff2cd8ba
d3e9ccbe7f48ffb164734cca52afb15d
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1298908800
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
PASSED
1,200
standard input
2 seconds
The first line contains two integers n and k (1 ≤ n, k ≤ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≤ i ≤ n, 1 ≤ ai...
["4", "5"]
#include<stdio.h> int comp(const void *a,const void *b) { return (*(int *)a-*(int *)b); } int main() { int n,k,i,j,ara[1000],x=0; scanf("%d%d",&n,&k); for(i=0;i<n;i++){ scanf("%d",&ara[i]); } while(1){ qsort(ara,n,sizeof(int),comp); if(ara[0]==k){ break; ...
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
Print a single integer — the number of golden coins needed to raise all the soldiers to the maximal rank.
C
3d6411d67c85f6293f1999ccff2cd8ba
4d8b3e8db39644eeae23779bb54f767a
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1298908800
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
PASSED
1,200
standard input
2 seconds
The first line contains two integers n and k (1 ≤ n, k ≤ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≤ i ≤ n, 1 ≤ ai...
["4", "5"]
#include <stdio.h> #include <stdlib.h> int n,k,i,j,a[101],nr,x; int main() { scanf("%d",&n); scanf("%d",&k); for(i=1;i<=n;i++) { scanf("%d",&x); a[x]++; } i=1; while(a[i]==0) i++; while(i<k) { for(j=i;j<k;j++) { if(a[j]!=0) { a[j]--; a[j+1]...
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
Output q lines. On i-th of them output single integer — answer for i-th query.
C
a2b71d66ea1fdc3249e37be3ab0e67ef
1614ddf9c209964ef6812e91359bbe43
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "dp", "probabilities", "math" ]
1487606700
["1 1\n1", "2 2\n1\n2"]
null
PASSED
2,200
standard input
2 seconds
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
["1", "2\n2"]
/* practice with Dukkha */ #include <stdio.h> #include <stdlib.h> #define K 1000 int main() { static double dp[K + 1]; double *pp; int n, k, d, q, h; scanf("%d%d", &k, &q); dp[0] = 1; n = k, d = 0; pp = malloc(n * sizeof *pp); pp[d++] = 0; while (dp[k] < 0.5) { for (h = k; h > 0; h--) dp[h] = (dp[h] * ...
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
Output q lines. On i-th of them output single integer — answer for i-th query.
C
a2b71d66ea1fdc3249e37be3ab0e67ef
ef4a2f6e2178bd74fd03db99ac15b961
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "dp", "probabilities", "math" ]
1487606700
["1 1\n1", "2 2\n1\n2"]
null
PASSED
2,200
standard input
2 seconds
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
["1", "2\n2"]
#include <stdio.h> #include <string.h> int const MX1=10100; double memo[10100][1010]; double EPS=1e-7; int k; void dp() { int i,j; memo[0][0]=1; for(i=1;i<MX1;i++) { for(j=0;j<1010;j++) { if(i>0 && j>0)memo[i][j]=memo[i-1][j-1]*((double)(k+1-j)/k); else memo[i][j]=0; if(i>j && i>0)memo[i][j]+=memo[i...
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
Output q lines. On i-th of them output single integer — answer for i-th query.
C
a2b71d66ea1fdc3249e37be3ab0e67ef
79a8774f0ca8c13624897babf6b5e5be
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "dp", "probabilities", "math" ]
1487606700
["1 1\n1", "2 2\n1\n2"]
null
PASSED
2,200
standard input
2 seconds
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
["1", "2\n2"]
#include <stdio.h> #include <string.h> #define N 1001 int n, k, q, p, i,j; int respuesta[N]; double aux[10*N][N]; int main(){ scanf("%d",&n); scanf("%d",&q); aux[0][0] = 1; for(i = 1; i < 10*N; ++i){aux[i][0] = 0; for(j=1; j <= n; ++j){aux[i][j] = (aux[i-1][j-1]*(n-j+1)+aux[i-1][j]*j)/n; ...
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
Output q lines. On i-th of them output single integer — answer for i-th query.
C
a2b71d66ea1fdc3249e37be3ab0e67ef
f6a078b87b3b721d28dc6178526c585f
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "dp", "probabilities", "math" ]
1487606700
["1 1\n1", "2 2\n1\n2"]
null
PASSED
2,200
standard input
2 seconds
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
["1", "2\n2"]
#include <stdio.h> #include <string.h> #define N 1001 int n, k, q, p; int ans[N]; double dp[10*N][N]; int main(){ scanf("%d%d", &n, &q); dp[0][0] = 1; for(int i = 1; i < 10*N; ++i){ dp[i][0] = 0; for(int j=1; j <= n; ++j) dp[i][j] = (dp[i-1][j-1]*(n-j+1)+dp[i-1][j]*j)/n; ...
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
Output q lines. On i-th of them output single integer — answer for i-th query.
C
a2b71d66ea1fdc3249e37be3ab0e67ef
82e8d2876d74671a744d53fe5b4fe613
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dp", "probabilities", "math" ]
1487606700
["1 1\n1", "2 2\n1\n2"]
null
PASSED
2,200
standard input
2 seconds
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
["1", "2\n2"]
#include<stdio.h> #include<stdlib.h> #include<math.h> #define eps 0.0000001 typedef unsigned u; typedef double d; d S[7275][1001]; int main() { S[1][0]=S[1][1]=1.0; u i,j,q,p,lo,hi,mi; for(i=1;++i<7275;)for(S[i][j=0]=1.0;++j<=i;) { if(j>1000)break; S[i][j]=S[i-1][j]+pow(((d)(j-1))/((d)j),i-1)*S[i-1][j-1]; } f...
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
Output q lines. On i-th of them output single integer — answer for i-th query.
C
a2b71d66ea1fdc3249e37be3ab0e67ef
8fad8373cb0809ca3861a1b71412fb7d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dp", "probabilities", "math" ]
1487606700
["1 1\n1", "2 2\n1\n2"]
null
PASSED
2,200
standard input
2 seconds
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
["1", "2\n2"]
#include<stdio.h> #include<string.h> int main(){ int k,q,p[1000],a[1000],b[1000],i,j,day; long double d[1001]; scanf("%d%d",&k,&q); for(i=0;i<q;i++){ a[i]=i; scanf("%d",&p[i]); j=i; while(j>0 && p[j]<p[j-1]){ p[j-1]=p[j]+p[j-1]; p[j]=p[j-1]-p[j]; ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
1135ff87a8290f1c742f6a1325a28124
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> #include <stdlib.h> int main() { int arr [4]; int i=0; int n; for( i=0;i<4;i++){ scanf("%d",&n); arr[i]=n; } for(i=0;i<3;i++){ if(arr[i]>arr[i+1]){ int temp = arr[i]; arr[i]=arr[i+1]; arr[i+1]=temp; ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
e0ac8badccb9211960f01b9198b47884
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> int main() { int x1,x2,x3,x4,a,b,c; scanf("%d %d %d %d",&x1,&x2,&x3,&x4); if(x4==((x1+x2+x3)/2)) { a=x4-x1; b=x4-x2; c=x4-x3; } else if(x3==((x1+x2+x4)/2)) { a=x3-x1; b=x3-x2; c=x3-x4; } else if(x2==((x1+x3+x4)/2)) ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
e6d69c7d0b2c7ad277622a3671ee385a
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> int main(void){ int i; int sum[4]; scanf ("%d %d %d %d",&sum[0],&sum[1],&sum[2],&sum[3]); int biggest = sum[0]; for(i = 0; i < 4; i++){ if(sum[i] > biggest) biggest = sum [i]; } for(i = 0; i < 4; i++){ sum[i] = biggest - sum[i]; ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
1048273471c822cb6ebb7d703e319ace
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { long long int x,y,z,a,mx; scanf("%lld%lld%lld%lld",&x,&y,&z,&a); if(x>y && x>z && x>a) { mx=x; } else if(y>x && y>z && y>a) { mx=y; } else if(z>x && z>y && z>a){mx=z;} else mx=a; if(mx==x) { printf("%lld %lld %lld",x-y...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
33fb34cb1f2f663a7e6132c20083e456
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { int a,b,c,d,mx; scanf("%d%d%d%d",&a,&b,&c,&d); if(a>b && a>c && a>d) { printf("%d %d %d\n",a-b,a-c,a-d); } else if(b>c && b>a && b>d) { printf("%d %d %d\n",b-a,b-c,b-d); } else if(c>b && c>a && c>d) { printf("%d %d %d\n",c-b,c-a,...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
5b4a2068bda59ef67b5ae514d34d5458
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { long long a,b,c,x1,x2,x3,x4; scanf("%lld%lld%lld%lld",&x1,&x2,&x3,&x4); if(x1>x2 && x1>x3 && x1>x4) { a=(x2-x3+x4)/2; b=(x2+x3-x4)/2; c=(-x2+x3+x4)/2; printf("%lld %lld %lld",a,b,c); } if(x2>x1 && x2>x3 && x2>x4) { ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
09d4e35a20ed46c920e931e7809cc6ce
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> #include<math.h> int main() { long long int input[4]; long long int output[4]; int i; long long int max; for(i=0; i<4; i++) { scanf("%I64d",&input[i]); if(i==0) max = input[i]; if(input[i]>max) max = input[i]; } for(i=0; i<4; i++) { output[i] = max - input[i]; if (output[i]...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
29bb823c2c760441a0f2a2e444711750
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> #include<math.h> int main() { long long int input[4]; long long int output[4]; int i; long long int max; for(i=0; i<4; i++) { scanf("%I64d",&input[i]); if(i==0) max = input[i]; if(input[i]>max) max = input[i]; } for(i=0; i<4; i++) { output[i] = max - input[i]; if (output...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
6e50b57080725f38bf44fade67b4e94d
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main(){ int x1,x2,x3,x4,a,b,c; scanf("%d%d%d%d%d",&x1,&x2,&x3,&x4); if(x1>x2&&x1>x3&&x1>x4){ a=x1-x2;b=x1-x3;c=x1-x4;} if(x2>x1&&x2>x3&&x2>x4){ a=x2-x1;b=x2-x3;c=x2-x4;} if(x3>x1&&x3>x2&&x3>x4){ a=x3-x1;b=x3-x2;c=x3-x4;} if(x4>x1&&x4>x2&&x4>x3){ a=x4-x1;...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
461b9e14fb337e7a7ee49555ef5539d6
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { int arr[5], i, j; for(i=0; i<4; i++) scanf("%d",&arr[i]); for(i=0; i<4; i++) { for(j=0; j<3; j++) { if(arr[j]<arr[j+1]) { int temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
c8e07e3151935e2fb712253e8c83ec32
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { int arr[5], i, j; for(i=0; i<4; i++) { scanf("%d",&arr[i]); } for(i=0; i<4; i++) { for(j=i+1; j<4; j++) { if(arr[i]>arr[j]) { int temp=arr[i]; arr[i]=arr[j]; arr...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
74808556844f8f23e6467bad6e73bb38
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> #include <stdlib.h> #include <locale.h> #include <windows.h> int main() { int i,j,h,g=4,L=3,s; int y[g]; int w[L]; int ww[L]; for (i=0;i<g;i++) scanf("%d",&y[i]); for (i=0;i<g;i++) { s=0; h=0; for (j=0;j<g;j++) { if (i...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
76faed7976b443628d40b0d95717a868
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> int main() { int i; long long int array[4]; for(i=0;i<4;i++) scanf("%lld",&array[i]); long long int sum=0; for(i=0;i<4;i++) sum+=array[i]; for(i=0;i<4;i++) { if(sum/3==array[i]) { break; } } switch(i) ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
63481ef08abb97ab8418c945094a8ca7
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> int main() { int i; long long int array[4]; for(i=0;i<4;i++) scanf("%lld",&array[i]); long long int sum=0,temporary; for(i=0;i<4;i++) sum+=array[i]; for(i=0;i<4;i++) { if(sum/3==array[i]) { break; } } ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
b042cca12e9ad6240e8cf7148cbb2cb2
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { int a[4],temp; for(int i=0;i<4;i++) { scanf("%d",&a[i]); } for(int i=0;i<4;i++) { for(int j=0;j<3;j++) { if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } int a1=a[3]-a[0]...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
4436421b218dbe7afe5a85a354509775
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> int main(void) { int b[3],abc; //scanf("%d %d %d %d",&ab,&ac,&bc,&abc); int a[4],max=0,m; for(int i=0;i<4;i++) { scanf("%d",&a[i]); if(max<a[i]) {max=a[i]; m=i;} } int j=0; for(int i=0;i<4;i++) { if(i==m) { ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
3915280996ef09f70709faaa5b21e5fe
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> int main() { long sum[4]; int max=0,i; for (i=0;i<4;i++) { scanf("%ld",&sum[i]); if (sum[i]>max){ max=sum[i]; } } int j; for(j=0;j<4;j++) { if ((max-sum[j])!=0) {printf("%ld ",max-sum[j]);} } return 0; }
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
c5338e9693a17f95f4436b6e0e3aaae9
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include<stdio.h> #include<stdlib.h> void main() { unsigned long int a,b,c,d,x,y,z,sum,tmp,tmp2,tmp3,p; scanf("%d %d %d %d", &a,&b,&c,&d); if(a>b) { if(a>c) { if(a>d) { sum=a; } else ...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
ed4d1126deb77ef157cbbbe38e8af24a
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <ctype.h> int main(){ int a, b, c, i; int arr[4]; scanf("%d %d %d %d", &arr[0], &arr[1], &arr[2], &arr[3]); int max = 0; for(i = 1; i < 4; i++){ if(arr[i] > arr[max]){ max = i; } } switch(max){ case 0: a = arr...
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$...
Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
C
cda949a8fb1f158f3c06109a2d33f084
6a0d172995e0600a6024ddb28c56258d
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1555425300
["3 6 5 4", "40 40 40 60", "201 101 101 200"]
null
PASSED
800
standard input
1 second
The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$.
["2 1 3", "20 20 20", "1 100 100"]
#include <stdio.h> #include <stdlib.h> int main() { int a,b,c,m,n,o,p,q,r,s,t; scanf("%d %d %d %d",&m, &n, &o, &p); if (m>n && m>o && m>p) { q=m; r=n; s=o; t=p; }else if (n>m && n>o && n>p) {q=n; r=m; s=o; t=p; }else if (o>n && o>m && o>p){ q=o; r=m; s=n; t=p; }else if(p>n && p>o && p>n){ q=p;...
On a chessboard with a width of $$$10^9$$$ and a height of $$$10^9$$$, the rows are numbered from bottom to top from $$$1$$$ to $$$10^9$$$, and the columns are numbered from left to right from $$$1$$$ to $$$10^9$$$. Therefore, for each cell of the chessboard you can assign the coordinates $$$(x,y)$$$, where $$$x$$$ is ...
In a single line print one integer — the minimum number of spells the rook needs to remove so it can get from the cell $$$(1,1)$$$ to at least one cell in the row with the number $$$10^9$$$
C
00eb4442eb86ccc7352b63dc23354abf
aad851e9c4f87bc9d2392aea45f19931
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "two pointers" ]
1541355000
["2 3\n6\n8\n1 5 6\n1 9 4\n2 4 2", "1 3\n4\n1 5 3\n1 9 4\n4 6 6", "0 2\n1 1000000000 4\n1 1000000000 2", "0 0", "2 3\n4\n6\n1 4 3\n1 5 2\n1 6 5"]
NoteIn the first sample, in order for the rook return home, it is enough to remove the second horizontal spell. Illustration for the first sample. On the left it shows how the field looked at the beginning. On the right it shows how the field looked after the deletion of the second horizontal spell. It also shows the ...
PASSED
1,700
standard input
1 second
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$0 \le n,m \le 10^5$$$) — the number of vertical and horizontal spells. Each of the following $$$n$$$ lines contains one integer $$$x$$$ ($$$1 \le x &lt; 10^9$$$) — the description of the vertical spell. It will create a blocking line between the columns of $$...
["1", "1", "2", "0", "2"]
#include <stdio.h> #include <stdlib.h> #include <math.h> #define N_LIMIT 100001 // 1e5+1 #define INF 1000000000 // 1e9 typedef long long ll; int x[N_LIMIT]; int x1[N_LIMIT], x2[N_LIMIT], y[N_LIMIT]; int removeCount[N_LIMIT]; int cmp(const void *lhs, const void *rhs) { return ((int*)lhs)[0] - ((int *)rhs)[0]; ...
Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that’s why he d...
In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible...
C
0df064fd0288c2ac4832efa227107a0e
37ebf371c14894708c6ce2c5750459e3
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "strings" ]
1287904200
["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"]
null
PASSED
1,500
standard input
2 seconds
The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one.
["1\n3", "2\n1 2", "0"]
#include <stdio.h> #include <string.h> int main() { char s1[1000001], s2[1000001]; int n, p = 0, q, i; scanf("%s %s", s1, s2); n = strlen(s2); for (i = 0; i < n; i++) { if (s1[i] != s1[p]) p = i; if (s1[i] != s2[i]) break; } q = i; if (i == n) { if (s1[p] != s1[i]...
Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that’s why he d...
In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible...
C
0df064fd0288c2ac4832efa227107a0e
d22c68e033b1eb9a1724e1fe1aea95fa
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "strings" ]
1287904200
["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"]
null
PASSED
1,500
standard input
2 seconds
The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one.
["1\n3", "2\n1 2", "0"]
//Spelling Check - Codeforces #include <stdio.h> #include <string.h> //#include <string> char s1[1000001], s2[1000001]; int n, counta, cantidad, resp2[1000001]; int main(){ scanf("%s %s",s1+1,s2+1); n=strlen(s1+1); for(int i=n;i>=1;--i) if (i==1||s1[i]!=s2[i - 1]){ counta = n - i; ...
Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that’s why he d...
In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible...
C
0df064fd0288c2ac4832efa227107a0e
99c7cb39b408d312ca44dabc8db08831
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "hashing", "strings" ]
1287904200
["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"]
null
PASSED
1,500
standard input
2 seconds
The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one.
["1\n3", "2\n1 2", "0"]
#include<stdio.h> #include<string.h> int main() { int i, j, n, count = 0, c[1000010] = { 0 }; char a[1000010], b[1000010]; scanf(" %s", a); scanf(" %s", b); n = strlen(a); for(i = 0; i < n-1; i++) if(a[i]!=b[i]) break; if(i!=n-1) if(strcmp(a + i + 1, b + i) != 0)...
Kolya has a string s of length n consisting of lowercase and uppercase Latin letters and digits.He wants to rearrange the symbols in s and cut it into the minimum number of parts so that each part is a palindrome and all parts have the same lengths. A palindrome is a string which reads the same backward as forward, suc...
Print to the first line an integer k — minimum number of palindromes into which you can cut a given string. Print to the second line k strings — the palindromes themselves. Separate them by a space. You are allowed to print palindromes in arbitrary order. All of them should have the same length.
C
d062ba289fd9c373a31ca5e099f9306c
2117ba87cc26060ef9b8bd20e6de9a0a
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "strings" ]
1508573100
["6\naabaac", "8\n0rTrT022", "2\naA"]
null
PASSED
1,800
standard input
3 seconds
The first line contains an integer n (1 ≤ n ≤ 4·105) — the length of string s. The second line contains a string s of length n consisting of lowercase and uppercase Latin letters and digits.
["2\naba aca", "1\n02TrrT20", "2\na A"]
#include <stdio.h> #include <string.h> #include <ctype.h> #define uLL unsigned long long #define LL long long void print(long *a,long size) {long i;for (i=1;i<size;i++) {printf("%ld ",a[i]);}printf("%ld\n",a[i]);} char encode[10000]; long pan[2000000],temp[2000000],num[2000000],count[2000000]; long n,ans; void ini() { ...
Kolya has a string s of length n consisting of lowercase and uppercase Latin letters and digits.He wants to rearrange the symbols in s and cut it into the minimum number of parts so that each part is a palindrome and all parts have the same lengths. A palindrome is a string which reads the same backward as forward, suc...
Print to the first line an integer k — minimum number of palindromes into which you can cut a given string. Print to the second line k strings — the palindromes themselves. Separate them by a space. You are allowed to print palindromes in arbitrary order. All of them should have the same length.
C
d062ba289fd9c373a31ca5e099f9306c
2d69c86b2fcb1d45bd5a943bd5e672d9
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "strings" ]
1508573100
["6\naabaac", "8\n0rTrT022", "2\naA"]
null
PASSED
1,800
standard input
3 seconds
The first line contains an integer n (1 ≤ n ≤ 4·105) — the length of string s. The second line contains a string s of length n consisting of lowercase and uppercase Latin letters and digits.
["2\naba aca", "1\n02TrrT20", "2\na A"]
#include <stdio.h> #include <string.h> #include <ctype.h> #define uLL unsigned long long #define LL long long void print(long *a,long size) {long i;for (i=1;i<size;i++) {printf("%ld ",a[i]);}printf("%ld\n",a[i]);} char encode[10000]; long pan[2000000],temp[2000000],num[2000000],count[2000000]; long n,ans; void ini() { ...
Kolya has a string s of length n consisting of lowercase and uppercase Latin letters and digits.He wants to rearrange the symbols in s and cut it into the minimum number of parts so that each part is a palindrome and all parts have the same lengths. A palindrome is a string which reads the same backward as forward, suc...
Print to the first line an integer k — minimum number of palindromes into which you can cut a given string. Print to the second line k strings — the palindromes themselves. Separate them by a space. You are allowed to print palindromes in arbitrary order. All of them should have the same length.
C
d062ba289fd9c373a31ca5e099f9306c
3eadd85d0ace7cc08562fa8353630f74
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation", "brute force", "strings" ]
1508573100
["6\naabaac", "8\n0rTrT022", "2\naA"]
null
PASSED
1,800
standard input
3 seconds
The first line contains an integer n (1 ≤ n ≤ 4·105) — the length of string s. The second line contains a string s of length n consisting of lowercase and uppercase Latin letters and digits.
["2\naba aca", "1\n02TrrT20", "2\na A"]
#include <stdio.h> #include <string.h> #include <ctype.h> #define uLL unsigned long long #define LL long long void print(long *a,long size) {long i;for (i=1;i<size;i++) {printf("%ld ",a[i]);}printf("%ld\n",a[i]);} char encode[10000]; long pan[2000000],temp[2000000],num[2000000],count[2000000]; long n,ans; void ini() { ...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
e2cadf9adf9af76a9224c728b430df55
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { long long int n,k ,t,l; scanf("%lld",&t); while(t--) { scanf("%lld%lld",&n,&k); l=(k-1)/(n-1 ); printf("%lld\n",k+l); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
9262b1804696a960be3dd4a4bcf2c4e7
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int t; long long n,k,m,s,a; scanf("%d",&t); long long r[t]; for(int i=0;i<t;i++) { scanf("%lld %lld",&n,&k); s=n-1; m=k/s; a=k%s; if(a==0) r[i]=(m*n)+a-1; else r[i]=(m*n)+a; } for(int i=0;...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
a3d6ea7f8add28ab6209e9276264e480
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> #include <math.h> int solve(int n, int k){ return k + floor((k - 1) / (n - 1)); } int main(){ int n, k, t; scanf("%d", &t); for(int i = 1; i <= t; i++){ scanf("%d %d", &n, &k); printf("%d\n", solve(n, k)); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
32f76345849b7229aba0347a8fee5d54
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> int main(void) { int t; scanf("%d\n",&t); while(t--){ long int n,k; scanf("%ld %ld\n",&n,&k); if(n==2){ printf("%ld\n",2*k-1); } else{ long int b=k/(n-1); if(k%(n-1)==0){ b=k/(n-1); b--; } /* long int a=n*b; printf("%ld\...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
3626e802c0a0aaa8bf8cca7f40e620be
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> #include <stdlib.h> #include <math.h> int n, k, arr[1005]; int mod(int k, int n) { int a; a = k / n; return a; } void solve(int x) { int i; i = k / n; arr[x] = k; do { arr[x] += mod(k, n); k = mod(k, n) + k % n; }while(k>=n); printf("%d\n", arr[...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
427c967ceb8b4ac8f8ea465a25b379d3
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,m; scanf("%d %d",&n,&m); if(m%(n-1)==0) printf("%d\n",(m/(n-1))*n-1); else printf("%d\n",(m/(n-1))*n+m%(n-1)); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
ea4a6fa08f3a40871bb28a51e6027f65
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> #define I64 long long int int main() { int t; scanf("%d",&t); while(t--) { I64 n,k,m,i; scanf("%I64d%I64d",&n,&k); if(n>k) printf("%I64d\n",k); else printf("%I64d\n",k+(k-1)/(n-1)); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
ed0ddd3989affe68443b1fae6a9a040f
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { long long int n,i,a,b,x; scanf("%lld",&n); while(n--) { scanf("%lld %lld",&a,&b); x=b*a/(a-1); if(x%a==0) { x--; } printf("%lld\n",x); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
650ff4bdee6b1a82ff7d1529ac8ede57
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> #include <stdlib.h> int main() { int t,n,k,i,j,count; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d%d",&n,&k); printf("%d\n",k+(k-1)/(n-1)); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
e3bc8053c893609089faf16831c20dc6
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> int main() { int T; long long n,k,i, l,ans; scanf("%d", &T); while(T--) { scanf("%lld %lld", &n , &k); ans = k + ((k-1) / (n-1)); printf("%lld\n", ans); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
efb5dd53164dbc39f67e641c8c9ce06c
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> main(){ int n=0; scanf("%d",&n); int i=1; for(i=1;i<=n;i++){ int a=1; scanf("%d",&a); int b=0; scanf("%d",&b); int c=0; int d=0; int e=0; c=b%(a-1); d=b/(a-1); if(c==0){ e=a*d-1; }else{ e=a*d+c; } printf("%d\n",e); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
1a70bf0cfb2e452029be8d1648758d48
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> int main() { int i,t,n,k,limit_of_multipliction,left_number,number_of_times,numbers,kth; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d %d",&n,&k); if(n>k){ printf("%d\n",k); continue; } number_of_times = k/(n-1); limit_of_multi...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
38c9be53b90320faaf890f6901707067
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main( ) { int a,b,c,d,i,j,k,l,x,m,n; scanf("%d",&x); while(x--){ scanf("%d %d",&a,&b); if(a>b){ printf("%d\n",b); } else{ c=b/(a-1); c=c*a; d=b%(a-1); m=c+d; if(m%a==0) ...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
bdb5e5eab543715e602e7c2e528bc4c4
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int w[100005],q[100005]; int main( ) { int a,b,c,d,x,y,i,j,k; scanf("%d",&a); while(a--){ scanf("%d %d",&b,&c); if(b==c){ printf("%d\n",c+1); } else if(b>c){ printf("%d\n",c); } else{ d=b-1; if(...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
53890a754b25ed9d0047c5635ae8a319
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int test=0; scanf("%d",&test); while(test--){ long int k,n; scanf("%ld%ld",&n,&k); long int p=(k-1)/(n-1); printf("%ld\n",p+k); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
e8a154d9792b4d9d23f91435dce7cfa6
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> #include <math.h> int main(){ int t; scanf("%d", &t); while(t--){ long n, k; scanf("%ld %ld", &n, &k); long p = floor((k - 1)/(n - 1)); printf("%ld\n", k + p); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
d473d6cb908b974e7917fba07e3bdd2c
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int t,i; scanf("%d",&t); for(i=0;i<t;i++) { long long int n,k; scanf("%lld %lld",&n,&k); if(k%(n-1)==0) { long long int g=n*k/(n-1)-1; printf("\n%lld",g); } else { long long int h=n*(k/(n-1))...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
e6f6665395955df11758ca4426ea2e34
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include "stdio.h" typedef long long ll; void solve(); int main(void) { int t; scanf("%d ",&t); while(t--) solve(); return 0; } void solve() { ll n, k; scanf("%llu%llu", &n, &k); ll ans = (k - 1) / (n - 1) * n; ans += k - (k - 1) / (n - 1) * (n - 1); printf("%llu\n", ...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
5d979be980aa8bfc1a8a4574b8ea3f3e
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
/// https://codeforces.com/problemset/problem/1352/C #include "stdio.h" typedef unsigned long long ll; void solve(); int main(void) { int t; scanf("%d ",&t); while(t--) solve(); return 0; } void solve() { ll n, k; scanf("%llu%llu", &n, &k); ll low = 0, high = 1e10; ll ans...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
3a93b93b945aea5025de7beaa86e47c5
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include "stdio.h" int main(void) { int t; scanf("%d",&t); while(t--) { int n, k; scanf("%d%d",&n,&k); int temp = n - 1, num; if(k % temp == 0) num = k / temp * n - 1; else num = k / temp * n + k % temp; printf("%d\n",num); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
bb07d210a356665deed7fac8cb63e3c7
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int t,i; scanf("%d",&t); for(i=1;i<=t;i++){ int n,k,d; scanf("%d%d",&n,&k); d=k/(n-1); if((k+d)%n==0){ if((k+d)-((k+d)/n)==k)printf("%d\n",(k+d-1)); else printf("%d\n",k+d+1); } else printf("%d\n",k+d); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
dc4dd5178bf1d9f74b1cf6911d0b4b6f
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int t,i; scanf("%d",&t); for(i=1;i<=t;i++){ int n,k,d; scanf("%d%d",&n,&k); d=k/(n-1); if((k+d)%n==0)printf("%d\n",(k+d-1)); else printf("%d\n",k+d); } }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
d3de5d2000bcc4d7006288c9ffc40253
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int a; scanf("%d",&a); for(int i=0;i<a;i++) { int n,k; scanf("%d %d",&n,&k); int a=n-1; int b=k-1; int p=b/a; printf("%d\n",k+p); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
6707c6a5bb9f1ed9fc8c5de55fcce648
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
/* AUTHOR: AKASH JAIN * EMAIL: akash19jain@gmail.com * ID: akash19jain * DATE: 10-05-2020 18:04:05 */ // #include<algorithm> // #include <bits/stdc++.h> // using namespace std; #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<ctype.h> #define SC1(x) ...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
7c6c35dade6fe1a3862827806d74186a
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { long long int i,t,n,k,a,b,c; scanf("%lld",&t); for(i=1;i<t+1;i++){ scanf("%lld%lld",&n,&k); a=k-1; b=n-1; c=a/b; printf("%lld\n",k+c); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
b3422a0f081ff9c7707ae5513a5adc34
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include <stdio.h> int main(void) { int iter; scanf("%d", &iter); int n, k; for (int i = 0; i < iter; i++) { scanf("%d%d", &n, &k); if (k <= (n - 1)) printf("%d\n", k); else { int p = 0; if (k % (n - 1) == 0) p = (k - 1) /...
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
360550e2177215810d53dda093a290e4
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
/* bai 11 1352 C */ #include<stdio.h> #include<math.h> int so(int n, int k){ return (k + floor(k - 1) / (n - 1)); } int main(){ int T; scanf("%d",&T); while(T--){ int n,k; scanf("%d%d",&n,&k); printf("%d\n", so(n, k)); } return 0; }
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$.
For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.
C
7d6f76e24fe9a352beea820ab56f03b6
579af3838013945e254fceb82ee4aa6d
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "binary search", "math" ]
1589034900
["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"]
null
PASSED
1,200
standard input
1 second
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$).
["10\n15\n1999999999\n113\n1000000001\n1"]
#include<stdio.h> int main() { int t; int n,k; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&k); int a=k+(k/(n-1)); if(a%n==0) { printf("%d\n",a-1); } else { printf("%d\n",a); } } }