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 <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;
}