Language: C++

/**

 * code generated by JHelper

 * More info: https://github.com/AlexeyDmitriev/JHelper

 * @author Gosu_Hiroo

 */

#include <iostream>

#include <fstream>

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#ifdef int

#define VI vector<long long>

#define V2I(v,size_1, size_2, value) vector<vector<long long>>v(size_1, vector<long long>(size_2, value))

#define V3I(v,size_1,size_2,size_3,value) vector<vector<vector<long long>>>v(size_1,vector<vector<long long>>(size_2,vector<long long>(size_3, value)))

#define G(g,size_1) vector<vector<long long>>g(size_1, vector<long long>())

#define SZ(x) ((long long)(x).size())

#define READ ({long long t;cin >> t;t;})

#define PII pair<long long, long long>

#else

#define VI vector<int>

#define V2I(v,size_1, size_2, value) vector<vector<int>>v(size_1, vector<int>(size_2, value))

#define V3I(v,size_1,size_2,size_3,value) vector<vector<vector<int>>>v(size_1,vector<vector<int>>(size_2,vector<int>(size_3, value)))

#define G(g,size_1) vector<vector<int>>g(size_1, vector<int>())

#define SZ(x) ((int)(x).size())

#define READ ({int t;cin >> t;t;})

#define PII pair<int, int>

#endif

#define V2(v,type,size_1, size_2, value) vector<vector<type>>v(size_1, vector<type>(size_2, value))

#define V3(v,type,size_1,size_2,size_3,value) vector<vector<vector<type>>>v(size_1,vector<vector<type>>(size_2,vector<type>(size_3, value)))

#define TR(container, it) \

        for (auto it = container.begin(); it != container.end(); it++)

#define IN(c, x) ((c).find(x) != (c).end())   //O(log n)

#define IN_L(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)

#define FOR(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)

#define ALL(x) (x).begin(),(x).end()

#define F first

#define S second

#define y0 y3487465

#define y1 y8687969

#define j0 j1347829

#define j1 j234892

#define MOD(x, m) ((((x) % (m)) + (m)) % (m))

#define BIT(n) (1LL<<(n))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define EB emplace_back

#define PB push_back

#define fcout cout << fixed << setprecision(12)

#define fcerr cerr << fixed << setprecision(12)

#define print(x) cout << (x) << endl

#define fprint(x) cout << fixed << setprecision(12) << (x) << endl

# define BYE(a) do { cout << (a) << endl; return ; } while (false)

#ifdef DEBUG

#define ERR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); _err(cerr,_it, args); }

#define DBG(x) cerr << #x << " is " << x << endl;

#else

#define DBG(x) {};

#define ERR(args...) {};

#endif

void _err(std::ostream& cerr,istream_iterator<string> it) {cerr << endl;}

template<typename T, typename... Args>

void _err(std::ostream& cerr, istream_iterator<string> it, T a, Args... args) {

    cerr << *it << " = " << a << "  ";

    _err(cerr,++it, args...);

}

const int pi = 2 * acos(.0);

const int inf = 0x3f3f3f3f;

const ll mod = (ll) (1e9) + 7;

//const ll mod = (ll) 998244353 ;

const int eps = 1e-10;

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val) {

    std::fill((T *) array, (T *) (array + N), val);

}

template <typename T>

ostream& operator << (ostream& os, const vector<T> V) {

    os << "[";

    int cnt = 0;

    T curr;

    if(!V.empty()){

        for (int i = 0; i < V.size() - 1; ++i) {

            if(V[i] == curr)cnt ++;

            else cnt = 0;

            if(cnt == 4)os << "... ";

            if(cnt < 4)

                os << V[i] << " ";

            curr = V[i];

        }

        os << V.back();

    }

    os << "]";

    return os;

}

template <typename T, typename U>

ostream& operator << (ostream& os, const pair<T,U> P) {

    os << "(";

    os << P.first << "," << P.second;

    os << ")";

    return os;

}

template <typename T, typename U>

ostream& operator << (ostream& os, const set<T,U> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename H, typename P>

ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename C>

ostream& operator << (ostream& os, const multiset<K, C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename T, typename C>

ostream& operator << (ostream& os, const map<K,T,C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << "(";

            os << it->first << "," << it->second;

            os << ") ";

            it++;

        }

        os << "(";

        os << it->first << "," << it->second;

        os << ")";

    }

    os << "}";

    return os;

}

template <typename K, typename T, typename C>

ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << "(";

            os << it->first << "," << it->second;

            os << ") ";

            it++;

        }

        os << "(";

        os << it->first << "," << it->second;

        os << ")";

    }

    os << "}";

    return os;

}

template <typename T>

ostream& operator << (ostream& os, const deque<T> V) {

    os << "[";

    if (!V.empty()) {

        for (int i = 0; i < V.size() - 1; ++i) {

            os << V[i] << "->";

        }

        if (!V.empty())os << V.back();

    }

    os << "]";

    return os;

};

template <typename T, typename Cont, typename Comp>

ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {

    priority_queue<T, Cont, Comp> _V = V;

    os << "[";

    if(!_V.empty()){

        while(_V.size() > 1){

            os << _V.top() << "->";

            _V.pop();

        }

        os << _V.top();

    }

    os << "]";

    return os;

};

template <class F>

struct y_combinator {

    F f; // the lambda will be stored here

    // a forwarding operator():

    template <class... Args>

    decltype(auto) operator()(Args&&... args) const {

        // we pass ourselves to f, then the arguments.

        // the lambda should take the first argument as `auto&& recurse` or similar.

        return f(*this, std::forward<Args>(args)...);

    }

};

// helper function that deduces the type of the lambda:

template <class F>

y_combinator<std::decay_t<F>> recursive(F&& f){

return {std::forward<F>(f)};

}

struct hash_pair {

    template <class T1, class T2>

    size_t operator()(const pair<T1, T2>& p) const

    {

        auto hash1 = hash<T1>{}(p.first);

        auto hash2 = hash<T2>{}(p.second);

        return hash1 ^ hash2;

    }

};

 /*

struct X{

    int x,y,id;

    bool operator < (const X R)const{

        return id < R.id;

    }

    friend ostream& operator << (ostream& os,  X R){

        os << "(" << R.x << "," << R.y << "," << R.id << ")";

    }

    friend bool operator == (const X L,  const X R){

        return L.id == R.id;

    }

*/

template<class T>void Chmod(T &a, const T &m) {a = MOD(a, m);}

template<class T>bool Chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

template<class T>bool Chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//256MB = 2^29(~5.3*10^8)*sizeof(int)

//#define int ll //2^31=2.15*10^9, 2^63=9.22*10^18

class FEncloseAll {

public:

void solve(std::istream& cin, std::ostream& cout, std::ostream& cerr) {

    int N;

    cin >> N;

    vector<PII> points(N);

    REP(i,N){int x, y; cin >> x >> y;points[i] = {x,y};}

    auto ok = [&](int x1, int y1, int x2, int y2, int x3, int y3){

        return (y2-y1)*(x3-x1) != (y3 - y1)*(x2 -x1) && (y2-y1)*(x3-x1) != -(y3 - y1)*(x2 -x1);

    };

    auto findCircle = [&](double x1, double y1, double x2, double y2, double x3, double y3)

    {

        double x12 = x1 - x2;

        double x13 = x1 - x3;

        double y12 = y1 - y2;

        double y13 = y1 - y3;

        double y31 = y3 - y1;

        double y21 = y2 - y1;

        double x31 = x3 - x1;

        double x21 = x2 - x1;

        // x1^2 - x3^2

        double sx13 = pow(x1, 2) - pow(x3, 2);

        // y1^2 - y3^2

        double sy13 = pow(y1, 2) - pow(y3, 2);

        double sx21 = pow(x2, 2) - pow(x1, 2);

        double sy21 = pow(y2, 2) - pow(y1, 2);

        double f = ((sx13) * (x12)

                 + (sy13) * (x12)

                 + (sx21) * (x13)

                 + (sy21) * (x13))

                / (2 * ((y31) * (x12) - (y21) * (x13)));

        double g = ((sx13) * (y12)

                 + (sy13) * (y12)

                 + (sx21) * (y13)

                 + (sy21) * (y13))

                / (2 * ((x31) * (y12) - (x21) * (y13)));

        double c = -pow(x1, 2) - pow(y1, 2) - 2 * g * x1 - 2 * f * y1;

        // eqn of circle be x^2 + y^2 + 2*g*x + 2*f*y + c = 0

        // where centre is (h = -g, k = -f) and radius r

        // as r^2 = h^2 + k^2 - c

        double h = -g;

        double k = -f;

        double sqr_of_r = h * h + k * k - c;

        // r is the radius

        double r = sqrt(sqr_of_r);

        REP(i,N)if((points[i].F - h) * (points[i].F - h) + (points[i].S - k) * (points[i].S - k) > 1e-8 + r * r)return -1.;

        return r;

//            cout << "Centre = (" << h << ", " << k << ")" << endl;

//        cout << "Radius = " << r;

    };

    auto f = [&](double x1, double y1, double x2, double y2){

        double h = (x1 + x2)/2. , k = (y1+y2)/2., r = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1) * (y2-y1))/2;

        REP(i,N)if((points[i].F - h) * (points[i].F - h) + (points[i].S - k) * (points[i].S - k) > 1e-8 + r * r)return -1.;

        return r;

    };

    double  ans = 1e8;

    REP(i,N-1)FOR(j,i+1,N)if(f(points[i].F, points[i].S, points[j].F, points[j].S) > 0)Chmin(ans, f(points[i].F, points[i].S, points[j].F, points[j].S));

    if(N>2)REP(i,N-2)FOR(j,i+1,N-1)FOR(k,i+2,N)if(ok(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S))if(findCircle(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S) > 0)Chmin(ans, findCircle(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S));

    fprint(ans);

}

};

#undef int

int main() {

	FEncloseAll solver;/**

 * code generated by JHelper

 * More info: https://github.com/AlexeyDmitriev/JHelper

 * @author Gosu_Hiroo

 */

#include <iostream>

#include <fstream>

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#ifdef int

#define VI vector<long long>

#define V2I(v,size_1, size_2, value) vector<vector<long long>>v(size_1, vector<long long>(size_2, value))

#define V3I(v,size_1,size_2,size_3,value) vector<vector<vector<long long>>>v(size_1,vector<vector<long long>>(size_2,vector<long long>(size_3, value)))

#define G(g,size_1) vector<vector<long long>>g(size_1, vector<long long>())

#define SZ(x) ((long long)(x).size())

#define READ ({long long t;cin >> t;t;})

#define PII pair<long long, long long>

#else

#define VI vector<int>

#define V2I(v,size_1, size_2, value) vector<vector<int>>v(size_1, vector<int>(size_2, value))

#define V3I(v,size_1,size_2,size_3,value) vector<vector<vector<int>>>v(size_1,vector<vector<int>>(size_2,vector<int>(size_3, value)))

#define G(g,size_1) vector<vector<int>>g(size_1, vector<int>())

#define SZ(x) ((int)(x).size())

#define READ ({int t;cin >> t;t;})

#define PII pair<int, int>

#endif

#define V2(v,type,size_1, size_2, value) vector<vector<type>>v(size_1, vector<type>(size_2, value))

#define V3(v,type,size_1,size_2,size_3,value) vector<vector<vector<type>>>v(size_1,vector<vector<type>>(size_2,vector<type>(size_3, value)))

#define TR(container, it) \

        for (auto it = container.begin(); it != container.end(); it++)

#define IN(c, x) ((c).find(x) != (c).end())   //O(log n)

#define IN_L(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)

#define FOR(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)

#define ALL(x) (x).begin(),(x).end()

#define F first

#define S second

#define y0 y3487465

#define y1 y8687969

#define j0 j1347829

#define j1 j234892

#define MOD(x, m) ((((x) % (m)) + (m)) % (m))

#define BIT(n) (1LL<<(n))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define EB emplace_back

#define PB push_back

#define fcout cout << fixed << setprecision(12)

#define fcerr cerr << fixed << setprecision(12)

#define print(x) cout << (x) << endl

#define fprint(x) cout << fixed << setprecision(12) << (x) << endl

# define BYE(a) do { cout << (a) << endl; return ; } while (false)

#ifdef DEBUG

#define ERR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); _err(cerr,_it, args); }

#define DBG(x) cerr << #x << " is " << x << endl;

#else

#define DBG(x) {};

#define ERR(args...) {};

#endif

void _err(std::ostream& cerr,istream_iterator<string> it) {cerr << endl;}

template<typename T, typename... Args>

void _err(std::ostream& cerr, istream_iterator<string> it, T a, Args... args) {

    cerr << *it << " = " << a << "  ";

    _err(cerr,++it, args...);

}

const int pi = 2 * acos(.0);

const int inf = 0x3f3f3f3f;

const ll mod = (ll) (1e9) + 7;

//const ll mod = (ll) 998244353 ;

const int eps = 1e-10;

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val) {

    std::fill((T *) array, (T *) (array + N), val);

}

template <typename T>

ostream& operator << (ostream& os, const vector<T> V) {

    os << "[";

    int cnt = 0;

    T curr;

    if(!V.empty()){

        for (int i = 0; i < V.size() - 1; ++i) {

            if(V[i] == curr)cnt ++;

            else cnt = 0;

            if(cnt == 4)os << "... ";

            if(cnt < 4)

                os << V[i] << " ";

            curr = V[i];

        }

        os << V.back();

    }

    os << "]";

    return os;

}

template <typename T, typename U>

ostream& operator << (ostream& os, const pair<T,U> P) {

    os << "(";

    os << P.first << "," << P.second;

    os << ")";

    return os;

}

template <typename T, typename U>

ostream& operator << (ostream& os, const set<T,U> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename H, typename P>

ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename C>

ostream& operator << (ostream& os, const multiset<K, C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename T, typename C>

ostream& operator << (ostream& os, const map<K,T,C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << "(";

            os << it->first << "," << it->second;

            os << ") ";

            it++;

        }

        os << "(";

        os << it->first << "," << it->second;

        os << ")";

    }

    os << "}";

    return os;

}

template <typename K, typename T, typename C>

ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << "(";

            os << it->first << "," << it->second;

            os << ") ";

            it++;

        }

        os << "(";

        os << it->first << "," << it->second;

        os << ")";

    }

    os << "}";

    return os;

}

template <typename T>

ostream& operator << (ostream& os, const deque<T> V) {

    os << "[";

    if (!V.empty()) {

        for (int i = 0; i < V.size() - 1; ++i) {

            os << V[i] << "->";

        }

        if (!V.empty())os << V.back();

    }

    os << "]";

    return os;

};

template <typename T, typename Cont, typename Comp>

ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {

    priority_queue<T, Cont, Comp> _V = V;

    os << "[";

    if(!_V.empty()){

        while(_V.size() > 1){

            os << _V.top() << "->";

            _V.pop();

        }

        os << _V.top();

    }

    os << "]";

    return os;

};

template <class F>

struct y_combinator {

    F f; // the lambda will be stored here

    // a forwarding operator():

    template <class... Args>

    decltype(auto) operator()(Args&&... args) const {

        // we pass ourselves to f, then the arguments.

        // the lambda should take the first argument as `auto&& recurse` or similar.

        return f(*this, std::forward<Args>(args)...);

    }

};

// helper function that deduces the type of the lambda:

template <class F>

y_combinator<std::decay_t<F>> recursive(F&& f){

return {std::forward<F>(f)};

}

struct hash_pair {

    template <class T1, class T2>

    size_t operator()(const pair<T1, T2>& p) const

    {

        auto hash1 = hash<T1>{}(p.first);

        auto hash2 = hash<T2>{}(p.second);

        return hash1 ^ hash2;

    }

};

 /*

struct X{

    int x,y,id;

    bool operator < (const X R)const{

        return id < R.id;

    }

    friend ostream& operator << (ostream& os,  X R){

        os << "(" << R.x << "," << R.y << "," << R.id << ")";

    }

    friend bool operator == (const X L,  const X R){

        return L.id == R.id;

    }

*/

template<class T>void Chmod(T &a, const T &m) {a = MOD(a, m);}

template<class T>bool Chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

template<class T>bool Chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//256MB = 2^29(~5.3*10^8)*sizeof(int)

//#define int ll //2^31=2.15*10^9, 2^63=9.22*10^18

class FEncloseAll {

public:

void solve(std::istream& cin, std::ostream& cout, std::ostream& cerr) {

    int N;

    cin >> N;

    vector<PII> points(N);

    REP(i,N){int x, y; cin >> x >> y;points[i] = {x,y};}

    auto ok = [&](int x1, int y1, int x2, int y2, int x3, int y3){

        return (y2-y1)*(x3-x1) != (y3 - y1)*(x2 -x1) && (y2-y1)*(x3-x1) != -(y3 - y1)*(x2 -x1);

    };

    auto findCircle = [&](double x1, double y1, double x2, double y2, double x3, double y3)

    {

        double x12 = x1 - x2;

        double x13 = x1 - x3;

        double y12 = y1 - y2;

        double y13 = y1 - y3;

        double y31 = y3 - y1;

        double y21 = y2 - y1;

        double x31 = x3 - x1;

        double x21 = x2 - x1;

        // x1^2 - x3^2

        double sx13 = pow(x1, 2) - pow(x3, 2);

        // y1^2 - y3^2

        double sy13 = pow(y1, 2) - pow(y3, 2);

        double sx21 = pow(x2, 2) - pow(x1, 2);

        double sy21 = pow(y2, 2) - pow(y1, 2);

        double f = ((sx13) * (x12)

                 + (sy13) * (x12)

                 + (sx21) * (x13)

                 + (sy21) * (x13))

                / (2 * ((y31) * (x12) - (y21) * (x13)));

        double g = ((sx13) * (y12)

                 + (sy13) * (y12)

                 + (sx21) * (y13)

                 + (sy21) * (y13))

                / (2 * ((x31) * (y12) - (x21) * (y13)));

        double c = -pow(x1, 2) - pow(y1, 2) - 2 * g * x1 - 2 * f * y1;

        // eqn of circle be x^2 + y^2 + 2*g*x + 2*f*y + c = 0

        // where centre is (h = -g, k = -f) and radius r

        // as r^2 = h^2 + k^2 - c

        double h = -g;

        double k = -f;

        double sqr_of_r = h * h + k * k - c;

        // r is the radius

        double r = sqrt(sqr_of_r);

        REP(i,N)if((points[i].F - h) * (points[i].F - h) + (points[i].S - k) * (points[i].S - k) > r * r)return -1.;

        return r;

//            cout << "Centre = (" << h << ", " << k << ")" << endl;

//        cout << "Radius = " << r;

    };

    auto f = [&](double x1, double y1, double x2, double y2){

        double h = (x1 + x2)/2. , k = (y1+y2)/2., r = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1) * (y2-y1))/2;

        REP(i,N)if((points[i].F - h) * (points[i].F - h) + (points[i].S - k) * (points[i].S - k) > + r * r)return -1.;

        return r;

    };

    double  ans = 1e8;

    REP(i,N-1)FOR(j,i+1,N)if(f(points[i].F, points[i].S, points[j].F, points[j].S) > 0)Chmin(ans, f(points[i].F, points[i].S, points[j].F, points[j].S));

    if(N>2)REP(i,N-2)FOR(j,i+1,N-1)FOR(k,i+2,N)if(ok(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S))if(findCircle(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S) > 0)Chmin(ans, findCircle(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S));

    fprint(ans);

}

};

#undef int

int main() {

	FEncloseAll solver;	std::istream& in(std::cin);

	std::istream& in(std::cin);

	std::ostream& out(std::cout);

    std::ostringstream err;

	in.tie(0); ios::sync_with_stdio(0);

//	solver.solve(in, out);

    solver.solve(in, out,err);

	return 0;

}

	std::ostream& out(std::cout);

    std::ostringstream err;

	in.tie(0); ios::sync_with_stdio(0);

//	solver.solve(in, out);

    solver.solve(in, out,err);

	return 0;

}

/**

 * code generated by JHelper

 * More info: https://github.com/AlexeyDmitriev/JHelper

 * @author Gosu_Hiroo

 */

#include <iostream>

#include <fstream>

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#ifdef int

#define VI vector<long long>

#define V2I(v,size_1, size_2, value) vector<vector<long long>>v(size_1, vector<long long>(size_2, value))

#define V3I(v,size_1,size_2,size_3,value) vector<vector<vector<long long>>>v(size_1,vector<vector<long long>>(size_2,vector<long long>(size_3, value)))

#define G(g,size_1) vector<vector<long long>>g(size_1, vector<long long>())

#define SZ(x) ((long long)(x).size())

#define READ ({long long t;cin >> t;t;})

#define PII pair<long long, long long>

#else

#define VI vector<int>

#define V2I(v,size_1, size_2, value) vector<vector<int>>v(size_1, vector<int>(size_2, value))

#define V3I(v,size_1,size_2,size_3,value) vector<vector<vector<int>>>v(size_1,vector<vector<int>>(size_2,vector<int>(size_3, value)))

#define G(g,size_1) vector<vector<int>>g(size_1, vector<int>())

#define SZ(x) ((int)(x).size())

#define READ ({int t;cin >> t;t;})

#define PII pair<int, int>

#endif

#define V2(v,type,size_1, size_2, value) vector<vector<type>>v(size_1, vector<type>(size_2, value))

#define V3(v,type,size_1,size_2,size_3,value) vector<vector<vector<type>>>v(size_1,vector<vector<type>>(size_2,vector<type>(size_3, value)))

#define TR(container, it) \

        for (auto it = container.begin(); it != container.end(); it++)

#define IN(c, x) ((c).find(x) != (c).end())   //O(log n)

#define IN_L(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)

#define FOR(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)

#define ALL(x) (x).begin(),(x).end()

#define F first

#define S second

#define y0 y3487465

#define y1 y8687969

#define j0 j1347829

#define j1 j234892

#define MOD(x, m) ((((x) % (m)) + (m)) % (m))

#define BIT(n) (1LL<<(n))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define EB emplace_back

#define PB push_back

#define fcout cout << fixed << setprecision(12)

#define fcerr cerr << fixed << setprecision(12)

#define print(x) cout << (x) << endl

#define fprint(x) cout << fixed << setprecision(12) << (x) << endl

# define BYE(a) do { cout << (a) << endl; return ; } while (false)

#ifdef DEBUG

#define ERR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); _err(cerr,_it, args); }

#define DBG(x) cerr << #x << " is " << x << endl;

#else

#define DBG(x) {};

#define ERR(args...) {};

#endif

void _err(std::ostream& cerr,istream_iterator<string> it) {cerr << endl;}

template<typename T, typename... Args>

void _err(std::ostream& cerr, istream_iterator<string> it, T a, Args... args) {

    cerr << *it << " = " << a << "  ";

    _err(cerr,++it, args...);

}

const int pi = 2 * acos(.0);

const int inf = 0x3f3f3f3f;

const ll mod = (ll) (1e9) + 7;

//const ll mod = (ll) 998244353 ;

const int eps = 1e-10;

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val) {

    std::fill((T *) array, (T *) (array + N), val);

}

template <typename T>

ostream& operator << (ostream& os, const vector<T> V) {

    os << "[";

    int cnt = 0;

    T curr;

    if(!V.empty()){

        for (int i = 0; i < V.size() - 1; ++i) {

            if(V[i] == curr)cnt ++;

            else cnt = 0;

            if(cnt == 4)os << "... ";

            if(cnt < 4)

                os << V[i] << " ";

            curr = V[i];

        }

        os << V.back();

    }

    os << "]";

    return os;

}

template <typename T, typename U>

ostream& operator << (ostream& os, const pair<T,U> P) {

    os << "(";

    os << P.first << "," << P.second;

    os << ")";

    return os;

}

template <typename T, typename U>

ostream& operator << (ostream& os, const set<T,U> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename H, typename P>

ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename C>

ostream& operator << (ostream& os, const multiset<K, C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << *it << " ";

            it++;

        }

        os << *it;

    }

    os << "}";

    return os;

}

template <typename K, typename T, typename C>

ostream& operator << (ostream& os, const map<K,T,C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << "(";

            os << it->first << "," << it->second;

            os << ") ";

            it++;

        }

        os << "(";

        os << it->first << "," << it->second;

        os << ")";

    }

    os << "}";

    return os;

}

template <typename K, typename T, typename C>

ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {

    os << "{";

    if(!V.empty()){

        auto it = V.begin();

        for (int i = 0; i < V.size() -1; ++i) {

            os << "(";

            os << it->first << "," << it->second;

            os << ") ";

            it++;

        }

        os << "(";

        os << it->first << "," << it->second;

        os << ")";

    }

    os << "}";

    return os;

}

template <typename T>

ostream& operator << (ostream& os, const deque<T> V) {

    os << "[";

    if (!V.empty()) {

        for (int i = 0; i < V.size() - 1; ++i) {

            os << V[i] << "->";

        }

        if (!V.empty())os << V.back();

    }

    os << "]";

    return os;

};

template <typename T, typename Cont, typename Comp>

ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {

    priority_queue<T, Cont, Comp> _V = V;

    os << "[";

    if(!_V.empty()){

        while(_V.size() > 1){

            os << _V.top() << "->";

            _V.pop();

        }

        os << _V.top();

    }

    os << "]";

    return os;

};

template <class F>

struct y_combinator {

    F f; // the lambda will be stored here

    // a forwarding operator():

    template <class... Args>

    decltype(auto) operator()(Args&&... args) const {

        // we pass ourselves to f, then the arguments.

        // the lambda should take the first argument as `auto&& recurse` or similar.

        return f(*this, std::forward<Args>(args)...);

    }

};

// helper function that deduces the type of the lambda:

template <class F>

y_combinator<std::decay_t<F>> recursive(F&& f){

return {std::forward<F>(f)};

}

struct hash_pair {

    template <class T1, class T2>

    size_t operator()(const pair<T1, T2>& p) const

    {

        auto hash1 = hash<T1>{}(p.first);

        auto hash2 = hash<T2>{}(p.second);

        return hash1 ^ hash2;

    }

};

 /*

struct X{

    int x,y,id;

    bool operator < (const X R)const{

        return id < R.id;

    }

    friend ostream& operator << (ostream& os,  X R){

        os << "(" << R.x << "," << R.y << "," << R.id << ")";

    }

    friend bool operator == (const X L,  const X R){

        return L.id == R.id;

    }

*/

template<class T>void Chmod(T &a, const T &m) {a = MOD(a, m);}

template<class T>bool Chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

template<class T>bool Chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//256MB = 2^29(~5.3*10^8)*sizeof(int)

//#define int ll //2^31=2.15*10^9, 2^63=9.22*10^18

class FEncloseAll {

public:

void solve(std::istream& cin, std::ostream& cout, std::ostream& cerr) {

    int N;

    cin >> N;

    vector<PII> points(N);

    REP(i,N){int x, y; cin >> x >> y;points[i] = {x,y};}

    auto ok = [&](int x1, int y1, int x2, int y2, int x3, int y3){

        return (y2-y1)*(x3-x1) != (y3 - y1)*(x2 -x1) && (y2-y1)*(x3-x1) != -(y3 - y1)*(x2 -x1);

    };

    auto findCircle = [&](double x1, double y1, double x2, double y2, double x3, double y3)

    {

        double x12 = x1 - x2;

        double x13 = x1 - x3;

        double y12 = y1 - y2;

        double y13 = y1 - y3;

        double y31 = y3 - y1;

        double y21 = y2 - y1;

        double x31 = x3 - x1;

        double x21 = x2 - x1;

        // x1^2 - x3^2

        double sx13 = pow(x1, 2) - pow(x3, 2);

        // y1^2 - y3^2

        double sy13 = pow(y1, 2) - pow(y3, 2);

        double sx21 = pow(x2, 2) - pow(x1, 2);

        double sy21 = pow(y2, 2) - pow(y1, 2);

        double f = ((sx13) * (x12)

                 + (sy13) * (x12)

                 + (sx21) * (x13)

                 + (sy21) * (x13))

                / (2 * ((y31) * (x12) - (y21) * (x13)));

        double g = ((sx13) * (y12)

                 + (sy13) * (y12)

                 + (sx21) * (y13)

                 + (sy21) * (y13))

                / (2 * ((x31) * (y12) - (x21) * (y13)));

        double c = -pow(x1, 2) - pow(y1, 2) - 2 * g * x1 - 2 * f * y1;

        // eqn of circle be x^2 + y^2 + 2*g*x + 2*f*y + c = 0

        // where centre is (h = -g, k = -f) and radius r

        // as r^2 = h^2 + k^2 - c

        double h = -g;

        double k = -f;

        double sqr_of_r = h * h + k * k - c;

        // r is the radius

        double r = sqrt(sqr_of_r);

        REP(i,N)if((points[i].F - h) * (points[i].F - h) + (points[i].S - k) * (points[i].S - k) > 1e-8 + r * r)return -1.;

        return r;

//            cout << "Centre = (" << h << ", " << k << ")" << endl;

//        cout << "Radius = " << r;

    };

    auto f = [&](double x1, double y1, double x2, double y2){

        double h = (x1 + x2)/2. , k = (y1+y2)/2., r = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1) * (y2-y1))/2;

        REP(i,N)if((points[i].F - h) * (points[i].F - h) + (points[i].S - k) * (points[i].S - k) > 1e-8 + r * r)return -1.;

        return r;

    };

    double  ans = 1e8;

    REP(i,N-1)FOR(j,i+1,N)if(f(points[i].F, points[i].S, points[j].F, points[j].S) > 0)Chmin(ans, f(points[i].F, points[i].S, points[j].F, points[j].S));

    if(N>2)REP(i,N-2)FOR(j,i+1,N-1)FOR(k,i+2,N)if(ok(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S))if(findCircle(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S) > 0)Chmin(ans, findCircle(points[i].F, points[i].S, points[j].F, points[j].S, points[k].F, points[k].S));

    fprint(ans);

}

};

#undef int

int main() {

	FEncloseAll solver;

	std::istream& in(std::cin);

	std::ostream& out(std::cout);

    std::ostringstream err;

	in.tie(0); ios::sync_with_stdio(0);

//	solver.solve(in, out);

    solver.solve(in, out,err);

	return 0;

}

Compiler output:
a.cc:61:9: error: expected unqualified-id before 'for'
   61 |         for (auto it = container.begin(); it != container.end(); it++)
      |         ^~~
a.cc:61:43: error: 'it' does not name a type; did you mean 'int'?
   61 |         for (auto it = container.begin(); it != container.end(); it++)
      |                                           ^~
      |                                           int
a.cc:61:66: error: 'it' does not name a type; did you mean 'int'?
   61 |         for (auto it = container.begin(); it != container.end(); it++)
      |                                                                  ^~
      |                                                                  int
a.cc: In function 'int main()':
a.cc:681:24: error: 'container' was not declared in this scope
  681 |         for (auto it = container.begin(); it != container.end(); it++)
      |                        ^~~~~~~~~
a.cc:739:59: error: a function-definition is not allowed here before '{' token
  739 | void _err(std::ostream& cerr,istream_iterator<string> it) {cerr << endl;}
      |                                                           ^
a.cc:741:1: error: a template declaration cannot appear at block scope
  741 | template<typename T, typename... Args>
      | ^~~~~~~~
a.cc:761:1: error: a template declaration cannot appear at block scope
  761 | template<typename A, size_t N, typename T>
      | ^~~~~~~~
a.cc:807:1: error: a template declaration cannot appear at block scope
  807 | template <typename T, typename U>
      | ^~~~~~~~
a.cc:849:1: error: a template declaration cannot appear at block scope
  849 | template <typename K, typename H, typename P>
      | ^~~~~~~~
a.cc:905:1: error: a template declaration cannot appear at block scope
  905 | template <typename K, typename T, typename C>
      | ^~~~~~~~
a.cc:977:1: error: a template declaration cannot appear at block scope
  977 | template <typename T>
      | ^~~~~~~~
a.cc:1001:1: error: a template declaration cannot appear at block scope
 1001 | template <typename T, typename Cont, typename Comp>
      | ^~~~~~~~
a.cc:1029:1: error: a template declaration cannot appear at block scope
 1029 | template <class F>
      | ^~~~~~~~
a.cc:1053:1: error: a template declaration cannot appear at block scope
 1053 | template <class F>
      | ^~~~~~~~
a.cc:1105:1: error: a template declaration cannot appear at block scope
 1105 | template<class T>void Chmod(T &a, const T &m) {a = MOD(a, m);}
      | ^~~~~~~~
a.cc:1109:1: error: a template declaration cannot appear at block scope
 1109 | template<class T>bool Chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
      | ^~~~~~~~
a.cc:1239:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
 1239 | int main() {
      |         ^~
a.cc:1239:9: note: remove parentheses to default-initialize a variable
 1239 | int main() {
      |         ^~
      |         --
a.cc:1239:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:1239:12: error: a function-definition is not allowed here before '{' token
 1239 | int main() {
      |            ^
a.cc:1263:9: error: 'in' was not declared in this scope; did you mean 'inf'?
 1263 |         in.tie(0); ios::sync_with_stdio(0);
      |         ^~
      |         inf
a.cc: At global scope:
a.cc:1333:9: error: expected unqualified-id before 'for'
 1333 |         for (auto it = container.begin(); it != container.end(); it++)
      |         ^~~
a.cc:1333:43: error: 'it' does not name a type; did you mean 'int'?
 1333 |         for (auto it = container.begin(); it != container.end(); it++)
      |                                           ^~
      |                                           int
a.cc:1333:66: error: 'it' does not name a type; did you mean 'int'?
 1333 |         for (auto it = container.begin(); it != container.end(); it++)
      |                                                                  ^~
      |                                                                  int
a.cc:1395:6: error: redefinition of 'template<class T, class ... Args> void _err(std::ostream&, std::istream_iterator<std::__cxx11::basic_string<char> >, T, Args ...)'
 1395 | void _err(std::ostream& cerr, istream_iterator<string> it, T a, Args... args) {
      |      ^~~~
a.cc:123:6: note: 'template<class T, class ... Args> void _err(std::ostream&, std::istream_iterator<std::__cxx11::basic_string<char> >, T, Args ...)' previously declared here
  123 | void _err(std::ostream& cerr, istream_iterator<string> it, T a, Args... args) {
      |      ^~~~
a.cc:1403:11: error: redefinition of 'const int pi'
 1403 | const int pi = 2 * acos(.0);
      |           ^~
a.cc:131:11: note: 'const int pi' previously defined here
  131 | const int pi = 2 * acos(.0);
      |           ^~
a.cc:1405:11: error: redefinition of 'const int inf'
 1405 | const int inf = 0x3f3f3f3f;
      |           ^~~
a.cc:133:11: note: 'const int inf' previously defined here
  133 | const int inf = 0x3f3f3f3f;
      |           ^~~
a.cc:1407:10: error: redefinition of 'const ll mod'
 1407 | const ll mod = (ll) (1e9) + 7;
      |          ^~~
a.cc:135:10: note: 'const ll mod' previously defined here
  135 | const ll mod = (ll) (1e9) + 7;
      |          ^~~
a.cc:1411:11: error: redefinition of 'const int eps'
 1411 | const int eps = 1e-10;
      |           ^~~
a.cc:139:11: note: 'const int eps' previously defined here
  139 | const int eps = 1e-10;
      |           ^~~
a.cc:1415:6: error: redefinition of 'template<class A, long unsigned int N, class T> void Fill(A (&)[N], const T&)'
 1415 | void Fill(A (&array)[N], const T &val) {
      |      ^~~~
a.cc:143:6: note: 'template<class A, long unsigned int N, class T> void Fill(A (&)[N], const T&)' previously declared here
  143 | void Fill(A (&array)[N], const T &val) {
      |      ^~~~
a.cc:1423:10: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>)'
 1423 | ostream& operator << (ostream& os, const vector<T> V) {
      |          ^~~~~~~~
a.cc:151:10: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>)' previously declared here
  151 | ostream& operator << (ostream& os, const vector<T> V) {
      |          ^~~~~~~~
a.cc:1461:10: error: redefinition of 'template<class T, class U> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)'
 1461 | ostream& operator << (ostream& os, const pair<T,U> P) {
      |          ^~~~~~~~
a.cc:189:10: note: 'template<class T, class U> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)' previously declared here
  189 | ostream& operator << (ostream& os, const pair<T,U> P) {
      |          ^~~~~~~~
a.cc:1475:10: error: redefinition of 'template<class T, class U> std::ostream& operator<<(std::ostream&, std::set<T, U>)'
 1475 | ostream& operator << (ostream& os, const set<T,U> V) {
      |          ^~~~~~~~
a.cc:203:10: note: 'template<class T, class U> std::ostream& operator<<(std::ostream&, std::set<T, U>)' previously declared here
  203 | ostream& operator << (ostream& os, const set<T,U> V) {
      |          ^~~~~~~~
a.cc:1503:10: error: redefinition of 'template<class K, class H, class P> std::ostream& operator<<(std::ostream&, std::unordered_set<K, H, P>)'
 1503 | ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {
      |          ^~~~~~~~
a.cc:231:10: note: 'template<class K, class H, class P> std::ostream& operator<<(std::ostream&, std::unordered_set<K, H, P>)' previously declared here
  231 | ostream& operator << (ostream& os, const unordered_set<K, H, P> V) {
      |          ^~~~~~~~
a.cc:1531:10: error: redefinition of 'template<class K, class C> std::ostream& operator<<(std::ostream&, std::multiset<K, C>)'
 1531 | ostream& operator << (ostream& os, const multiset<K, C> V) {
      |          ^~~~~~~~
a.cc:259:10: note: 'template<class K, class C> std::ostream& operator<<(std::ostream&, std::multiset<K, C>)' previously declared here
  259 | ostream& operator << (ostream& os, const multiset<K, C> V) {
      |          ^~~~~~~~
a.cc:1559:10: error: redefinition of 'template<class K, class T, class C> std::ostream& operator<<(std::ostream&, std::map<K, T, C>)'
 1559 | ostream& operator << (ostream& os, const map<K,T,C> V) {
      |          ^~~~~~~~
a.cc:287:10: note: 'template<class K, class T, class C> std::ostream& operator<<(std::ostream&, std::map<K, T, C>)' previously declared here
  287 | ostream& operator << (ostream& os, const map<K,T,C> V) {
      |          ^~~~~~~~
a.cc:1595:10: error: redefinition of 'template<class K, class T, class C> std::ostream& operator<<(std::ostream&, std::unordered_map<K, T, C>)'
 1595 | ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {
      |          ^~~~~~~~
a.cc:323:10: note: 'template<class K, class T, class C> std::ostream& operator<<(std::ostream&, std::unordered_map<K, T, C>)' previously declared here
  323 | ostream& operator << (ostream& os, const unordered_map<K,T,C> V) {
      |          ^~~~~~~~
a.cc:1631:10: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::deque<_Tp>)'
 1631 | ostream& operator << (ostream& os, const deque<T> V) {
      |          ^~~~~~~~
a.cc:359:10: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::deque<_Tp>)' previously declared here
  359 | ostream& operator << (ostream& os, const deque<T> V) {
      |          ^~~~~~~~
a.cc:1655:10: error: redefinition of 'template<class T, class Cont, class Comp> std::ostream& operator<<(std::ostream&, std::priority_queue<_Tp, _Sequence, _Compare>)'
 1655 | ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {
      |          ^~~~~~~~
a.cc:383:10: note: 'template<class T, class Cont, class Comp> std::ostream& operator<<(std::ostream&, std::priority_queue<_Tp, _Sequence, _Compare>)' previously declared here
  383 | ostream& operator << (ostream& os, const priority_queue<T, Cont, Comp> V) {
      |          ^~~~~~~~
a.cc:1683:8: error: redefinition of 'struct y_combinator<first>'
 1683 | struct y_combinator {
      |        ^~~~~~~~~~~~
a.cc:411:8: note: previous definition of 'struct y_combinat