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>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

const double EPS = 1e-8;

typedef complex<double> Point;
typedef vector<Point> Polygon;

inline int sign(double x){
    return (x > EPS ? 1 : x < -EPS ? -1 : 0);
}

inline Point curr(const Polygon& a, int x){
    return a[x];
}
inline Point next(const Polygon& a, int x){
    return a[(x + 1) % a.size()];
}

double dot(Point a, Point b){
    return real(conj(a) * b);
}

double cross(Point a, Point b){
    return imag(conj(a) * b);
}

enum { OUT, ON, IN };
int contains(const Polygon& P, const Point& p){
    bool in = false;
    for(int i = 0; i < P.size(); i++){
        Point a = curr(P, i) - p;
        Point b = next(P, i) - p;
        if(a.imag() > b.imag()) swap(a, b);
        if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0){
            in = !in;
        }
        if(sign(cross(a, b)) == 0 && sign(dot(a, b)) <= 0) return ON;
    }
    return in ? IN : OUT;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        Polygon t;
        t.push_back(Point(x1, y1));
        t.push_back(Point(x2, y2));
        t.push_back(Point(x3, y3));
        if(contains(t, Point(xp, yp)) == IN){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: //#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

struct Vector2D{
	double x, y;
};

Vector2D sub_vector(const Vector2D& a, Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x;
	ret.y = a.y - b.y;
	return ret;
}

//?????´?????? true ?????´?????? false
bool hit(Vector2D A, Vector2D B, Vector2D C, Vector2D P) {
	Vector2D AB = sub_vector(B, A);
  Vector2D BP = sub_vector(P, B);

  Vector2D BC = sub_vector(C, B);
  Vector2D CP = sub_vector(P, C);

  Vector2D CA = sub_vector(A, C);
  Vector2D AP = sub_vector(P, A);

  double c1 = AB.x * BP.y - AB.y * BP.x;
  double c2 = BC.x * CP.y - BC.y * CP.x;
  double c3 = CA.x * AP.y - CA.y * AP.x;

  if( ( c1 > 0 && c2 > 0 && c3 > 0 ) || ( c1 < 0 && c2 < 0 && c3 < 0 ) ) {
    return false;
  }

  return true;
}

signed main(void)
{
	double x1,x2,x3,xp,y1,y2,y3,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
		Vector2D a = {x1, y1}, b = {x2, y2}, c = {x3, y3}, p = {xp, yp};
		if(hit(a, b, c, p)) cout << "NO" << endl;
		else cout << "YES" << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	double x[3], y[3];
	double xp, yp;
	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf"
		, &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF)
	{
		double cross[3];
		for (int i = 0; i < 3; ++i)
		{
			double ax = xp - x[i%3];
			double ay = yp - y[i%3];
			double bx = x[i%3+1] - x[i%3];
			double by = y[i%3+1] - y[i%3];
			cross[i] = ax * by - bx * ay;
		}
		if (cross[0] > 0 && cross[1] > 0 && cross[2] > 0
		|| cross[0] < 0 && cross[1] < 0 && cross[2] < 0)
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

C++: #include <stdio.h>
#define line(x1,y1,x2,y2,x3,y3,c) c == '>' ? y3 > (1 / (x1 - x2)) * ((y1 - y2) * x3 + x1 * y2 - x2 * y1):(c == '<' ? y3 < (1 / (x1 - x2)) * ((y1 - y2) * x3 + x1 * y2 - x2 * y1) : 0)

int main(void){
	double x[3], y[3], xp, yp;
	int i;
	for(i = 0;i < 3;i++)
		scanf("%lf%lf",&x[i],&y[i]);
	scanf("%lf%lf",&xp,&yp);
	if(x[0] < x[1]){
		int tmpx = x[0];
		int tmpy = y[0];
		x[0] = x[1];
		y[0] = y[1];
		x[1] = tmpx;
		y[1] = tmpy;
	}
	if(line(x[0],y[0],x[1],y[1],x[2],y[2],'>') && line(x[0],y[0],x[1],y[1],xp,yp,'>')){
		if(x[2] > x[0]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'>') && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[0]){
			if(x[2] > xp && y[2] > yp && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] > x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'<') && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[1]){
			if(x[2] > xp && y[2] > yp && line(x[0],y[0],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] < x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'<') && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
	else if(line(x[0],y[0],x[1],y[1],x[2],y[2],'<') && line(x[0],y[0],x[1],y[1],xp,yp,'<')){
		if(x[2] > x[0]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'<') && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[0]){
			if(x[2] > xp && y[2] < yp && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] > x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'>') && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[1]){
			if(x[2] > xp && y[2] < yp && line(x[0],y[0],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] < x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'>') && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
	else
		printf("NO\n");
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <complex>

using namespace std;

typedef	complex<double> P;

double dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}

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

	double xp,yp,x1,x2,x3,y1,y2,y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		P p1(x1,y1);
		P p2(x2,y2);
		P p3(x3,y3);
		P p(xp,yp);

		double v1 = cross(p1,p2);
		double v2 = cross(p1,p3);
		double v3 = cross(p2,p3);

		if((v1>=0&&v2>=0&&v3>=0)||(v1<0&&v2<0&&v3<0))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;

	}

	return 0;
}