CodechefAug 18, 2025

Rain in Chefland

Hazrat Ali

Codechef

Chef categorises rainfall as:

  • LIGHT, if rainfall is less than 3 millimetre per hour.
  • MODERATE, if rainfall is greater than equal to 3 millimetre per hour and less than 7 millimetre per hour.
  • HEAVY if rainfall is greater than equal to 7 millimetre per hour.

Given that it rains at X millimetre per hour on a day, find whether the rain is LIGHT, MODERATE, or HEAVY.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of a single integer X — the rate of rainfall in millimetre per hour.

Output Format

For each test case, output on a new line, whether the rain is LIGHT, MODERATE, or HEAVY.

You may print each character in lowercase or uppercase. For example, LIGHTlightLight, and liGHT, are all identical.

Constraints

  • 1≤T≤20
  • 1≤X≤20

Sample 1:

Input
4
1
20
3
7
Output
LIGHT
HEAVY
MODERATE
HEAVY

Solution

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

int main() {

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        if (n < 3) {
            cout << "LIGHT\n";
        } else if (n < 7) {
            cout << "MODERATE\n";
        } else {
            cout << "HEAVY\n";
        }
    }
    return 0;
}




 

Comments