Language: C++

#include<bits/stdc++.h>
using namespace std;
long long bit[1000000], _size, n, cnt, __x1[200000], __y1[200000], __x2[200000], __y2[200000];
vector<long long>XX, YY, _XX, _YY; vector<tuple<long long, long long, long long>>vec;
void add(long long p, long long x) { while (p <= _size) { bit[p] += x; p += p&-p; } }
long long sum(long long p) { int _sum = 0; while (p >= 1) { _sum += bit[p]; p -= p&-p; }return _sum; }
long long __sum(long long l, long long r) { return sum(r) - sum(l - 1); }
int main() {
	cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
	for (int i = 0; i < n; i++) { XX.push_back(__x1[i]); XX.push_back(__x2[i]); YY.push_back(__y1[i]); YY.push_back(__y2[i]); }
	sort(XX.begin(), XX.end()); sort(YY.begin(), YY.end());
	for (int i = 0; i < XX.size(); i++) { if (i == 0 || XX[i - 1] != XX[i])_XX.push_back(XX[i]); if (i == 0 || YY[i - 1] != YY[i])_YY.push_back(YY[i]); }
	for (int i = 0; i < n; i++) {
		int pos1 = lower_bound(_XX.begin(), _XX.end(), __x1[i]) - _XX.begin(), pos2 = lower_bound(_YY.begin(), _YY.end(), __y1[i]) - _YY.begin();
		int pos3 = lower_bound(_XX.begin(), _XX.end(), __x2[i]) - _XX.begin(), pos4 = lower_bound(_YY.begin(), _YY.end(), __y2[i]) - _YY.begin();
		__x1[i] = pos1; __y1[i] = pos2; __x2[i] = pos3; __y2[i] = pos4; if (__x1[i] > __x2[i])swap(__x1[i], __x2[i]); if (__y1[i] > __y2[i])swap(__y1[i], __y2[i]);
		if (__x1[i] == __x2[i]) { vec.push_back(make_tuple(__y1[i], 1LL << 60, __x1[i])); vec.push_back(make_tuple(__y2[i], -1LL << 60, __x1[i])); }
		else { vec.push_back(make_tuple(__y1[i], __x1[i], __x2[i])); }
	}sort(vec.begin(), vec.end()); _size = XX.size() + 10;
	for (int i = 0; i < vec.size(); i++) { if (abs(get<1>(vec[i])) >= 1LL << 50)add(get<2>(vec[i]), get<1>(vec[i]) / (1LL << 60)); else { cnt += __sum(get<1>(vec[i]), get<2>(vec[i])); } }
	cout << cnt << endl;
}

Compiler output:
a.cc:3:65: error: 'long long int __y1 [200000]' redeclared as different kind of entity
    3 | long long bit[1000000], _size, n, cnt, __x1[200000], __y1[200000], __x2[200000], __y2[200000];
      |                                                                 ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double __y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:70: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                      ^
a.cc:9:61: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'double(double) noexcept')
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                              ~~~~~~~~~~~~~~ ^~ ~~~~~~~
      |                                                  |                   |
      |                                                  |                   double(double) noexcept
      |                                                  std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double (*)(double) noexcept'
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'short int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(short int)(__y1 + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'short unsigned int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(short unsigned int)(__y1 + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(int)(__y1 + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'unsigned int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(unsigned int)(__y1 + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'long int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(long int)(__y1 + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'long unsigned int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(long unsigned int)(__y1 + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i];
      |                                                                ~~~~~~^
      |                                                                      |
      |                                                                      double (*)(double) noexcept
a.cc:9:70: error: cannot bind rvalue '(long long int)(__y1 + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:9:70: error: invalid conversion from 'double (*)(double) noexcept' to 'long long unsigned int' [-fpermissive]
    9 |         cin >> n; for (int i = 0; i < n; i++)cin >> __x1[i] >> __y1[i] >> __x2[i] >> __y2[i