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


int main(){
    // ax + y + c = 0
    float x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], xp[100], yp[100], a1, c1, a2, c2, a3, c3;
    int i = 0,n = 0;
    bool f = false;
    while(scanf("%f %f %f %f %f %f %f %f",&x1[i], &y1[i], &x2[i], &y2[i], &x3[i], &y3[i], &xp[i],&yp[i]) != EOF){
        n++;
        i++;
    }
    for(i = 0; i < n; i++){
        f = false;
       if(x1[i] == x2[i]){
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if(          ( fabs( x1[i] - x3[i] ) > fabs( x1[i] - xp[i] ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

        }else if(x2[i] == x3[i]){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if(        ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && (   fabs( x2[i] - x1[i] ) > fabs( x2[i] - xp[i] ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

       }else if(x3[i] == x1[i]){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];

            if(        ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && (   fabs( x3[i] - x2[i] ) > fabs( x3[i] - xp[i] ) ) )
                f = true;

       }else{
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( (        fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;
       }
       if(f){
           printf("YES\n");
       }else{
           printf("NO\n");
       }
    }

    return 0;
}

C++: #include<cstdio>
#include<cmath>

double getd(double x, double y){
	double r = atan2(y, x) * 180 / M_PI;
	return r;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp,d1,d2,d3;
	double h;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) + 1){
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;
		y1 -= yp;
		y2 -= yp;
		y3 -= yp;
		d1 = getd(x1,y1);
		d2 = getd(x2,y2);
		d3 = getd(x3,y3);
		if(d1 > d2){
			h = d1;
			d1 = d2;
			d2 = h;
		}
		if(d2 > d3){
			h = d2;
			d2 = d3;
			d3 = h;
			if(d1 > d2){
				h = d1;
				d1 = d2;
				d2 = h;
			}
		}
		d2 -= d1;
		d3 -= d1;
		if(180 > d2){
			if(180 < d3 && d3 < d2 + 180){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

double dx1, dy1, dx2, dy2, dx3, dy3, px, py;

int main(){
	while (cin >> dx1 >> dy1 >> dx2 >> dy2 >> dx3 >> dy3 >> px >> py){
		double s = fabs((dx2 - dx1)*(dy3 - dy1) - (dx3 - dx1)*(dy2 - dy1)) / 2.0;
		double s1 = fabs((dx1 - px)*(dy2 - py) - (dx2 - px)*(dy1 - py)) / 2.0;
		double s2 = fabs((dx2 - px)*(dy3 - py) - (dx3 - px)*(dy2 - py)) / 2.0;
		double s3 = fabs((dx3 - px)*(dy1 - py) - (dx1 - px)*(dy3 - py)) / 2.0;

		if (fabs(s - (s1 + s2 + s3)) <= EPS){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

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+EPS && 
	    b.f(a.x1, a.y1) * b.f(a.x2, a.y2) < 0+EPS);
}

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, 1000, 2000.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;
}