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>

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));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

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 inside(point p, vector<point> ps){
  point a,b;
  a=b=p;

  b.x=DBL_MAX;

  int n=ps.size();
  ps.push_back(ps[0]);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<n;i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;
  
  for(int i=0;i<n;i++){
    if(is_point_on_line(ps[i],ps[i+1],p))return 0;
  }
  
  int cnt1=0;
  for(int i=0;i<n;i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<n;i++)
    if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
  
  return (cnt-cnt1/2)%2;
}

int main(void){
 
  point in[4],p;
  vector<point>ps;

  while(cin>>in[1].x>>in[1].y>>in[2].x>>in[2].y>>in[3].x>>in[3].y>>p.x>>p.y){

    ps.clear();

    for(int i=1;i<4;i++)
    ps.push_back(in[i]);

    if(inside(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
 
  return 0;
}

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

double Area(double* x1, double* y1, double* x2, double* y2){
  return (*x1 * *y2 - *x2 * *y1)/2.0;
}

double Segitiga(double* a, double * b, double* c, double* d, double* e, double* f){
  return abs (Area(a,b,c,d) + Area(c,d,e,f) + Area(e,f,a,b));
}

int main(){
  double a, b, c, d, e, f, g, h, ta, tb;
  cin >> a >> b >> c >> d >> e >> f >> g >> h;
  ta = Segitiga(&a, &b, &c, &d, &e, &f);
  tb = Segitiga(&a, &b, &c, &d, &g, &h) + Segitiga(&a, &b, &e, &f, &g, &h) + Segitiga(&c, &d, &e, &f, &g, &h);

  if(tb > ta)
    cout << "NO\n";
  else
    cout << "YES\n";
  
return 0;
}

C++: #include <iostream>

template <class T>
struct vec {
  T x, y;
  vec(const T& _x, const T& _y) : x(_x), y(_y) {}
  vec<T> operator+(const vec<T>& rhs) const {
    return vec<T>(x + rhs.x, y + rhs.y);
  }
  vec<T> operator-(const vec<T>& rhs) const {
    return vec<T>(x - rhs.x, y - rhs.y);
  }
};

using namespace std;

int main(int ac, char **av) {
  float x1, x2, x3, y1, y2, y3, xp, yp;
  while (1) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
    if (x1 != 0 && x2 != 0) {
      break;
    }
    vec<float> T1 {x1, y1};
    vec<float> T2 {x2, y2};
    vec<float> T3 {x3, y3};
    vec<float> Tp {xp, yp};

    auto ab = T2 - T1;
    auto bp = Tp - T2;
    auto bc = T3 - T2;
    auto cp = Tp - T3;
    auto ca = T1 - T3;
    auto ap = Tp - T1;

    auto c1 = ab.x * bp.y - ab.y * bp.x;
    auto c2 = bc.x * cp.y - bc.y * cp.x;
    auto c3 = ca.x * ap.y - ca.y * ap.x;

    if ((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

    x1 = y1 = 0;
    x2 = y2 = 0;
    x3 = y3 = 0;
    xp = yp = 0;
  }
  return 0;
}

C++: #include<cstdio>

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	int flug;
	double h;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) + 1){
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;
		y1 -= yp;
		y2 -= yp;
		y3 -= yp;
		flug = 0;
		if(x1 < 0.00001 || x1 > -0.00001){
			if(y1 > 0){
				if(y2 < 0 && y3 < 0){
					if(x2 * x3 < 0){
						flug = 1;
					}
				}
			}else{
				if(y2 > 0 && y3 > 0){
					if(x2 * x3 < 0){
						flug = 1;
					}
				}
			}
		}else{
			h = (y1 / x1 * x2 - y2)*(y1 / x1 * x3 - y3);
			if(x1 * x2 > 0 && y1 * y2 > 0){
				if(x3 * x1 < 0 && y3 * y1 < 0){
					if(h > 0){
						if(y2 / x2 * x1 - y3 < 0){
							flug = 1;
						}
					}
				}
			}
		}
		if(flug){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
	double x1, x2, x3, y1, y2, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		double cross1 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
		double cross2 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
		double cross3 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
		if(cross1 < 0 && cross2 < 0 && cross3 < 0 || cross1 > 0 && cross2 > 0 && cross3 > 0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}