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>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

double cross(int x1,int y1,int x2,int y2)
{
	return x1*y2-x2*y1;
}

bool ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		vector<double> x(3),y(3);
		rep(i,3)
			iss>>x[i]>>y[i];
		double xp,yp;
		iss>>xp>>yp;
		
		bool in_triangle=true;
		rep(i,3)
			if(ccw(x[0],y[0],x[1],y[1],xp,yp)!=ccw(x[1],y[1],x[2],y[2],xp,yp))
				in_triangle=false;
		
		cout<<(in_triangle?"YES":"NO")<<endl;
	}
	
	return 0;
}

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

double x1, y1, x2, y2, x3, y3, xp, yp;

int side(double p1_x, double p1_y, double p2_x, double p2_y){
	double n = xp*(p1_y - p2_y) + p1_x*(p2_y - yp) + p2_x*(yp - p1_y);
	if(n > 0) return 1; // left
	else if(n < 0) return -1; //right
	else return 0; //on_line
}

bool judge_in(){
	int pab = side(x1,y1,x2,y2);
	int pbc = side(x2,y2,x3,y3);
	int pca = side(x3,y3,x1,y1);

	if((pab > 0) && (pbc > 0) && (pca > 0)) return true;
	if((pab < 0) && (pbc < 0) && (pca < 0)) return true;
	return false;
}


int main(){
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		bool judge = judge_in();
		if(judge == true) cout << "YES" << endl;
		else if(judge == false) cout << "NO" << endl;
	}
}

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

struct Vector{
	double x;
	double y;
};

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

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ab = sub_vector(v[1] , v[0]);
		Vector pb = sub_vector(v[3] , v[1]);
		Vector cb = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector pa = sub_vector(v[3] , v[0]);
		double c1 = ab.x * pb.y - ab.y * pb.x; //??????
		double c2 = cb.x * cp.y - cb.y * cp.x;
		double c3 = ca.x * pa.y - ca.y * pa.x;
		if((c1<0 && c2<0 && c3 <0)||(c1>=0 && c2>=0 && c3>=0)) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int main() {
    while(true){
        for(int i=0; i<4; ++i){
            cin >> x[i] >> y[i];}
            if(!cin) break;
            xy_t a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]),p(x[3],y[3]);
            double pab = cross_product(a-p, b-p);
            double pbc = cross_product(b-p, c-p);
            double pca = cross_product(c-p, a-p);
            bool ok = abs(pab+pbc+pca) == abs(pab)+abs(pbc)+abs(pca);
            cout << (ok ? "YES" : "NO") << endl;
            }
    return 0;
}

C++: #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#define curr(P, i) P[(i) % P.size()]
#define next(P, i) P[(i+1) % P.size()]
#define prev(P, i) P[(i+P.size()-1) % P.size()]

using namespace std;

typedef double Real;

Real EPS = 1e-8;
const Real PI = acos(-1);

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }
  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
};

Real dot(Point a, Point b) {return (a.x*b.x+a.y*b.y);}
Real cross(Point a, Point b) {return (a.x*b.y-a.y*b.x);}

struct Polygon{
  vector<Point>v;

  Polygon(){}
  Polygon(int n){v.resize(n);}

  int contain(Point p){
    bool in=false;
    for(int i=0;i<v.size();i++){
      Point a=curr(v,i)-p,b=next(v,i)-p;
      if(a.y>b.y)swap(a,b);
      if(a.y<=0 && 0<b.y && cross(a,b)<0)in=!in;
      if(cross(a,b)==0 && dot(a,b)<=0)return 2;
    }
    return in?1:0;
  }
};

int main(void){

  Polygon pol(3);
  Point p;
  while(cin >> pol.v[0].x >> pol.v[0].y){
    for(int i=1;i<3;i++)cin >> pol.v[i].x >> pol.v[i].y;
    cin >> p.x >> p.y;
    
    if(pol.contain(p))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;
#define EPS 1.0e-12
#define F(I,J,N) for(int I=J;I<N;I++)

class Line{
public:
	P p[2];
	P v;
	Line(){}
	Line(P p0,P p1){
		p[0]=p0;
		p[1]=p1;
		v=p1-p0;
	}
	//線分の長さ
	double length(){return abs(v);}
	//平行
	bool Parallel(Line l){
		return (cross(v,l.v)==0);
	}
	//線分上
	bool OnLine(P a){
		return (abs(p[0]-a)+abs(a-p[1])<length()+EPS);
	}
	double cross(Line l){
		return cross(v,l.p[0]-p[0]) * cross(v,l.p[1]-p[0]);
	}
	double cross(P a,P b){
		return (real(a)*imag(b)-imag(a)*real(b));
	}
	bool Intersection(Line l){
		if(Parallel(l)){
			return (OnLine(l.p[0])||OnLine(l.p[1])||l.OnLine(p[0])||l.OnLine(p[1]));
		}
		return ((cross(l)<EPS) && (l.cross(*this))<EPS);
	}
};

class Pi{
private:
	P *p;
	Line *l;
	int n;
public:
	Pi(){}
	Pi(int n){
		this->n=n;
		p=new P[n+1];
		l=new Line[n];
	}
	~Pi(){
		delete []p;
		delete []l;
	}
	void set(int i,P a){
		if(i==0){
			p[0]=a;
			p[n]=a;
		}
		else p[i]=a;
	}
	void set(){
		F(i,0,n) l[i]=Line(p[i],p[i+1]);
	}
	bool isin(P a,double x){
		F(i,0,n) if(l[i].OnLine(a)) return true;
		int cnt=0;
		P out=(a-(p[0]+p[1])/2.0);
		out=a+out*(x-real(a)-1)/real(out);
		Line buf(a,out);
		F(i,0,n) if(l[i].Intersection(buf)) cnt++;
		if(cnt&1) return true;
		return false;
	}
};

int main(){
	double a,b,c,d,e,f,g,h;
	P p[3],q;
	Pi *in;
	while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
		p[0]=P(a,b);
		p[1]=P(c,d);
		p[2]=P(e,f);
		q=P(g,h);
		in=new Pi(3);
		F(i,0,3) in->set(i,p[i]);
		in->set();
		if(in->isin(q,-101)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		delete in;
	}
	return 0;
}