Solution in__
Python:
w = int(input()) # Reading the input
if w % 2 == 0 and w > 2:
print("YES")
else:
print("NO")
PythonC#:
using System;
class Program
{
static void Main()
{
int w = int.Parse(Console.ReadLine());
if (w % 2 == 0 && w > 2)
{
Console.WriteLine("YES");
}
else
{
Console.WriteLine("NO");
}
}
}
C#Go:
package main
import (
"fmt"
)
func main() {
var w int
fmt.Scan(&w)
if w%2 == 0 && w > 2 {
fmt.Println("YES")
} else {
fmt.Println("NO")
}
}
GoRuby:
w = gets.to_i
if w.even? && w > 2
puts "YES"
else
puts "NO"
end
RubyRust:
use std::io;
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let w: i32 = input.trim().parse().unwrap();
if w % 2 == 0 && w > 2 {
println!("YES");
} else {
println!("NO");
}
}
RustKotlin:
fun main() {
val w = readLine()!!.toInt()
if (w % 2 == 0 && w > 2) {
println("YES")
} else {
println("NO")
}
}
KotlinThese solutions are straightforward, where we check if the weight w
is an even number and greater than 2 to ensure the watermelon can be split into two even parts. If true, the output is “YES”; otherwise, it’s “NO”.