Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

#define turn(x1,y1,x2,y2,x3,y3) x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)
int hantei(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy);
int main()
{
	int i;
	double xy[8];
	int ans;
	char a;
	
	for(;cin >> xy[0];)
	{
		for(i=1;i<8;i++)
			cin >> xy[i] ;
		
		ans=1;
		
		if(hantei(xy[0],xy[1],xy[2],xy[3],xy[4],xy[5],xy[6],xy[7])==0)
			ans=0;
		
		if(ans==1)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

int hantei(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy)
{
	if((
		turn(ax,ay,bx,by,cx,cy)>0.0 &&
		turn(dx,dy,ax,ay,bx,by)>0.0 &&
		turn(dx,dy,bx,by,cx,cy)>0.0 &&
		turn(dx,dy,cx,cy,ax,ay)>0.0)
		||(
		turn(ax,ay,bx,by,cx,cy)<0.0 &&
		turn(dx,dy,ax,ay,bx,by)<0.0 &&
		turn(dx,dy,bx,by,cx,cy)<0.0 &&
		turn(dx,dy,cx,cy,ax,ay)<0.0)
	)
		return 1;
	else
		return 0;
}

C++: #include <iostream>
using namespace std;
struct point{
	double x;
	double y;
};

bool side(point p1, point p2, point p3){
	return (p3.y-p1.y)*(p2.x-p1.x)-(p3.x-p1.x)*(p2.y-p1.y)>0;
}

int main(void){
    point p1, p2, p3, p0;
	
	while (true){
		cin>>p1.x>>p1.y;
		if (cin.eof()) break;
		cin>>p2.x>>p2.y;
		cin>>p3.x>>p3.y;
		cin>>p0.x>>p0.y;

		if (side(p1, p2, p0) == side(p2, p3, p0) && side(p2, p3, p0) == side(p3, p1, p0))
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],r[2];
  while(cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>r[0]>>r[1]){
    b[0]-=a[0];
    c[0]-=a[0];
    r[0]-=a[0];
    b[1]-=a[1];
    c[1]-=a[1];
    r[1]-=a[1];
    double m[2][2],ans[2],rev[2][2];
    m[0][0] = b[0];
    m[0][1] = c[0];
    m[1][0] = b[1];
    m[1][1] = c[1];
    ans[0] = r[0];
    ans[1] = r[1];
    double det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    rev[0][0] = m[1][1]/det;
    rev[0][1] = -m[0][1]/det;
    rev[1][0] = -m[1][0]/det;
    rev[1][1] = m[0][0]/det;
    double s = ans[0]*rev[0][0]+ans[1]*rev[0][1];
    double t = ans[0]*rev[1][0]+ans[1]*rev[1][1];
    if(s>0 && t>0 &&s+t<1){cout <<"YES"<<endl;}
    else{cout <<"NO"<<endl;}
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double x[2],y[2],z[2],p[2];
  while(cin >>x[0]>>x[1]>>y[0]>>y[1]>>z[0]>>z[1]>>p[0]>>p[1]){
    double v[3][2],vp[3][2];
    v[0][0] = y[0]-x[0];
    v[0][1] = y[1]-x[1];
    v[1][0] = z[0]-y[0];
    v[1][1] = z[1]-y[1];
    v[2][0] = x[0]-z[0];
    v[2][1] = x[1]-z[1];
    vp[0][0] = p[0]-x[0];
    vp[0][1] = p[1]-x[1];
    vp[1][0] = p[0]-y[0];
    vp[1][1] = p[1]-y[1];
    vp[2][0] = p[0]-z[0];
    vp[2][1] = p[1]-z[1];
    int n=0;
    for(int i=0; i<3; i++){
      if(v[i][0]*vp[i][1]-v[i][1]*vp[i][0]<0) n--;
      else n++;
    }
    if(n == 3 || n == -3) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

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

int checkPoint(double x1, double y1, double x2, double y2, double x, double y){
    if(x1 - x2 == 0) if(x - x1 >= 0) { return 1; } else return -1;
    if((y - y1) - (y2 - y1) / (x2 - x1) * (x - x1) >= 0) { return 1; } else return -1;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        if(checkPoint(x1, y1, x2, y2, x3, y3) * checkPoint(x1, y1, x2, y2, xp, yp))
            if(checkPoint(x1, y1, x3, y3, x2, y2) * checkPoint(x1, y1, x3, y3, xp, yp))
                if(checkPoint(x2, y2, x3, y3, x1, y1) * checkPoint(x2, y2, x3, y3, xp, yp)) cout << "YES" << endl;
            cout << "NO" << endl;
    }
    return 0;
}

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

double length(double, double, double, double);

double triangle(double x1, double y1, double x2, double y2, double x3, double y3) {
    double a = length(x1, y1, x3, y3);
    double b = length(x2, y2, x3, y3);
    double c = length(x1, y1, x2, y2);

    double d = (a + b - c) / sqrt(a * b) / 2.0; // cos(radian)

    // cout << d << endl;

    return d;
}

double length(double x, double y, double ox, double oy) {
    return pow(x - ox, 2) + pow(y - oy, 2);
}

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

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double ta = triangle(x1, y1, x2, y2, xp, yp);
        double tb = triangle(x1, y1, x3, y3, xp, yp);
        double tc = triangle(x2, y2, x3, y3, xp, yp);

        if (ta < 0 && tb < 0 && tc < 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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