Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

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 xab = x2 - x1;
        double xbp = xp - x2;
        double xbc = x3 - x2;
        double xcp = xp - x3;
        double xca = x1 - x3;
        double xap = xp - x1;

        double yab = y2 - y1;
        double ybp = yp - y2;
        double ybc = y3 - y2;
        double ycp = yp - y3;
        double yca = y1 - y3;
        double yap = yp - y1;

        double za = xab * ybp - yab * xbp;
        double zb = xbc * ycp - ybc * xcp;
        double zc = xca * yap - yca * xap;

        if ((za < 0 && zb < 0 && zc < 0) || (za > 0 && zb > 0 && zc > 0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }

        if (cin.eof()) break;
    }

    return 0;
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;

int main() {
	double x1, x2, x3, y1, y2, y3, xp, yp;
	double calc1, calc2, calc3;

	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
		calc1 = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
		calc2 = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
		calc3 = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);

		if ((calc1 > 0 && calc2 > 0 && calc3 > 0) || (calc1 < 0 && calc2 < 0 && calc3 < 0)) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define EPS (1e-10)
#define rep(i,n) for(int i=0;i<n;i++)
typedef complex<double> P;

double x,y,xx,yy,xxx,yyy,xxxx,yyyy;

double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

int main(){
	while(cin>>x>>y>>xx>>yy>>xxx>>yyy>>xxxx>>yyyy){
		P a=P(x,y),b=P(xx,yy),c=P(xxx,yyy),p=P(xxxx,yyyy);
		int C=cross(p-a,b-a)>0&&cross(p-b,c-b)>0&&cross(p-c,a-c)>0||cross(p-a,b-a)<0&&cross(p-b,c-b)<0&&cross(p-c,a-c)<0;
		cout<<(C?"YES":"NO")<<endl;
	}
}

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-8;
// 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<stdio.h>
int main(){
    double x1,x2,x3,x4,y1,y2,y3,y4;
    while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)){
        bool ok1=true;
        bool ok2=true;
        if((x2-x1)*(y4-y1)-(x4-x1)*(y2-y1)<0)ok1=false;
        else ok2=false;
        if((x3-x2)*(y4-y2)-(x4-x2)*(y3-y2)<0)ok1=false;
        else ok2=false;
        if((x1-x3)*(y4-y3)-(x4-x3)*(y1-y3)<0)ok1=false;
        else ok2=false;
        printf((ok1||ok2)?"YES\n":"NO\n");
    }
}