Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>
#include <vector>

using namespace std;

vector<double> simlu_eq(int N, vector<vector<double>> M){
    int i, j, k, n;
    double pivot, mul;
    for (i = 0; i < N; ++i){
        pivot = M[i][i];
        for (j = 0; j < N + 1; ++j){
            M[i][j] = (1 / pivot) * M[i][j];
        }

        for (auto x:M){for(auto y:x){ cout << y << " ";}cout << endl;}

        for (k = i + 1; k < N; ++k){
            mul = M[k][i];
            for (n = i; n < N + 1; ++n){
                M[k][n] = M[k][n] - mul * M[i][n];
            }
        }
    }

     for (i = N -1; i > 0; --i){
         for (k = i -1; k >= 0; --k){
             mul = M[k][i];
             for (n = i; n < N + 1; ++n){
                 M[k][n] = M[k][n] - mul * M[i][n];
             }
         }
     }

   vector<double> res;
    for (i = 0; i < N; ++i){
        res.push_back(M[i][N]);
    }

    cout << res[0] << " " << res[1] << " " << res[2] << endl;

    return res;
}


int main(){
    vector<double> a(2), b(2), c(2), p(2), ab(2), ac(2), ap(2);
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &a[0], &a[1], &b[0], &b[1], &c[0], &c[1], &p[0], &p[1])+1){

        ab[0] = b[0] - a[0];
        ab[1] = b[1] - a[1];
        ac[0] = c[0] - a[0];
        ac[1] = c[1] - a[1];
        ap[0] = p[0] - a[0];
        ap[1] = p[1] - a[1];


    vector<vector<double>>M;
    M = vector<vector<double>>(2, vector<double>(3));
    M[0][0] = ab[0];  M[0][1] = ac[0];  M[0][2] = ap[0];
    M[1][0] = ab[1];  M[1][1] = ac[1];  M[1][2] = ap[1];
    vector<double> w = simlu_eq(2, M);

    if (w[0] > 0 && w[1] > 0 && w[0] + w[1] < 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
const double EPS = 1e-10;

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

struct Point{
	double x, y;
	Point(){}
	Point(double x,double y) :x(x), y(y){}
	Point operator+(Point p) {return Point(x+p.x,y+p.y);}
	Point operator-(Point p) {return Point(x-p.x,y-p.y);}
	Point operator*(double k){return Point(x*k,y*k);}
	Point operator/(double k){return Point(x/k,y/k);}
	double norm(){return x*x+y*y;}
	double abs(){return sqrt(norm());}

	bool operator < (const Point &p) const{
		return x!=p.x?x<p.x:y<p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a,Vector b){
	return a.x * b.y - a.y * b.x;
}

int contains(Polygon g,Point p){
	int n = g.size();
	bool x = false;
	for(int i = 0; i < n; i++){
		Point a = g[i] - p, b = g[(i + 1) % n] - p;
		if(fabs(cross(a, b)) < EPS && dot(a, b) < EPS) return 1;
		if(a.y > b.y) swap(a, b);
		if(a.y < EPS && EPS < b.y && cross(a,b) > EPS ) x = !x;
	}

	return (x ? 2 : 0);
}

int main() {
	Point a, r;
	Polygon v;

	while (cin >> a.x >> a.y) {
		v.clear();
		v.pb(a);
		rep(i, 2) { 
			cin >> a.x >> a.y;
			v.pb(a);
		}
		cin >> r.x >> r.y;

		cout << (contains(v, r) == 2 ? "YES" : "NO") << endl;
	}
}

C++: #include <iostream>
#include <complex>

double x[3], y[3], xp, yp;

#define EPS 0.000001
typedef std::complex<double> P;

double cross(P a, P b) {
    return (a.real() * b.imag() - a.imag() * b.real());
}

bool is_intersected(P a1, P a2, P b1, P b2) 
{
    return ( cross(a2 - a1, b1 - a1) * cross(a2 - a1, b2 - a1) < EPS ) &&
           ( cross(b2 - b1, a1 - b1) * cross(b2 - b1, a2 - b1) < EPS);
}

void solve(void)
{
    P left(-101, yp);
    P right(101, yp);
    bool in_triangle = false;
    if ( ( is_intersected( P(x[0], y[0]), P(x[1], y[1]), left, P(xp, yp) ) ||
           is_intersected( P(x[1], y[1]), P(x[2], y[2]), left, P(xp, yp) ) ||
           is_intersected( P(x[2], y[2]), P(x[0], y[0]), left, P(xp, yp) ) ) &&
         ( is_intersected( P(x[0], y[0]), P(x[1], y[1]), right, P(xp, yp) ) ||
           is_intersected( P(x[1], y[1]), P(x[2], y[2]), right, P(xp, yp) ) ||
           is_intersected( P(x[2], y[2]), P(x[0], y[0]), right, P(xp, yp) ) ) ) {
        in_triangle = true;
    }

   if (in_triangle) {
        std::cout << "YES\n";
    } else {
        std::cout << "NO\n";
    }
}

int main(void)
{
    while (std::cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp) {
        solve();
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(){

	int i, m;
	cin >> m;

	for(i=0; i<m; i++){

	int a[3];

	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);

	if(a[2]*a[2] == a[0]*a[0] + a[1]*a[1]){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
}
}

C++: #include <bits/stdc++.h>
using namespace std;

double x[4], y[4];

double l(int a, int b)
{
	return sqrt((y[a] - y[b]) * (y[a] - y[b]) + (x[a] - x[b]) * (x[a] - x[b]));
}

double T(int a, int b, int c)
{
	double A = l(a, b);
	double B = l(b, c);
	double C = l(c, a);
	double s = (A + B + C) / 2;
	return sqrt(s * (s - A) * (s - B) * (s - C));
}

int main()
{
	while (true){
		for (int i = 0; i < 4; i++){
			scanf("%lf %lf", &x[i], &y[i]);
		}
		
		double S = T(0, 1, 3) + T(1, 2, 3) + T(2, 0, 3) - T(0, 1, 2);
		
		if (S == 0){
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	
	return 0;
}

C++: #include<iostream>

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double abx, aby, bpx, bpy, bcx, bcy, cpx, cpy, cax, cay, apx, apy, z1, z2, z3;
		abx = x2 - x1; aby = y2 - y1;
		bpx = xp - x2; bpy = yp - y2;
		bcx = x3 - x2; bcy = y3 - y2;
		cpx = xp - x3; cpy = yp - y3;
		cax = x1 - x3; cay = y1 - y3;
		apx = xp - x1; apy = yp - y1;
		z1 = abx*bpy - aby*bpx;
		z2 = bcx*cpy - bcy*cpx;
		z3 = cax*apy - cay*apx;
		if ((z1 > 0 && z2 > 0 && z3 > 0) || (z1 < 0 && z2 < 0 && z3 < 0)) {
			std::cout << "YES" << std::endl;
		}
		else {
			std::cout << "NO" << std::endl;
		}
	}
	return 0;
}