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"
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

#define OUT 0
#define ON 1
#define IN 2
#define EPS (1e-10)
class P{                    //???
public:
    double x,y;
    
    P(double _x=0,double _y=0):x(_x),y(_y){};
    P operator + (P &p     ){ return P( x+p.x , y+p.y ); }  //??????
    P operator - (P &p     ){ return P( x-p.x , y-p.y ); }  //??????
    P operator * (double k ){ return P( x*k   , y*k    ); } //??????
    P operator / (double k ){ return P( x/k   , y/k    ); } //??????
    
    bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
    //    bool operator < (const P &p)const{ return ( x!=p.x ? x<p.x:y<p.y ); }
    
    double norm(){ return x*x+y*y; }        //?????????
    double abs() { return sqrt(norm()); }   //??§??????
    
};
struct C{P p;double r;};    //???
struct L{P p1,p2;};         //??´???
typedef vector<P> Polygon;  //????§???¢
typedef P Vector;           //????????????

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; }
double sqDist(P a, P b)       {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
double dist (P a, P b)          {return sqrt(sqDist(a,b));}

int ccw(P p0,P p1,P p2){    //AOJ_BOOK_P386 verified
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    
    if( cross(a,b) > EPS  ) return 1 ;      //COUNTER_CLOCKWISE
    if( cross(a,b) < -EPS ) return -1;      //CLOCKWISE
    if( dot(a,b)   < -EPS ) return 2;       //ONLINE_BACK
    if( a.norm()   < b.norm() ) return -2;  //ONLINE_FRONT
    
    return 0;                               //ON_SEGMENT;
}

//??´?????´????????? verified AOJ0058
bool orthogonal(P p1,P p2,P p3,P p4){ return abs(dot(p1-p2,p3-p4))<EPS; }

//??????????????????
bool intersect(P p1,P p2,P p3,P p4){ return ( ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 && ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0 ); }

//????????¨???????????¢ verified ARC042-B
double dLP(L l, P p) { return abs(cross(l.p2-l.p1, p-l.p1)) /(l.p2-l.p1).abs(); }

// ?????¨??????????????????
int contains(C c, P p){
    double d = (c.p-p).abs();
    if(d-c.r>EPS) return OUT;
    if(abs(d-c.r)<EPS) return ON;
    return IN;
}

//??´?????¨??????????????????(????????£???????????´??????????????±???)
bool intersect_circle_(P center, double r, L line){
    if( dLP(line,center) <= r+EPS ) return true;
    return false;
}

//????????¨???????????¢ verified QUPC-G
double dSP(L s, P p){
    if(dot((s.p2-s.p1)   , p-s.p1) <= EPS) return (p - s.p1).abs();
    if(dot((s.p2-s.p1)*-1, p-s.p2) <= EPS) return (p - s.p2).abs();
    return dLP(s, p);
}

//????????¨??????????????????(????????£???????????´??????????????±???) verified QUPC-G
bool iCS(C c, L l){
    int c1 = contains(c, l.p1);
    int c2 = contains(c, l.p2);
    if(c1 > c2) swap(c1, c2);
    
    // (OUT, OUT) (OUT, ON) (OUT, IN) (ON, ON) (ON, IN) (IN, IN) ???6??????
    if(c1 == OUT && c2 == IN) return true;
    if(c1 == IN  && c2 == IN) return false;
    if(c1 == ON) return true; // (??\????????¨???)
    double d = dSP(l, c.p);
    if(d-c.r<-EPS) return true;
    if(d-c.r>EPS) return false;
    return true; // (??\????????¨???)
}

//????´?????§???¢??????
bool isSimple( Polygon pol ){
    //???????????????????????????pol?????\????????????
    size_t pol_size = pol.size()-1;
    rep(i,pol_size){
        for(int j=i+2;j<pol_size;j++){
            if( i==j || i==(j-1+pol_size)%pol_size || i==(j+1+pol_size)%pol_size )continue;
            if( intersect(pol[i], pol[i+1], pol[j], pol[j+1]) )return false;
        }
    }
    return true;
}


//?????????????§???¢????????´?????????????????????????±??????? true???????????´ verified AOJ0012
bool isPointInsidePolygon(vector<P> pol,P p){
    int c=0;
    rep(i,pol.size()){
        if( cross(pol[i]-pol[(i+1)%pol.size()] , p-pol[(i+1)%pol.size()])>0 ) c++;
    }
    return !(c%pol.size());
}

//?????¨???????§???¢???????????¶???????????????
int CPOLarea(C c ,Polygon pol){
    vector<L> lines;
    vector<int> res(pol.size());
    bool POLinC=true, isFar=true;
    
    rep(i,pol.size()){
        res[i] = contains(c,pol[i]);
        if(sqDist(c.p,pol[i])-c.r*c.r<-EPS)isFar=false;
        lines.pb( L{ pol[i] , pol[(i+1)%pol.size()] });
    }
    rep(i,res.size()) if( res[i]==OUT )POLinC=false;
    
    rep(i,lines.size()) if( iCS(c,lines[i]) )       return 1;   //????§???¢??¨????????????
    if( POLinC )                                    return 2;   //????§???¢??????????????¨
    if( isPointInsidePolygon(pol, c.p) && isFar )   return 3;   //????§???¢????????¨??????
    return 0;
}

//?????? verified AOJ0068,QUPC-G
//???????????§??????
bool cmp_x(const P& p, const P& q){
    if(p.x != q.x)return p.x<q.x;
    return p.y<q.y;
}

//??????????±???????
vector<P> convex_hull(vector<P> ps){
    int n = ps.size();
    sort(all(ps),cmp_x);
    int k=0;            //?????????????????°
    vector<P> qs(n*2);  //?§????????????????
    //?????´???????????????
    rep(i,n){
        while( k>1 && cross((qs[k-1]-qs[k-2]) , (ps[i]-qs[k-1]))<=0 ) k--;
        qs[k++]=ps[i];
    }
    //?????????????????????
    for(int i=n-2, t=k;i>=0;i--){
        while( k>t && cross((qs[k-1]-qs[k-2]) , (ps[i]-qs[k-1]))<=0 ) k--;
        qs[k++]=ps[i];
    }
    qs.resize(k-1);
    return qs;
}


int main(){
    double a,b;
    while(cin>>a>>b){
        Polygon pol(3);
        pol[0] = P(a,b);
        rep(i,2)cin>>pol[i+1].x>>pol[i+1].y;
        P p;
        cin>>p.x>>p.y;
        if( isPointInsidePolygon(pol, p) )cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <iostream>
#include <cmath>

using namespace std;

typedef struct _Point {
	double x;
	double y;
} Point;
typedef Point Vector;

Point subPoint(Point a, Point b) {
	Point ret;
	ret.x = a.x - b.x;
	ret.y = a.y - b.y;
	return ret;
}

bool apint(Point a, Point b, Point c, Point p) {
	Vector ab = subPoint(b, a);
	Vector bp = subPoint(p, b);
	Vector bc = subPoint(c, b);
	Vector cp = subPoint(p, c);
	Vector ca = subPoint(a, c);
	Vector ap = subPoint(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 true;
	return false;
}

int main() {
	Point a, b, c, p;
	while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y) {
		if (apint(a, b, c, p) == true)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}