Language: C++

// not me
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
 
const int MAXN=40010;
int n;
struct Line {
  int a,b,c;
  int sequence=1;
  double getY(double x) const{
    double cc=c-(double)a*x;
    return cc/(double)b;
  }
  double getX(double y) const{
    double cc=c-(double)b*y;
    return cc/(double)a;
  }
}l[MAXN];
 
class tenka_e {
  bool chose;
  int BITa[MAXN];
  void add(int p) {
    for (int i=p; i<=n; i+=i&-i)
      BITa[i]++;
  }
  int sum(int p) {
    int result=0;
    for (int i=p;i>0;i-=i&-i)
      result+=BITa[i];
    return result;
  }
 
  static double cc;
  static bool cmpY (const Line &a, const Line &b) {
    if (a.getY(cc) < b.getY(cc))
      return true;
    else if (a.getY(cc) == b.getY(cc))
      return a.sequence<b.sequence;
    return false;
  }
  static bool cmpX (const Line &a, const Line &b) {
    if (a.getX(cc) < b.getX(cc))
      return true;
    else if (a.getX(cc) == b.getX(cc))
      return a.sequence<b.sequence;
    return false;
  }
 
public:
  tenka_e(bool _chose) {
    this->chose = _chose;
    arrage(-200000000.0);
    for (int i=0;i<n;i++)
      l[i].sequence = i+1;
  }
  int arrage(double _cc) {
    cc = _cc;
    if (chose)
      sort(l,l+n,&cmpY);
    else
      sort(l,l+n,&cmpX);
    int result = 0;
    memset(BITa,0,sizeof(BITa));
    for (int i=n-1;i>=0;i--) {
      add( l[i].sequence );
      result += sum(l[i].sequence-1);
    }
    return result;
  }
};
double tenka_e::cc;
inline double abs (double a) {
  return a>=0?a:-a;
}
int main() {
  cin>>n;
  for (int i=0;i<n;i++)
    cin>>l[i].a>>l[i].b>>l[i].c;
  tenka_e* problem1 = new tenka_e(true);
  //X;
  //cout<<"left -> right"<<endl;
  double left=-1000000000.0,right=1000000000.0;
  while (right-left>1e-10 && abs((right-left)/left)>1e-10) {
    double middle = (left+right)/2.0;
    //cout << "["<<left<<", "<<right<<"] middle="<<middle<<endl;
    int leftnode = problem1->arrage(middle);
    int targetnode = ((n-1)*n/2 + 1)/2;
    //cout<<"Got "<<leftnode<<" Points. (Need "<<targetnode<<" )."<<endl;
    if (leftnode >= targetnode)
      right = middle;
    else
      left = middle;
  }
  double res_x = (left+right)/2.0;
  //y;
  //cout<<"bottom -> up"<<endl;
  tenka_e* problem2 = new tenka_e(false);
  left=-100000000.0,right=100000000.0;
  while (right-left > 1e-10 && abs((right-left)/left)>1e-10) {
    double middle = (left+right)/2.0;
    //cout << "["<<left<<", "<<right<<"] middle="<<middle<<endl;
    int leftnode = problem2->arrage(middle);
    int targetnode = ((n-1)*n/2 + 1)/2;
    //cout<<"Got "<<leftnode<<" Points. (Need "<<targetnode<<" )."<<endl;
    if (leftnode >= targetnode)
      right = middle;
    else
      left = middle;
  }
  double res_y = (left+right)/2.0;
  cout<<setiosflags(ios::fixed)<<setprecision(10)<<res_x<<" "<<res_y<<endl;
  return 0;
}

Compiler output:
a.cc: In member function 'int tenka_e::arrage(double)':
a.cc:66:5: error: 'memset' was not declared in this scope
   66 |     memset(BITa,0,sizeof(BITa));
      |     ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc: In function 'int main()':
a.cc:86:33: error: call of overloaded 'abs(double)' is ambiguous
   86 |   while (right-left>1e-10 && abs((right-left)/left)>1e-10) {
      |                              ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:75:15: note: candidate: 'double abs(double)'
   75 | inline double abs (double a) {
      |               ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:102:35: error: call of overloaded 'abs(double)' is ambiguous
  102 |   while (right-left > 1e-10 && abs((right-left)/left)>1e-10) {
      |                                ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:75:15: note: candidate: 'double abs(double)'
   75 | inline double abs (double a) {
      |               ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~