Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll q, a, b, c, d;
	cin >> q;
	rep(i, q) {
		cin >> a >> b >> c >> d;
		bool ans = d>=b;
		if (a < b)ans = false;
		if (ans) {
			if (b <= c)ans	 = true;
			else {
				a %= b;
				ll dif = d - b;
				if (dif == 0) {
					if (c-a<0&&b-a>0)ans = false;
				}
				else {
					if ((b - a - 1) / dif*dif > (c - a))ans = false;
				}
			}
		}
		
		cout << (ans ? "Yes" : "No") << endl;
	}
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll q, a, b, c, d;
	cin >> q;
	rep(i, q) {
		cin >> a >> b >> c >> d;
		bool ans = d>=b;
		if (a < b)ans = false;
		if (ans) {
			if (b <= c)ans	 = true;
			else {
				a %= b;
				ll dif = d - b;
				if (dif == 0) {
					if (c-a<0&&b-a>0)ans = false;
				}
				else {
					if ((b - a - 1) / dif*dif > (c - a))ans = false;
				}
			}
		}
		
		cout << (ans ? "Yes" : "No") << endl;
	}
}


Compiler output:
a.cc:95:36: error: redefinition of 'template<class S, class T> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)'
   95 | template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
      |                                    ^~~~~~~~
a.cc:28:36: note: 'template<class S, class T> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)' previously declared here
   28 | template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
      |                                    ^~~~~~~~
a.cc:96:23: error: redefinition of 'template<class S> auto& operator<<(std::ostream&, std::vector<_Tp>)'
   96 | template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }
      |                       ^~~~~~~~
a.cc:29:23: note: 'template<class S> auto& operator<<(std::ostream&, std::vector<_Tp>)' previously declared here
   29 | template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }
      |                       ^~~~~~~~
a.cc:100:14: error: redefinition of 'constexpr ll gcd(ll, ll)'
  100 | constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
      |              ^~~
a.cc:33:14: note: 'constexpr ll gcd(ll, ll)' previously defined here
   33 | constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
      |              ^~~
a.cc:102:7: error: redefinition of 'class compare'
  102 | class compare {
      |       ^~~~~~~
a.cc:35:7: note: previous definition of 'class compare'
   35 | class compare {
      |       ^~~~~~~
a.cc:109:5: error: redefinition of 'int main()'
  109 | int main() {
      |     ^~~~
a.cc:42:5: note: 'int main()' previously defined here
   42 | int main() {
      |     ^~~~