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;

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent = false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);
// lambda: [](T1 x)->T2{return y;}
// simple lambda: [](T x){return x;}

#define X real()
#define Y imag()

typedef complex<double> P;

// a <= b
bool le(double a, double b) {
    return a < b + EPS;
}

// a >= b
bool ge(double a, double b) {
    return a + EPS > b;
}

// a = b
bool eq(double a, double b) {
    return abs(a - b) < EPS;
}

// ?????¢
double distPP(P a, P b) {
    double x = a.X - b.X;
    double y = a.Y - b.Y;
    return sqrt(x * x + y * y);
}

// ??????????????¬???
double heron(double a, double b, double c) {
    double s = (a + b + c) / 2.;
    return sqrt(s * (s - a) * (s - b) * (s - c));
}

double heron(P a, P b, P c) {
    return heron(distPP(a, b), distPP(b, c), distPP(c, a));
}

// ????§???¢??¨??????????????????
bool inTriangle(P a, P b, P c, P p) {
    double s1 = heron(a, b, c);
    double s2 = heron(p, b, c) + heron(a, p, c) + heron(a, b, p);
    return eq(s1, s2);
}

int main(void) {
    string s;
    while (getline(cin, s)) {
        double x1, y1, x2, y2, x3, y3, xp, yp;
        sscanf(s.c_str(), "%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp);
        P a(x1, y1);
        P b(x2, y2);
        P c(x3, y3);
        P p(xp, yp);
        cout << (inTriangle(a, b, c, p) ? "YES" : "NO") << endl;
    }


    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

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

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

signed main(){
    while(1){
        if(cin.eof()) break;        
        rep(i, 0, 3) cin >> x[i] >> y[i];
        cin >> xp >> yp;
        rep(i, 0, 3){
            x[i] -= xp;
            y[i] -= yp;
        }
        bool f = true;
        rep(i, 0, 3){
            if(cross(i, (i + 1) % 3) < 0) f = false; 
        }
        cout << (f ? "YES" : "NO") << endl;
    }
}

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

using namespace std;

bool cross(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double ab=(y1-y2)/(x1-x2)*(x3-x1)+y1, cd=(y1-y2)/(x1-x2)*(x4-x1)+y1;
	if ((ab>y3&&cd>y4)||(ab<y3&&cd<y4)) return false;
	return true;
}

int main() {
	double x1, x2, x3, y1, y2, y3, xp ,yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double xm = (x1+x2+x3)/3, ym = (y1+y2+y3)/3;
		if (cross(x1,y1,x2,y2,xm,ym,xp,yp)||cross(x2,y2,x3,y3,xm,ym,xp,yp)||cross(x3,y3,x1,y1,xm,ym,xp,yp)) {
			cout << "NO" << endl;
		} else {
			cout << "YES" << endl;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
using namespace std;
typedef long long lint;

#define EPS 1e-9

struct point { double x, y; };

int main()
{
    point p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);

        double p_side[3], side[3];
        for (int i = 0; i < 3; i++){
            p_side[i] = sqrt((p[i].x - p[3].x) * (p[i].x - p[3].x) + (p[i].y - p[3].y) * (p[i].y - p[3].y));
            side[i] = sqrt((p[(i + 1) % 3].x - p[i].x) * (p[(i + 1) % 3].x - p[i].x) + (p[(i + 1) % 3].y - p[i].y) * (p[(i + 1) % 3].y - p[i].y));
        }

        double p_s[3], s;
        for (int i = 0; i < 3; i++){
            double tmp = (p_side[i] + p_side[(i + 1) % 3] + side[i]) / 2;
            p_s[i] = sqrt(tmp * (tmp - p_side[i]) * (tmp - p_side[(i + 1) % 3]) * (tmp - side[i]));
        }
        double tmp = (side[0] + side[1] + side[2]) / 2;
        s = sqrt(tmp * (tmp - side[0]) * (tmp - side[1]) * (tmp - side[2]));

        //printf("%.20f\n", p_s[0] + p_s[1] + p_s[2] - s);
        if (p_s[0] + p_s[1] + p_s[2] - s <= EPS) puts("YES");
        else puts("NO");
    }

    return 0;
}