New-Pro Coder
Source: codechef
Difficulty: 467

New-Pro Coder
Hola a todos, espero que todo vaya bien!!
Ved claims to be a pro at programming, but his friend Varun disagrees. To settle the debate, they decided to seek advice from their mentor. The mentor proposed a simple challenge:
Ved must write a program containing$N$lines of code. When the code is compiled, the compiler will indicate how many of those lines have errors, denoted as$M$. Based on the results:
If errors are present in at least
half
of the total lines, Ved will be labeled as a$\text{NEWBIE}$.
Otherwise, he will be called a$\text{PRO}$After compiling Ved's code, the compiler reported errors in$M$lines. Determine Ved's skill category based on this evaluation.
Input Format
The input contains two space-separated integers$N$and$M$— the number of lines of code written by Ved and the number of lines of code containing errors, respectively.
Output Format
Output$\text{PRO}$if Ved is pro, else output$\text{NEWBIE}$.
It is allowed to print each character in either case.$\text{pro}, \text{pRo}, \text{PRo}$will all be accepted.
Constraints$1 \leq N \leq 1000$$1 \leq M \leq 1000$$M \leq N$Sample 1:
Explanation:
There were$10$lines and Ved has errors in$6$of them. Since$6 \ge 5$, where$5$is half of$10$, Ved is a newbie due to having errors in at least half the lines.
Sample 2:
Input
Output
9 4
PRO
Explanation:
Half of$9$is$4.5$. Ved has errors in less than half the lines, thus he is a pro.

Sample Input:
10 6

Sample Output:
NEWBIE

C++ solution:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,m;
    cin>>n>>m;
    if(n>m*2)
    {
        cout<<"PRO"<<endl;
    }
    else
    cout<<"NEWBIE"<<endl;

}

Go solution:
package main
import "fmt"

func main(){
    // your code goes here
    var n,m int
    fmt.Scan(&n,&m)
    if 2*m>=n{
        fmt.Println("NEWBIE")
    }else{
        fmt.Println("PRO")
    }
}

Java solution:
import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] s = br.readLine().trim().split("\\s+");
        int n = Integer.parseInt(s[0]);
        int m = Integer.parseInt(s[1]);
        if(m >= n/2d)
            out.println("NEWBIE");
        else
            out.println("PRO");
        out.flush();
        out.close();
    }
}

JavaScript solution:
// your code goes here
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(input){
  const num = input.trim().split(" ");
let n=parseInt(num[0]);
let m=parseInt(num[1]);
if(m >= n/2) {
    console.log('NEWBIE');
} else {
    console.log('PRO');
}
})

Python solution:
a,b=map(int,input().split())
if a/2<=b:
    print("NEWBIE")
else:
    print("PRO")

Ruby solution:
# Read input values
input = gets.chomp
n, m = input.split.map(&:to_i)

# Calculate half of the lines (rounding up)
half = (n + 1) / 2

# Determine the output
if m >= half
  puts "NEWBIE"
else
  puts "PRO"
end