Language: C++

#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}

template<typename T>
struct BIT{
    vector<T> data;

    BIT(int size){
        data.assign(++size,0);
    }
    T sum(int k){
        T ret=0;
        for(++k;k>0;k-=k&-k) ret+=data[k];
        return (ret);
    }
    void add(int k,T x){
        for(++k;k<data.size();k+=k&-k)data[k]+=x;
    }
};
/*
和の方
BIT(size) :長さsizeで初期化
sum(k) 区間[0,k]の和を返す
add(k,x) 要素kにxを加える
*/

template<typename T>
struct RBIT{
    BIT<T> bit0,bit1;
    RBIT(int n){
        bit1=bit0=BIT<T>(n);
    }
    //[l,r]にxを加える
    void add(int l,int r,T x){
        bit0.add(l,-x*(l-1));
        bit1.add(l,x);
        bit0.add(r+1,x*r);
        bit1.add(r+1,-x);
    }
    T sum(int i){
        return bit0.sum(i)+bit1.sum(i)*i;
    }
};

main(){
    int n=in();
    vector<double> a,b,c;
    rep(i,n){
        a.pb(in()),b.pb(in()),c.pb(in());
        b.back()/=a.back();
        c.back()/=a.back();
    }
    double l=-1e8*2,r=1e8*2;
    double EPS=1e-9;
    while((l<r-EPS && (r-l)/l <EPS){
        double mid=(l+r)/2;
        vector<pair<double,int>> v;
        rep(i,n){
            if(b[i]<0.0)
            v.pb((c[i]-mid)/b[i],-1);
            else
            v.pb((c[i]-mid)/b[i],1);
        }
        int cnt=0,bpos=0;
        vec id;
        rep(i,n)id.pb(i);
        sort(all(id),[&](int x,int y){
            return v[x].first<v[y].first;
        });
        rep(i,n){
            if(v[id[i]].second==-1){
                cnt+=bpos;
            }
            else{
                bpos++;
            }
        }
        vec rev(n);
        rep(i,n){
            rev[id[i]]=i;
        }
        vec bsort;
        rep(i,n)bsort.pb(i);
        sort(all(bsort),[&](int x,int y){
            return b[x]<b[y];
        });
        BIT<int> bit(n);
        int p;
        rep(i,n){
            if(b[bsort[i]]>0.0){
                p=i;break;
            }
            cnt+=bit.sum(rev[bsort[i]]);
            bit.add(rev[bsort[i]],1);
        }
        BIT<int> bit2(n);
        rep2(i,p,n-1){
            if(b[bsort[i]]<0.0)continue;
            cnt+=bit2.sum(rev[bsort[i]]);
            bit2.add(rev[bsort[i]],1);
        }
        if(cnt<(n*(n-1)/2+1)/2)l=mid;
        else r=mid;
    }
    printf("%.10f ",l);
    rep(i,n){
        b[i]=(double)1/b[i];
        c[i]*=b[i];
    }
    l=-1e8*2,r=1e8*2;
    while((l<r-EPS && (r-l)/l <EPS){
        double mid=(l+r)/2;
        vector<pair<double,int>> v;
        rep(i,n){
            if(b[i]<0.0)
            v.pb((c[i]-mid)/b[i],-1);
            else
            v.pb((c[i]-mid)/b[i],1);
        }
        int cnt=0,bpos=0;
        vec id;
        rep(i,n)id.pb(i);
        sort(all(id),[&](int x,int y){
            return v[x].first<v[y].first;
        });
        rep(i,n){
            if(v[id[i]].second==-1){
                cnt+=bpos;
            }
            else{
                bpos++;
            }
        }
        vec rev(n);
        rep(i,n){
            rev[id[i]]=i;
        }
        vec bsort;
        rep(i,n)bsort.pb(i);
        sort(all(bsort),[&](int x,int y){
            return b[x]<b[y];
        });
        BIT<int> bit(n);
        int p;
        rep(i,n){
            if(b[bsort[i]]>0.0){
                p=i;break;
            }
            cnt+=bit.sum(rev[bsort[i]]);
            bit.add(rev[bsort[i]],1);
        }
        BIT<int> bit2(n);
        rep2(i,p,n-1){
            if(b[bsort[i]]<0.0)continue;
            cnt+=bit2.sum(rev[bsort[i]]);
            bit2.add(rev[bsort[i]],1);
        }
        if(cnt<(n*(n-1)/2+1)/2)l=mid;
        else r=mid;
    }
    printf("%.10f ",l);
}


Compiler output:
a.cc:91:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   91 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:101:36: error: expected ')' before '{' token
  101 |     while((l<r-EPS && (r-l)/l <EPS){
      |          ~                         ^
      |                                    )
a.cc:157:36: error: expected ')' before '{' token
  157 |     while((l<r-EPS && (r-l)/l <EPS){
      |          ~                         ^
      |                                    )