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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
using namespace std;

class Biv {
private:
  void set(Biv v) {
    x = v.x; y = v.y;
  }
public:
  string toString() {
    stringstream ss;
    ss << "(" << x << ", " << y << ")";
    return ss.str();
  }
  double x, y;
  Biv(double xx, double yy) {
    x = xx; y = yy;
  }
  Biv() {
    x = 0; y = 0;
  }
  void operator=(Biv v) { set(v); }
  Biv operator-() {
    return Biv(-x, -y);
  }
  Biv operator+(Biv v) {
    return Biv(x + v.x, y + v.y);
  }
  Biv operator-(Biv v) {
    return *this + (-v);
  }
  Biv multiple(double k) {
    return Biv(k * x, k * y);
  }
  Biv operator+=(Biv v) {
    set(*this + v); return *this;
  }
  Biv operator-=(Biv v) {
    set(*this - v); return *this;
  }
  friend ostream& operator<<(ostream& os, const Biv& v);
  double length() {
    return sqrt(x * x + y * y);
  }
  double arg() {
    if (x == 0) { return (y < 0) ? - M_PI / 2: M_PI / 2; }
    double val = atan(y / x);
    return (val > 0)? val:(M_PI + val);
  }
};

double dot(Biv a, Biv b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Biv a, Biv b) {
  return a.x * b.y - a.y * b.x;
}

class Ttm {
private:
  void set(Ttm m) {
    a = m.a; b = m.b; c = m.c; d = m.d;
  }
public:
  double a, b, c, d;
  string toString() {
    stringstream ss;
    ss << "[" << a << "," << b << "," << c << "," << d << "]";
    return ss.str();
  }
  Ttm(double aa, double bb, double cc, double dd) {
    a = aa; b = bb; c = cc; d = dd;
  }
  Ttm() {
    a = 0; b = 0; c = 0; d = 0;
  }
  void operator=(Ttm m) { set(m); }
  Ttm operator-() {
    return Ttm(-a, -b, -c, -d);
  }
  Ttm operator+(Ttm m) {
    return Ttm(a+m.a, b+m.b, c+m.c, d+m.d);
  }
  Ttm operator-(Ttm m) {
    return *this + (-m);
  }
  Ttm operator*(Ttm m) {
    return Ttm(a*m.a+b*m.c, a*m.b+b+m.d, c*m.a+d*m.c, c*m.d+d*m.d);
  }
  Biv operator*(Biv v) {
    return Biv(a * v.x + b * v.y, c * v.x + d * v.y);
  }
  Ttm multiple(double k) {
    return Ttm(k*a, k*b, k*c, k*d);
  }
  Ttm operator+=(Ttm m) {
    set(*this + m); return *this;
  }
  Ttm operator-=(Ttm m) {
    set(*this - m); return *this;
  }
};

Ttm Rotate(double t) {
  return Ttm(cos(t), -sin(t), sin(t), cos(t));
}

bool in(Biv a, Biv b, Biv c, Biv p) {
  b -= a;
  c -= a;
  p -= a;
  
  if (cross(b,p) * cross(c,p) >= 0) {
     /*cout << "cross(" << b.toString() << "," << p.toString()
      << ") * cross(" << c.toString() << "," << p.toString() << ") > 0" << endl;*/
    return false; }
  /*cout << (c - b).toString() << endl;*/
  double t = (c - b).arg();
  /*cout << t << " "<< Rotate(-t).toString() << endl;*/
  b = Rotate(-t) * b;
  c = Rotate(-t) * c;
  p = Rotate(-t) * p;
  /*cout << "c="<<c.toString() << " ,p=" <<p.toString()<<endl;*/

  return p.y > c.y;
}


int main() {
  Biv p1, p2, p3, pp;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> pp.x >> pp.y) {
    bool yes = in(p1, p2, p3, pp);

    cout << ( yes ? "YES" : "NO") << endl;
  }
}

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

void fun(float a, float b, float c, float d, float e, float f)
{
    float u,v;
    v = (c*d-a*f)/(b*d-a*e);
    u = (c-b*v)/a;
    if (u>0 && v>0 && (u+v) <=1)
        cout <<"YES"<< endl;
    else
        cout <<"NO"<< endl;
}

int main()
{
    float x1,y1,x2,y2,x3,y3,xp,yp;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
    {
        if (x2-x1 != 0)
        {
            fun(x2-x1,x3-x1,xp-x1,y2-y1,y3-y1,yp-y1);
        }
        else
        {
            fun(x3-x1,x2-x1,xp-x1,y3-y1,y2-y1,yp-y1);
        }
    }
   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 tp1(x1,y1);
		P tp2(x2,y2);
		P tp3(x3,y3);
		P p(xp,yp);
		P p1 = tp1 - p;
		P p2 = tp2 - p;
		P p3 = tp3 - p;

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

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

	}

	return 0;
}

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

bool is_up (double x1, double y1, double x2, double y2, double px, double py) {
    if (x1 == x2) return px > x1;
    return (py > (y2 - y1) / (x2 - x1) * px + (x1 * y2 - x2 * y1) / (x1 - x2) );
}

int main() {
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        int up = 0;
        up += is_up(x1, y1, x2, y2, xp, yp);
        up += is_up(x3, y3, x2, y2, xp, yp);
        up += is_up(x1, y1, x3, y3, xp, yp);

        if (up == 1) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
struct Point { long double px, py; };
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
long double norm(Point a) { return a.px*a.px + a.py*a.py; }
Point Minus(Point p1, Point p2) {
	Point A1; 
	A1.px = p1.px - p2.px;
	A1.py = p1.py - p2.py;
	return A1;
}
int ccw(Point p0, Point p1, Point p2) {
	Point a = Minus(p1, p0), b = Minus(p2, p0);
	if (crs(a, b) > 1e-10) return 1;
	if (crs(a, b) < -1e-10) return -1;
	if (dot(a, b) < -1e-10) return 2;
	if (norm(a) < norm(b)) return -2;
	return 0;
}
bool its(Point p1, Point p2, Point p3, Point p4) {
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
Point P1, P2, P3, P4;
int main() {
	while (cin >> P1.px >> P1.py >> P2.px >> P2.py >> P3.px >> P3.py >> P4.px >> P4.py) {
		int OK = 0;
		if (its(P1, P2, P3, P4) == true) { OK = 1; }
		if (its(P1, P3, P2, P4) == true) { OK = 1; }
		if (its(P2, P3, P1, P4) == true) { OK = 1; }
		if (OK == 1) { cout << "NO" << endl; }
		else { cout << "YES" << endl; }
	}
}

C++: #include <iostream>
#include <iomanip>
#include <math.h>
#include <utility>
#include <cstdlib>
using namespace std;

int main(){
	double x[3],y[3],xp,yp;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		bool ans=true;
		//???????????¨????????????
		double gaiseki;	//gaiseki[i]???????????????P0P1??¨????????????P0Q????????????z??§?¨?
		for(int i=0;i<3;i++){
			int k = (i+1)%3;
			double vx,vy,vpx,vpy;
			vx = x[k]-x[i];
			vy = y[k]-y[i];
			vpx = xp-x[i];
			vpy = yp-y[i];
			gaiseki = vx*vpy-vy*vpx;
			if(gaiseki<=0) ans = false;
		}
		if(ans){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}