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<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()]
using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}
  point operator + (point p){return point(add(x,p.x), add(y,p.y));}
  point operator - (point p){return point(add(x,-p.x), add(y,-p.y));}
};

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

int is_point_on_line(point a, point b, point c) {
  return cross(b-a,c-a)==0.0 && dot(b-a,c-a)>-EPS && dot(a-b,c-b)>-EPS;
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {
  if(cross(a1-a2,b1-b2)==0){
    return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2) 
        || is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
  }
  else {
    return (cross(a2-a1, b1-a1)*cross(a2-a1, b2-a1)<EPS ) &&
           (cross(b2-b1, a1-b1)*cross(b2-b1, a2-b1)<EPS );
  }
}

int contain(point p, vector<point> ps){
  point a=p,b(1000000,p.y);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<ps.size();i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;

  int cnt=0,cnt1=0;
  for(int i=0;i<ps.size();i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  for(int i=0;i<ps.size();i++)
    if(is_intersected_ls(ps[i],next(ps,i),a,b))cnt++;
 
  return (cnt-cnt1)%2;
}


int main(void){
 
  point in[4],p;

  while(true){
    vector<point>ps(3);

    for(int i=0;i<3;i++)
      if(!(cin >> ps[i].x >> ps[i].y))return 0;

    cin >> p.x >> p.y;
    
    if(contain(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;
double T_area(double x1,double y1, double x2, double y2, double x3, double y3);

int main(){
    double x[3]={0};
    double y[3]={0};
    while(scanf("%lf",&x[0])!=EOF){
        scanf("%lf",&y[0]);
        scanf("%lf",&x[1]);
        scanf("%lf",&y[1]);
        scanf("%lf",&x[2]);
        scanf("%lf",&y[2]);
        
        double xp,yp;
        scanf("%lf",&xp);
        scanf("%lf",&yp);

        double S =T_area(x[0],y[0],x[1],y[1],x[2],y[2]);
        double S1, S2, S3;
        S1 =T_area(xp,yp,x[1],y[1],x[2],y[2]);
        S2 =T_area(x[0],y[0],xp,yp,x[2],y[2]);
        S3 =T_area(x[0],y[0],x[1],y[1],xp,yp);
        
        if(S1+S2+S3==S){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
        
    }
    
    
}

double T_area(double x1,double y1, double x2, double y2, double x3, double y3){
    double S =fabs(x1*y2+x2*y3+x3*y1-y1*x2-y2*x3-y3*x1)/2;
    return S;
}

C++: #include<stdio.h>

int main(void)
{
	double x1,y1,x2,y2,x3,y3,xp,yp,p,q;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) !=EOF);
	{
		if(x1==0&&y1==0)
		{
		}
		else
		{
			x2-=x1;
			x3-=x1;
			xp-=x1;
			y2-=y1;
			y3-=y1;
			yp-=y1;
			x1=0;
			y1=0;
		}

		p=(y2*xp-x2*yp)/(x3*y2-x2*y3);
		q=(y3*xp-x3*yp)/(x2*y3-x3*y2);
		
		double w=p+q;
		
		if(p>=0&&q>=0&&w<1)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: def side(p1, p2)
   #the line from p1(a,b) to p2(c,d). return [e,f,g] where ex+fy=g
   a,b = p1
   c,d = p2
   e = b - d
   f = c - a
   g = b*c - d*a
   return [e,f,g]
end

def between?(p1, p2, p3, q)
   #Is q between p1 ~ line from p2 to p3?
   a,b,c = side(p2,p3)
   dist_array = [p1, q].map{|point| (point[0]*a + point[1]*b - c).abs }
   if dist_array[0] > dist_array[1]
	  return true
   else
	  return false
   end
end

while num = gets
   a,b,c,d,e,f,g,h= num.split(' ').map(&:to_f)
   p1, p2, p3, q = [a,b],[c,d],[e,f],[g,h]
   if between?(p1, p2, p3, q) && between?(p2, p3, p1, q) && between?(p3, p1, p2, q)
	  puts "YES"
   else
	  puts "NO"
   end
end

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

int main(){
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		bool ans=true;
		double x[3],y[3],xp,yp;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp;
		//???????????¨????????????
		double gaiseki[3];	//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[i] = vx*vpy-vy*vpx;
			if(gaiseki[i]<=0) ans = false;
		}
		if(ans){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}