Cars and Bikes: TYRES

link: https://www.codechef.com/CU1PP0009/problems/TYRES

Chef opened a company which manufactures cars and bikes. Each car requires 44 tyres while each bike requires 22 tyres. Chef has a total of NN tyres (NN is even). He wants to manufacture maximum number of cars from these tyres and then manufacture bikes from the remaining tyres.

Chef’s friend went to Chef to purchase a bike. If Chef’s company has manufactured even a single bike then Chef’s friend will be able to purchase it.

Determine whether he will be able to purchase the bike or not.

Input Format

  • The first line contains an integer TT denoting the number of test cases. The TT test cases then follow.
  • The first line of each test case contains an integer NN denoting the number of tyres.

Output Format

For each test case, output YES or NO depending on whether Chef’s friend will be able to purchase the bike or not. Output is case insensitive.

Constraints

  • 1≤T≤1001≤T≤100
  • 2≤N≤10002≤N≤1000
  • NN is even

Sample Input 1 

3
8
2
6

Sample Output 1 

NO
YES
YES

Explanation

  • For the first test case Chef, will manufacture 22 cars and will thus use all the 88 tyres and thus could not manufacture any bike.
  • For the second test case, Chef cannot manufacture any car since there are not enough tyres and will thus manufacture only a single bike which will be purchased by Chef’s friend.
  • For the third test case, Chef will manufacture 11 car and thus use 44 tyres. From the remaining 22 tyres, Chef can manufacture a single bike which will be purchased by Chef’s friend.

Solution:

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

#define ll              long long
#define pb              push_back
#define all(v)          v.begin(),v.end()
#define sz(a)           (ll)a.size()
#define F               first
#define S               second
#define INF             2000000000000000000
#define popcount(x)     __builtin_popcountll(x)
#define pll             pair<ll,ll>
#define pii             pair<int,int>
#define ld              long double

const int M = 1000000007;
const int MM = 998244353;

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

#ifdef LOCAL
#define debug(...) debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 2351
#endif


int _runtimeTerror_()
{
    int N;
    cin >> N;
    cout << (N % 4 ? "Yes" : "No") << "\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS = 1;
    cin >> TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}


See also  Disabled King: DISABLEDKING