#include #include using namespace std ; typedef long long ll ; int main(int argc, char *argv[]) { int n ; cin >> n ; vector typ(n) ; vector t0(n) ; vector len(n) ; vector coor(n) ; for (int i=0; i> typ[i] >> t0[i] >> len[i] >> coor[i] ; ll rr = 0 ; for (int i=0; i t0[j] && t0[j] + len[j] > t0[i]) { // disable this; only do h vs v // rr++ ; } } else { if (t0[i] + len[i] - coor[i] > t0[j] - coor[j] && t0[j] + len[j] - coor[j] > t0[i] - coor[i]) { rr++ ; } } } cout << rr << endl ; }