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>
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.pb(a);
		rep(i, 2) { 
			cin >> a.x >> a.y;
			v.pb(a);
		}
		cin >> r.x >> r.y;

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

C++: #include <iostream>
using namespace std;
int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){

        /*double max_x = x1;
        if(x2 > max_x) max_x = x2;
        if(x3 > max_x) max_x = x3;

        double max_y = y1;
        if(y2 > max_y) max_y = y2;
        if(y3 > max_y) max_y = y3;

        double min_x = x1;
        if(x2 < min_x) min_x = x2;
        if(x3 < min_x) min_x = x3;

        double min_y = y1;
        if(y2 < min_y) min_y = y2;
        if(y3 < min_y) min_y = y3;

        if(xp >= min_x && xp <= max_x && yp >= min_y && yp <= max_y)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;*/
        double a1, b1, a2, b2, A, B;
        a1 = x2 - x1;
        a2 = y2 - y1;
        b1 = x3 - x1;
        b2 = y3 - y1;
        xp = xp - x1;
        yp = yp - y1;
        A = (b1 * yp - b2 * xp) / (a2 * b1 - a1 * b2);
        B = (a2 * xp - a1 * yp) / (a2 * b1 - a1 * b2);
        if(A + B < 1 && A > 0 && B > 0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

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

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

double dot(P a, P b) {
    return (a.X * b.X + a.Y * b.Y);
}
double cross(P a, P b) {
    return (a.X * b.Y - a.Y * b.X);
}

int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if( cross(b,c) > EPS ) return +1;
    if( cross(b,c) < -EPS ) return -1;
    if( dot(b,c) < 0 ) return +2;
    if( norm(b) < norm(c) ) return -2;
    return 0;
}

int main() {
    P a,b,c,d;
    while(cin >> a.X >> a.Y >> b.X >> b.Y >> c.X >> c.Y >> d.X >> d.Y) {
        int x = ccw(a,b,d);
        int y = ccw(b,c,d);
        int z = ccw(c,a,d);
        // printf("%d %d %d\n", x, y, z);
        if(x == 1 && y == 1 && z == 1) cout << "YES" << endl;
        else if(x == -1 && y == -1 && z == -1) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

typedef struct{
	double x;
	double y;
	double z;
} vec3D;

double cross_z(vec3D v1,vec3D v2){
	return v1.x*v2.y-v1.y*v2.x;
}

int main(){
	double x1,x2,x3,y1,y2,y3,xp,yp;
	vec3D v1,v2,v3,vp1,vp2,vp3;

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v1.x=x1-x2;v2.x=x2-x3;v3.x=x3-x1;
		v2.y=y1-y2;v2.y=y2-y3;v3.y=y3-y1;
		v1.z=v2.z=v3.z=0;
		vp1.x=xp-x1;vp2.x=xp-x2;vp3.x=xp-x3;
		vp1.y=yp-y1;vp2.y=yp-y2;vp3.y=yp-y3;
		vp1.z=vp2.z=vp3.z=0;

		if(cross_z(v1,vp1)>0 && cross_z(v2,vp2)>0 && cross_z(v3,vp3)>0 || cross_z(v1,vp1)<=0 && cross_z(v2,vp2)<=0 && cross_z(v3,vp3)<=0){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

double dUnitVec(double v1, double v2) {
	return v2 - v1;
}
// ?????¨??§??????????????§????????????????????°???????????°???????????????
int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{
		// 1???????????????????±???????
		// 1-2
		double UnitX1 = x2 - x1;
		double UnitY1 = y2 - y1;

		double UnitX1P = xp - x1;
		double UnitY1P = yp - y1;


		// 2-3
		double UnitX2 = x3 - x2;
		double UnitY2 = y3 - y2;

		double UnitX2P = xp - x2;
		double UnitY2P = yp - y2;

		// 3-1
		double UnitX3 = x1 - x3;
		double UnitY3 = y1 - y3;

		double UnitX3P = xp - x3;
		double UnitY3P = yp - y3;

		// ??????
		double CP1 = UnitX1 * UnitY1P - UnitY1 * UnitX1P;
		double CP2 = UnitX2 * UnitY2P - UnitY2 * UnitX2P;
		double CP3 = UnitX3 * UnitY3P - UnitY3 * UnitX3P;

		// ?????????????????????????¬????????????´???????????????????¢??????????
		if ((CP1 > 0 && CP2 > 0 && CP3 > 0) || (CP1 < 0 && CP2 < 0 && CP3 < 0))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}