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(double x1,double y1,double x2,double y2)
//{
//	return x1*y2-x2*y1;
//}
#define cross(x1,y1,x2,y2) (x1)*(y2)-(x2)*(y1)

int 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(double x,y,a,b,n,m,p,q;scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x,&y,&a,&b,&n,&m,&p,&q)==8;){
		int counter=0;
		//counter+=(p-x)*(b-y)-(q-y)*(a-x)>0;
		//counter+=(p-a)*(m-b)-(q-b)*(n-a)>0;
		//counter+=(p-n)*(y-m)-(q-m)*(x-n)>0;
		//counter+=cross(a-x,b-y,p-x,q-y)>=0;
		//counter+=cross(n-a,m-b,p-a,q-b)>=0;
		//counter+=cross(x-n,y-m,p-n,q-m)>=0;
		counter+=ccw(x,y,a,b,p,q);
		counter+=ccw(a,b,n,m,p,q);
		counter+=ccw(n,m,x,y,p,q);
		
		cout<<(counter%3==0?"YES":"NO")<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

struct Point{
	double x,y;
	Point(){}
	Point(double _x,double _y){
		x=_x; y=_y;
	}
};

struct Line{
	double x[2],y[2];
	Line(){}
	Line(Point p,Point q){
		x[0]=p.x; x[1]=q.x;
		y[0]=p.y; y[1]=q.y;
	}
};

void RevXY(Point &p){
	swap(p.x,p.y);
}

void RevXY(Line &l){
	for(int i=0;i<2;i++) swap(l.x[i],l.y[i]);
}

bool Is_SameSide(Line l,Point p,Point q){
	//printf("%lf,%lf - %lf,%lf\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],p.x,p.y,q.x,q.y);
	if(l.x[1]==l.x[0]){
		RevXY(l); RevXY(p); RevXY(q);
	}
	double a,b;
	a = (l.y[1]-l.y[0])/(l.x[1]-l.x[0]);
	b = l.y[0]-a*l.x[0];
	//printf("%lf,%lf - %lf,%lf : y = %lfx+(%lf)\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],a,b,p.x,p.y,q.x,q.y);
	if((p.y-(a*p.x+b))*(q.y-(a*q.x+b))>0) return true;
	else return false;
}

int main(){
	/*Line l;
	Point p,q;
	cin>>l.x[0]>>l.y[0]>>l.x[1]>>l.y[1]>>p.x>>p.y>>q.x>>q.y;
	printf("%lf,%lf - %lf,%lf\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],p.x,p.y,q.x,q.y);
	if(Is_SameSide(l,p,q)==true) puts("YES");
	else puts("NO");*/
	Point t[3],p;
	while(cin>>t[0].x>>t[0].y){
		for(int i=1;i<3;i++) cin>>t[i].x>>t[i].y;
		cin>>p.x>>p.y;
		Point q = Point((t[0].x+t[1].x+t[2].x)/3,(t[0].y+t[1].y+t[2].y)/3);
		bool ans=true;
		for(int i=0;i<3;i++){
			if(Is_SameSide(Line(t[i],t[(i+1)%3]),p,q)==false){
				ans = false;
			}
		}
		if(ans) puts("YES");
		else puts("NO");
	}
}

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

struct point{
	double x;
	double y;
};

int ccw(point p0, point p1, point p2){
	double dx1, dx2, dy1, dy2;
	dx1 = p1.x - p0.x;
	dy1 = p1.y - p0.y;
	dx2 = p2.x - p0.x;
	dy2 = p2.y - p0.y;
	if(dx1 * dy2 > dy1 * dx2){
		return 1;
	}else if(dx1 * dy2 < dy1 * dx2){
		return -1;
	}else return 0;
}

int main(){
	point p1, p2, p3, p0;
	while(cin >> p1.x >> p1.y >> p2.x >>p2.y
		>> p3.x >> p3.y >> p0.x >> p0.y)
	{
		if(ccw(p0,p1,p2) && ccw(p0,p2,p3) && ccw(p0, p3, p1)){
			if((ccw(p0, p1, p2 ) != ccw(p0, p1, p3))
				&& (ccw(p0, p2, p1) != ccw(p0, p2, p3)))
				cout << "YES" << endl;
			else cout << "NO" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}