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 <iomanip>
#include <cmath>

using namespace std;

template <typename T>
struct Vec2;

template <typename T>
T SqrMagnitude(const Vec2<T>& v);

template <typename T>
T Magnitude(const Vec2<T>& v);

template <typename T>
T Dot(const Vec2<T>& v1, const Vec2<T>& v2);


template <typename T>
struct Vec2 {
    T x, y;
    Vec2() = default;
    Vec2(T in_x, T in_y)
        : x {in_x}, y {in_y} {};
    Vec2(const Vec2&) = default;
    Vec2(Vec2&&) = default;

    Vec2 normalized() const{
        T mag = Magnitude(*this);
        return {x / mag, y / mag};
    }

    Vec2 normalize() {
        T mag = Magnitude(*this);
        return {x /= mag, y /= mag};
    }

    Vec2 operator-() {
        return {-x, -y};
    }

    Vec2 operator+(const Vec2& rhs) const{
        return {x + rhs.x, y + rhs.y};
    }

    Vec2 operator-(const Vec2& rhs) const{
        return {x - rhs.x, y - rhs.y};
    }

    Vec2 operator*(T rhs) const{
        return {x * rhs, y * rhs};
    }

    Vec2 operator/(T rhs) const{
        return {x / rhs, y / rhs};
    }

    Vec2& operator+=(const Vec2& rhs) {
        x += rhs.x;
        y += rhs.y;
        return *this;
    }

    Vec2& operator-=(const Vec2& rhs) {
        x -= rhs.x;
        y -= rhs.y;
        return *this;
    }

    Vec2& operator*=(T rhs) {
        x *= rhs;
        y *= rhs;
        return *this;
    }

    Vec2& operator/=(T rhs) {
        x /= rhs;
        y /= rhs;
        return *this;
    }
};

template <typename T>
inline Vec2<T> operator*(T s, const Vec2<T>& v) {
    return {s * v.x, s * v.y};
}


template <typename T>
inline T SqrMagnitude(const Vec2<T>& v) {
    return Dot(v, v);
}

template <typename T>
inline T Magnitude(const Vec2<T>& v) {
    return sqrt(SqrMagnitude(v));
}

template <typename T>
inline T Dot(const Vec2<T>& v1, const Vec2<T>& v2) {
    return v1.x * v2.x + v1.y * v2.y;
}

template <typename T>
inline T Cross(const Vec2<T>& v1, const Vec2<T>& v2) {
    return v1.x * v2.y - v1.y *v2.x;
}

int main() {
    Vec2<double> p0, p1, p2, q;


    while(cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> q.x >> q.y) {
        auto v_qp0 = p0 - q;
        auto v_qp1 = p1 - q;
        auto v_qp2 = p2 - q;

        double c0 = Cross(v_qp0, v_qp1);
        double c1 = Cross(v_qp1, v_qp2);
        double c2 = Cross(v_qp2, v_qp0);

        cout << ((c0 > 0 && c1 > 0 && c2 > 0) || (c0 < 0 && c1 < 0 && c2 < 0) ? "YES" : "NO") << endl;
    }
        
        
    

    return 0;
}

C++: #include <stdio.h>

bool is_up(const float x1, const float y1,
			const float x2, const float y2,
			const float xp, const float yp){
	float y = 0.0;
	y = (y2 - y1)/(x2 - x1)*(xp - x1) + y1;
	return yp > y;
}

bool is_ok(float *x, float *y, float xp, float yp){
	for(int i=0; i<3; ++i){
		if(is_up(x[i], y[i], x[(i+1)%3], y[(i+1)%3], x[(i+2)%3], y[(i+2)%3])
			!= is_up(x[i], y[i], x[(i+1)%3], y[(i+1)%3], xp, yp)){
				return false;
		}
	}
	return true;
}

int main(void){
	float x[3], y[3];
	float xp=0.0, yp=0.0;
	bool ok = false;

	for(int i=0; i<3; ++i){
		x[i] = y[i] = 0.0;
	}

	while(scanf("%f %f %f %f %f %f %f %f",
		x, y, x+1, y+1, x+2, y+2, &xp, &yp) != EOF){
			puts(is_ok(x, y, xp, yp) ? "YES": "NO");
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <complex>
#define rep(i,n) for(int i=0; i<(n); i++)
#define EPS 1e-5
using namespace std;

typedef complex<double> cd;

double s(cd a, cd b){
  return abs( a.real()*b.imag()-a.imag()*b.real() );
}

int main(){
  cd a[4];
  double x1, y1, x2, y2, x3, y3, xp, yp;

  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)!=EOF){
    a[0] = cd(x1,y1);
    a[1] = cd(x2,y2);
    a[2] = cd(x3,y3);
    a[3] = cd(xp,yp);
    if(abs(s(a[0]-a[3], a[1]-a[3])
           + s(a[1]-a[3], a[2]-a[3])
           + s(a[2]-a[3], a[0]-a[3])
           - s(a[1]-a[0], a[2]-a[0])) < EPS )
      printf("IN\n");
    else
      printf("OUT\n");
  }
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

const double ERR = 1e-6;

typedef pair<double, double> XY;

double getlen(XY p, XY q) {
    return sqrt((p.first-q.first)*(p.first-q.first) + (p.second-q.second)*(p.second-q.second));
}

double area(XY p, XY q, XY r) {
    double pq, pr, qr;
    pq = getlen(p,q); pr = getlen(p,r); qr = getlen(q,r);
    return 0.5 * pq * pr * sin(acos((pq*pq + pr*pr - qr*qr)/2/pq/pr));
}

int main() {
    double x1,y1,x2,y2,x3,y3,xx,yy;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xx>>yy) {
        XY xy1, xy2, xy3, xyp;
        xy1 = make_pair(x1,y1);
        xy2 = make_pair(x2,y2);
        xy3 = make_pair(x3,y3);
        xyp = make_pair(xx,yy);
        if (abs(area(xy1,xy2,xy3) - (area(xy1,xy2,xyp) + area(xy2,xy3,xyp) + area(xy3,xy1,xyp))) < ERR) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>

struct vector3 {
    double x, y, z;
    vector3(double x, double y, double z): x(x), y(y), z(z) {}
};

vector3 cross_product(const vector3 &v1, const vector3 &v2)
{
    return vector3(v1.y*v2.z-v1.z*v2.y,v1.z*v2.x-v1.x*v2.z,v1.x*v2.y-v1.y*v2.x);
}

int main()
{
    while (true) {
        double x1, y1, x2, y2, x3, y3, xp, yp;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
        if (std::cin.eof()) break;

        vector3 p1(xp - x1, yp - y1, 0.0), p2(xp - x2, yp - y2, 0.0), p3(xp - x3, yp - y3, 0.0);
        vector3 cp1 = cross_product(p1, p2), cp2 = cross_product(p2, p3), cp3 = cross_product(p3, p1);
        if (cp1.z < 0.0 && cp2.z < 0.0 && cp3.z < 0.0) std::cout << "YES" << std::endl;
        else if (cp1.z > 0.0 && cp2.z > 0.0 && cp3.z > 0.0) std::cout << "YES" << std::endl;
        else std::cout << "NO" << std::endl;
    }
}

C++: #include<iostream>
#include<utility>
using namespace std;

int judge(pair<double, double> p1, pair<double, double> p2){
	double S = p1.first*p2.second - p2.first*p1.second;
	if (0 < S) return 1;
	if (0 > S) return -1;
	if (0 == S) return 0;
}

int main(){
	pair<double, double> A, B, C, P;

	while (cin >> A.first >> A.second >> B.first >> B.second >> C.first >> C.second >> P.first >> P.second){
		pair<double, double> AB, BC, CA, AP, BP, CP;
		AB = { B.first - A.first, B.second - A.second };
		BC = { C.first - B.first, C.second - B.second };
		CA = { A.first - C.first, A.second - C.second };
		AP = { P.first - A.first, P.second - A.second };
		BP = { P.first - B.first, P.second - B.second };
		CP = { P.first - C.first, P.second - C.second };
		
		if (judge(AP, AB) == judge(BP, BC) && judge(BP, BC) == judge(CP, CA) && judge(CP, CA) == judge(AP, AB)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}