Chef and Interactive Contests Codechef Solution

Hello Programmers In this post, you will know how to solve the Chef and Interactive Contests Codechef Solution.

Chef and Interactive Contests Codechef Solution
Chef and Interactive Contests Codechef Solution

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.


“Every beginning has an end… and an editorial.” – taran_1407

What the hell are all these interactive problems? What does flushing output mean? So many questions… Chef explains it in an easy way: you must communicate with a grader program, which accepts your input only if you flushed the output.

There is a contest with interactive problems where NN people participate. Each contestant has a known rating. Chef wants to know which contestants will not forget to flush the output in interactive problems. Fortunately, he knows that contestants with rating at least rr never forget to flush their output and contestants with rating smaller than rr always forget to do it. Help Chef!


  • The first line of the input contains two space-separated integers NN and rr.
  • Each of the following NN lines contains a single integer RR denoting the rating of one contestant.


For each contestant, print a single line containing the string "Good boi" if this contestant does not forget to flush the output or "Bad boi" otherwise.


  • 1≤N≤1,0001≤N≤1,000
  • 1,300≤r,R≤1,5011,300≤r,R≤1,501


Subtask #1 (100 points): original constraints

Sample Input 1 

2 1500

Sample Output 1 

Bad boi
Good boi

Chef and Interactive Contests CodeChef Solutions in JAVA

import java.util.*;
import java.lang.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
	public static void main (String[] args) throws java.lang.Exception
		// your code goes here
		Scanner sc = new Scanner(;
        int n = sc.nextInt();
        int r = sc.nextInt();
        for(int i = 0; i < n; i++){
            int R = sc.nextInt();
            if(R >= r) System.out.println("Good boi");
            else System.out.println("Bad boi");

Chef and Interactive Contests CodeChef Solutions in CPP

#include <iostream>
using namespace std;
int main() {
	int N,r;
		int R;
		cout<<"Good boi"<<"\n";
		cout<<"Bad boi"<<"\n";
	return 0;

Chef and Interactive Contests Return of the Jedi CodeChef Solutions in Python

for i in range(n):
    print("Good boi") if(a>=k) else print("Bad boi")

Disclaimer: The above Problem (Chef and Interactive Contests) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purpose.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: Chef and his Students Codechef Solution

Leave a Reply

Your email address will not be published. Required fields are marked *