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<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<cfloat>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P; /* ツ点 */

#define PI (3.1415926535)
#define EPS (1e-10)

//ツ静シツ閉ェ
struct S{
  P p1;
  P p2;
  S(P p,P q) : p1(p), p2(q) {}
};

int ccw(P p0, P p1, P p2){
  P d1 = p1-p0;
  P d2 = p2-p0;
  double dx1 = d1.real(), dx2 = d2.real();
  double dy1 = d1.imag(), dy2 = d2.imag();

  if(dx1*dy2 > dy1*dx2) return  1;//ツ板スツ篠楪計ツ嘉アツづィ
  if(dx1*dy2 < dy1*dx2) return -1;//ツ篠楪計ツ嘉アツづィ
  if((dx1*dx2 < 0) || (dy1*dy2 < 0)) return -1;
  if((dx1*dx1+dy1*dy1) < (dx2*dx2+dy2*dy2)) return 1;
  return 0;
}

bool intersect(const S &s1, const S &s2){
  return ((ccw(s1.p1, s1.p2, s2.p1)
	  *ccw(s1.p1, s1.p2, s2.p2)) <= 0)
       &&((ccw(s2.p1, s2.p2, s1.p1)
	  *ccw(s2.p1, s2.p2, s1.p2)) <= 0);
}

bool inside(P t, P *p, int N){
  int count = 0, j = 0;
  S lt(t, P(DBL_MAX,t.imag()));  

  P pj = p[N-1];
  for(int i=1; i<=N; i++){
    S lp(p[i-1],p[i-1]);
    if(ccw(lt.p1, lt.p2, p[i-1]) != 0){
      if(i == j+1){
	lp.p2 = pj;
	if(intersect(lp,lt)) count++;
      }else if(ccw(lt.p1, lt.p2, p[i-1])*ccw(lt.p1, lt.p2, pj) < 0)
	count++;
      j = i;
      if(j == N) pj = p[0];
      else pj = p[j-1];
    }
  }
  return count & 1 == 1;
}

int main(){
  P p[3];
  P x;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
	       &p[0].real(),&p[0].imag(),
	       &p[1].real(),&p[1].imag(),
	       &p[2].real(),&p[2].imag(),
	       &x.real(),&x.imag())){
    puts(inside(x,p,3)?"YES":"NO");
  }
  return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
 
#define rep(i,n) for(int i=0;i<int(n);++i)
 
static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double eps = 1e-8;
 
double x[3],y[3];
double xp,yp;
 
double dist(P a,P b){
    return (sqrt((real(a)-real(b))*(real(a)-real(b))+(imag(a)-imag(b))*(imag(a)-imag(b))));
}
 
double tri_pro(P a,P b,P c){
    double aa,bb,cc;
    aa = dist(b,c);
    bb = dist(c,a);
    cc = dist(a,b);
    double s = (aa+bb+cc)/2.0;
    return sqrt(s*(s-aa)*(s-bb)*(s-cc));
}
 
 
int main(){
    //P a(0.0,0.0),b(4.0,0.0),c(4.0,2.0);
    //cout<<tri_pro(a,b,c)<<endl;
    
    
    
    while(cin>>x[0]>>y[0]){
        rep(i,2) cin>>x[i+1]>>y[i+1];
        cin>>xp>>yp;
        P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
        P p(xp,yp);
        double sa,sb,sc;
        sa = tri_pro(b,c,p);
        sb = tri_pro(c,a,p);
        sc = tri_pro(a,b,p);
        double s = tri_pro(a,b,c);
        //cout<<"s="<<s<<"\nsa sb sc "<<sa<<" "<<sb<<" "<<sc<<endl;
        if((int)(s*100000000)-(int)((sa+sb+sc)*100000000)==0) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    return 0;
}

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

int main()
{
	double x1, x2, x3, xp;
	double y1, y2, y3, yp;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double S = fabs((x2 - x1)*(y3 - y1) - (y2 - y1)*(x3 - x1)) / 2.0;
		
		x1 -= xp; y1 -= yp;
		x2 -= xp; y2 -= yp;
		x3 -= xp; y3 -= yp;
		
		double s1 = fabs(x1*y2 - y1*x2) / 2.0;
		double s2 = fabs(x2*y3 - y2*x3) / 2.0;
		double s3 = fabs(x3*y1 - y3*x1) / 2.0;

		if (fabs(S - s1 - s2 - s3) < 0.00000000001)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
using namespace std;


int main(){

  double x[4], y[4];
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){

    vector<bool> t(3, false);
    for(int i=0; i<3; i++){
      if( ( x[ i ] - x[ (i+1)%3 ] )*(y[3]-y[ (i+1)%3 ]) - (y[i]-y[ (i+1)%3 ])*(x[3]-x[ (i+1)%3 ]) < 0 ) t[i] = true;
    }

    if( t[0] && t[1] && t[2] ) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}














// EOF

C++: #include <iostream>
#include <cmath>
#define EPS 1.0e-5
using namespace std;

int main() {
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a[2],b[2];
  double A,B;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;
    if(fabs(a[0] * b[1] -b[0] * a[1]) >= EPS) {
      A = ( b[1] * xp - b[0] * yp) / (a[0] * b[1] - b[0] * a[1]);
      B = (a[0] * yp - xp * a[1]) / (a[0] * b[1] - b[0] * a[1]);
      if ((A+B < 1) && (A > 0) && (B > 0)) {
        cout << "YES" << endl;
      }
      else {
        cout << "NO" << endl;
      }
    }
    else
      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 bp = sub_vector(v[3] , v[1]);
		Vector bc = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ab.x * ap.y - ab.y * ap.x; //??????
		double c2 = bc.x * bp.y - bc.y * bp.x;
		double c3 = ca.x * cp.y - ca.y * cp.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 <vector>
#include <algorithm>
#include <complex>

using namespace std;

int main(){

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

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		complex<double> p1(x1,y1);
		complex<double> p2(x2,y2);
		complex<double> p3(x3,y3);
		yp -= p1.imag();
		xp -= p1.real();
		
		// p1_2xNgÆp1_3xNgðßA»êçÅpxNgð çíµ½Æ«ÌWÅ»f
		complex<double> p12 = -p1 + p2;
		complex<double> p13 = -p1 + p3;

		double a = (xp - (p13.real()*yp)/p13.imag())/(p12.real() - (p13.real()*p12.imag())/(p13.imag()));
		double b = (yp - a*p12.imag())/p13.imag();
		if(a >= 0 && b >= 0 && a + b < 1)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}