func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void print(T a) {     for (auto x : a) cout << x <<    ;     cout <<   n ;   }   vector<pair<long double, long double> > lines1;   vector<long double> dots1;   long double intersection(pair<long double, long double> l1,                            pair<long double, long double> l2) {     return (l2.second - l1.second) / (l1.first - l2.first);   }   void add_mx(long double k, long double b) {     while ((long long)(lines1).size() >= 2) {       long double x =           intersection(lines1[(long long)(lines1).size() - 2], {k, b});       if (x <= dots1.back()) {         dots1.pop_back();         lines1.pop_back();       } else         break;     }     if ((long long)(lines1).size())       dots1.push_back(           intersection(lines1[(long long)(lines1).size() - 1], {k, b}));     lines1.push_back({k, b});   }   long double get_mx(long double x) {     long long id = lower_bound((dots1).begin(), (dots1).end(), x) - dots1.begin();     return lines1[id].first * x + lines1[id].second;   }   vector<pair<long double, long double> > lines2;   vector<long double> dots2;   void add_mn(long double k, long double b) {     while ((long long)(lines2).size() >= 2) {       long double x =           intersection(lines2[(long long)(lines2).size() - 2], {k, b});       if (x <= dots2.back()) {         dots2.pop_back();         lines2.pop_back();       } else         break;     }     if ((long long)(lines2).size())       dots2.push_back(           intersection(lines2[(long long)(lines2).size() - 1], {k, b}));     lines2.push_back({k, b});   }   long double get_mn(long double x) {     long long id = lower_bound((dots2).begin(), (dots2).end(), x) - dots2.begin();     return lines2[id].first * x + lines2[id].second;   }   const long double PI = acos(-1);   long double get_angle(pair<long double, long double> v) {     long double gyp = sqrt(v.first * v.first + v.second * v.second);     long double cs = v.first / gyp;     return acos(cs) * 180.0 / PI;   }   void solve() {     long long n;     cin >> n;     vector<vector<long double> > s;     vector<pair<long double, long double> > lines;     long double left_most = 1e18, right_most = -1e18;     for (long long i = 0; i < n; i++) {       long double a, b, c;       cin >> a >> b >> c;       left_most = min(left_most, a);       right_most = max(right_most, b);       s.push_back({c, a, b});       lines.push_back({c, a});       lines.push_back({c, b});     }     sort((lines).begin(), (lines).end());     vector<pair<long double, long double> > lines_mx, lines_mn;     for (long long i = 0; i < (long long)(lines).size(); i++) {       if (i != 0 && lines[i].first == lines[i - 1].first) {         lines_mx.pop_back();         lines_mx.push_back(lines[i]);       } else {         lines_mx.push_back(lines[i]);         lines_mn.push_back(lines[i]);       }     }     for (long long i = 0; i < (long long)(lines_mx).size(); i++)       add_mx(lines_mx[i].first, lines_mx[i].second);     for (long long i = (long long)(lines_mn).size() - 1; i >= 0; i--)       add_mn(lines_mn[i].first, lines_mn[i].second);     sort((s).begin(), (s).end());     vector<pair<long double, long long> > event;     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < i; j++) {         if (s[j][0] == s[i][0]) continue;         pair<long double, long double> v1(s[j][2] - s[i][1], s[j][0] - s[i][0]);         pair<long double, long double> v2(s[j][1] - s[i][2], s[j][0] - s[i][0]);         long double angle1 = get_angle(v1), angle2 = get_angle(v2);         event.push_back({angle1, 1});         event.push_back({angle2, -1});       }     }     sort((event).begin(), (event).end());     if ((long long)(event).size() == 0) {       cout << fixed << setprecision(10) << right_most - left_most;       return;     }     long long balance = 0;     vector<long double> angles;     for (long long i = 0; i < (long long)(event).size(); i++) {       if (event[i].second == 1) {         if (balance == 0) angles.push_back(event[i].first);         balance++;       } else {         balance--;         if (balance == 0) angles.push_back(event[i].first);       }     }     long double ans = 1e18;     for (long double angle : angles) {       long double ct = 1.L / tan(angle / 180.0 * PI);       ans = min(ans, get_mx(ct) - get_mn(ct));     }     cout << fixed << setprecision(10) << ans;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     for (long long i = 0; i < t; i++) {       solve();     }     return 0;   }   