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 <bits/stdc++.h>
#include <vector>
using namespace std;
double x_1, x_2, x_3, y_1, y_2, y_3, x_p, y_p, c;
int n,hasil;
int main(){
	while(cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_p >> y_p){
		hasil = 0;
		if((x_3*y_2)-(x_3*y_1)-(x_1*y_2) > (x_2*y_3)-(x_1*y_3)-(x_2*y_1)){
			if((x_p*y_2)-(x_p*y_1)-(x_1*y_2) > (x_2*y_p)-(x_1*y_p)-(x_2*y_1)){
				hasil++;
			}
		}
		else if((x_3*y_2)-(x_3*y_1)-(x_1*y_2) < (x_2*y_3)-(x_1*y_3)-(x_2*y_1)){
			if((x_p*y_2)-(x_p*y_1)-(x_1*y_2) < (x_2*y_p)-(x_1*y_p)-(x_2*y_1)){
				hasil++;
			}
		}
		if((x_2*y_3)-(x_2*y_1)-(x_1*y_3) > (x_3*y_2)-(x_1*y_2)-(x_3*y_1)){
			if((x_p*y_3)-(x_p*y_1)-(x_1*y_3) > (x_3*y_p)-(x_1*y_p)-(x_3*y_1)){
				hasil++;
			}
		}
		else if((x_2*y_3)-(x_2*y_1)-(x_1*y_3) < (x_3*y_2)-(x_1*y_2)-(x_3*y_1)){
			if((x_p*y_3)-(x_p*y_1)-(x_1*y_3) < (x_3*y_p)-(x_1*y_p)-(x_3*y_1)){
				hasil++;
			}
		}
		if((x_1*y_3)-(x_1*y_2)-(x_2*y_3) > (x_3*y_1)-(x_2*y_1)-(x_3*y_2)){
			if((x_p*y_3)-(x_p*y_2)-(x_2*y_3) > (x_3*y_p)-(x_2*y_p)-(x_3*y_2)){
				hasil++;
			}
		}
		if((x_1*y_3)-(x_1*y_2)-(x_2*y_3) < (x_3*y_1)-(x_2*y_1)-(x_3*y_2)){
			if((x_p*y_3)-(x_p*y_2)-(x_2*y_3) < (x_3*y_p)-(x_2*y_p)-(x_3*y_2)){
				hasil++;
			}
		}
		if(hasil == 3)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

double v_pro(double a[], double b[])
{
    return a[0] * b[1] - a[1] * b[0];
}

int main()
{
    double v[3][2], p[2];
    while (cin >> v[0][0] >> v[0][1] >> v[1][0] >> v[1][1] >> v[2][0] >> v[2][1] >> p[0] >> p[1])
    {
        double w[3][2];

        rep(i, 3)
        {
            rep(j, 2)
            {
                w[i][j] = p[j] - v[i][j];
            }
        }

        if ((v_pro(w[0], w[1]) > 0 && v_pro(w[1], w[2]) > 0 && v_pro(w[2], w[0]) > 0) || (v_pro(w[0], w[1]) < 0 && v_pro(w[1], w[2]) < 0 && v_pro(w[2], w[0]) < 0))
        {
            OP("YES")
        }
        else
        {
            OP("NO")
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
double x[4], y[4];
double f(int a, int b, int c)
{
	return ((y[c]-y[a])*(x[b]-x[a])-(y[b]-y[a])*(x[c]-x[a]));
}
int main()
{
	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3])
	{
		if (f(0, 1, 2)*f(0, 1, 3) > 0 && f(1, 2, 0)*f(1, 2, 3) > 0 && f(2, 0, 1)*f(2, 0, 3) > 0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>

using namespace std;

typedef long long int lli;

int main()
{
	double x1, x2, x3, xp;
	double y1, y2, y3, yp;
	double abc[3];
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		abc[0] = (x3 - x2)*(yp - y2) - (y3 - y2)*(xp - x2);
		abc[1] = (x1 - x3)*(yp - y3) - (y1 - y3)*(xp - x3);
		abc[2] = (x2 - x1)*(yp - y1) - (y2 - y1)*(xp - x1);
		if ((abc[0] > 0 && abc[1] > 0 && abc[2] > 0) || (abc[0] < 0 && abc[1] < 0 && abc[2] < 0)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

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

using namespace std;
#define EPS (1e-10)
#define ABS(x) ((x)<0?-(x):(x))
struct L{
    L(double xa, double ya, double xb, double yb){
	x1 = xa;
	y1 = ya;
	x2 = xb;
	y2 = yb;
	if(xa-xb == 0){
	    a = 1;
	    b = 0;
	    c = -xa;
	}
	else {
	    a = (ya-yb);
	    b = (xb-xa);
	    c = -(a*xa + b*ya);
	}
    };
    double f(double x, double y){
	return a*x + b*y + c;
    }
    double a, b, c, x1, x2, y1, y2;//0 = ax + by + c [x1, x2]
};

bool cross(L a, L b){
    return (a.f(b.x1, b.y1) * a.f(b.x2, b.y2) < 0 && 
	    b.f(a.x1, a.y1) * b.f(a.x2, a.y2) < 0);
}

double x1, y1, x2, y2, x3, y3, xp, yp;

int main(){
    while(cin){
	cin >> x1 >> y1 >> x2 >> y2>> x3 >> y3 >> xp >> yp;
	L a = L(x1, y1, x2, y2);
	L b = L(x1, y1, x3, y3);
	L c = L(x2, y2, x3, y3);
	L p = L(xp, yp, 102.131921, 103.141592);
	int res = 0;
	if(cross(a,p))res++;
	if(cross(b,p))res++;
	if(cross(c,p))res++;
	if(res % 2 == 0)cout << "NO" <<  endl;
	else cout << "YES"<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#define mul(s, t) ((s-t)*(s-t))

using namespace std;

int main()
{
	double x[3], y[3], u[2], s, t, v;
	
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> s >> t){
		bool f = true;
		for(int i = 0; i < 3; i++){
			int p = 0;
			for(int j = 0; j < 3; j++){
				if(i != j){
					u[p++] = sqrt(mul(x[i], x[j])+mul(y[i], y[j]));
				}
			}
			v = sqrt(mul(x[i], s)+mul(y[i], t));
			
			if(u[0] <= v && u[1] <= v){
				f = false;
				break;
			}
		}
		cout << ((f)? "YES" : "NO") << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;
#define EPS 1.0e-12
#define F(I,J,N) for(int I=J;I<N;I++)

class Line{
public:
	P p[2];
	P v;
	Line(){}
	Line(P p0,P p1){
		p[0]=p0;
		p[1]=p1;
		v=p1-p0;
	}
	//線分の長さ
	double length(){return abs(v);}
	//平行
	bool Parallel(Line l){
		return (cross(v,l.v)==0);
	}
	//線分上
	bool OnLine(P a){
		return (abs(p[0]-a)+abs(a-p[1])<length()+EPS);
	}
	double cross(Line l){
		return cross(v,l.p[0]-p[0]) * cross(v,l.p[1]-p[0]);
	}
	double cross(P a,P b){
		return (real(a)*imag(b)-imag(a)*real(b));
	}
	bool Intersection(Line l){
		if(Parallel(l)){
			return (OnLine(l.p[0])||OnLine(l.p[1])||l.OnLine(p[0])||l.OnLine(p[1]));
		}
		return ((cross(l)<EPS) && (l.cross(*this))<EPS);
	}
};

class Pi{
private:
	P *p;
	Line *l;
	int n;
public:
	Pi(){}
	Pi(int n){
		this->n=n;
		p=new P[n+1];
		l=new Line[n];
	}
	~Pi(){
		delete []p;
		delete []l;
	}
	void set(int i,P a){
		if(i==0){
			p[0]=a;
			p[n]=a;
		}
		else p[i]=a;
	}
	void set(){
		F(i,0,n) l[i]=Line(p[i],p[i+1]);
	}
	bool isin(P a){
		F(i,0,n) if(l[i].OnLine(a)) return true;
		int cnt=0;
		Line buf(a,P(-101,-101));
		F(i,0,n) if(l[i].Intersection(buf)) cnt++;
		if(cnt&1) return true;
		return false;
	}
};

int main(){
	double a,b,c,d,e,f,g,h;
	P p[3],q;
	Pi *in;
	while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
		p[0]=P(a,b);
		p[1]=P(c,d);
		p[2]=P(e,f);
		q=P(g,h);
		in=new Pi(3);
		F(i,0,3) in->set(i,p[i]);
		in->set();
		if(in->isin(q)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		delete in;
	}
	return 0;
}