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;
double cross(double x1, double y1, double x2, double y2){
	return (x1 * y2) - (y1 * x2);
}
int main(){
	double x[3], y[3], px, py;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> px >> py){
		double ret[3];
		for(int i = 0; i < 3; ++i ){
			int n =( i+1 ) % 3;
			ret[i] = cross( px - x[i], py - y[i], x[n] - x[i], y[n] - y[i] );
		}
		if(ret[0] < 0 && ret[1] < 0 && ret[2] < 0 
		|| ret[0] > 0 && ret[1] > 0 && ret[2] > 0) 
			cout << "YES" << endl;
		else
		    cout << "NO" << endl;		
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> paii;
typedef complex<double> P;

double ccw(P& p1, P& p2, P& p3)
{
	return ((p2.real() - p1.real())*(p3.imag() - p1.imag()) 
				- (p2.imag() - p1.imag())*(p3.real() - p1.real())) > 0;
}// ccw>0 ...ccw, ccw=0 ...colinear, ccw<0 ...cw

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

C++: #include <iostream>
#include <iomanip>
#include <cmath>

// Vector 2D
template<class T>
struct Vec2D
{
    T x,y;
    explicit Vec2D(T x_=T(), T y_=T()):x(x_),y(y_){}
    Vec2D(const std::pair<T,T>& p):x(p.first),y(p.second){}
    Vec2D& operator+=(const Vec2D& v){ return *this = *this+v; }
    Vec2D& operator-=(const Vec2D& v){ return *this = *this-v; }
    friend Vec2D operator+(const Vec2D& l, const Vec2D& r){ return Vec2D(l.x+r.x,l.y+r.y); }
    friend Vec2D operator-(const Vec2D& l, const Vec2D& r){ return Vec2D(l.x-r.x,l.y-r.y); }
    friend T norm(const Vec2D& v){ return std::hypot(v.x,v.y); }
    friend T norm2(const Vec2D& v){ return v.x*v.x+v.y*v.y; }
    friend T dot(const Vec2D& l, const Vec2D& r){ return l.x*r.x+l.y*r.y; }
    friend T cross(const Vec2D& l, const Vec2D& r){ return l.x*r.y-l.y*r.x; }
    friend int dir(const Vec2D& l, const Vec2D& r)
    {
        // assert(norm2(l)!=0);
        const auto c = cross(l,r);
        if(c>0) return 1;
        if(c<0) return -1;
        if(dot(l,r)<0) return -2;
        if(norm2(l)<norm2(r)) return 2;
        return 0;
    }
};

// Triangle 2D
template<class T=double>
class Triangle2D
{
    Vec2D<T> a,b,c;
public:
    explicit Triangle2D(T ax=T(), T ay=T(), T bx=T(), T by=T(), T cx=T(), T cy=T()):a(ax,ay),b(bx,by),c(cx,cy){}
    Triangle2D(const Vec2D<T>& a_, const Vec2D<T>& b_, const Vec2D<T>& c_):a(a_),b(b_),c(c_){}
    T area() const
    {
        return std::abs(a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y))/2;
    }
    T dist_a() const { return norm(b-c); }
    T dist_b() const { return norm(c-a); }
    T dist_c() const { return norm(a-b); }
    Vec2D<T> circumcenter() const
    {
        const Vec2D<T> vb(2*(b.x-a.x),2*(c.x-a.x)),
                       vc(2*(b.y-a.y),2*(c.y-a.y)),
                       vd(norm2(a)-norm2(b),norm2(a)-norm2(c));
        return Vec2D<T>(cross(vc,vd)/cross(vb,vc),
                        cross(vd,vb)/cross(vb,vc));
    }
    T R() const { return dist_a()*dist_b()*dist_c()/(4*area()); }
    bool inside(const Vec2D<T>& p, bool line=true) const
    {
        const auto c1 = cross(b-a,p-a);
        const auto c2 = cross(c-b,p-b);
        const auto c3 = cross(a-c,p-c);
        if(line) return (c1>=0&&c2>=0&&c3>=0)||(c1<=0&&c2<=0&&c3<=0);
        else     return (c1> 0&&c2> 0&&c3> 0)||(c1< 0&&c2< 0&&c3< 0);
    }
};

int main()
{
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(3);
    typedef double F;
    for( F x1,y1,x2,y2,x3,y3,px,py;
         std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py; )
    {
        const Triangle2D<F> tri(x1,y1,x2,y2,x3,y3);
        std::cout << (tri.inside(Vec2D<F>(px,py))?"YES":"NO") << std::endl;
    }
}

C++: #include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
signed main(){
	double a,b,c,d,e,f,g,h;
	while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
		if(kosa(a,b,a+(g-a)*10000,b+(h-b)*10000,c,d,e,f)&&
		kosa(c,d,c+(g-c)*10000,d+(h-d)*10000,a,b,e,f)&&
		kosa(e,f,e+(g-e)*10000,f+(h-f)*10000,a,b,c,d))puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

const double EPS = 1e-9;

struct Vec2d{
  double x,y;
};

double cross(Vec2d &A, Vec2d &B){
  return A.x*B.y - A.y*B.x;
}

int main(void){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
	  Vec2d AB,AP,BC,BP,CA,CP;
	  AB.x = x2-x1;AB.y = y2-y1;
	  BC.x = x3-x2;BC.y = y3-y2;
	  CA.x = x1-x3;CA.y = y1-y3;
	  AP.x = xp-x1;AP.y = yp-y1;
	  BP.x = xp-x2;BP.y = yp-y2;
	  CP.x = xp-x3;CP.y = yp-y3;
	  if(cross(AB,AP)>EPS && cross(BC,BP)>EPS && cross(CA,CP)>EPS) cout<<"YES"<<endl;
	  else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

double crossProduct(double px, double py, double x1, double y1, double x2, double y2) {
  double v1[2] = {px - x1, py - y1};
  double v2[2] = {x2 - x1, y2 - y1};
  return v1[0] * v2[1] - v1[1] * v2[0];
}

int main() {
	double x1, x2, x3, xp, y1, y2, y3, yp;
  double t[3];
  int f;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    t[0] = crossProduct(xp, yp, x1, y1, x2, y2);
    t[1] = crossProduct(xp, yp, x2, y2, x3, y3);
    t[2] = crossProduct(xp, yp, x3, y3, x1, y1);
    for (int i = f = 0; i < 3; i++) {
      if (t[i] < 0) f++;
      else if (t[i] > 0) f--;
      else return -1;
    }
    if (f == 3 || f == -3) cout << "YES";
    else cout << "NO";
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
using namespace std;
const string mes[2] = {"YES", "NO"};
double dist(double a, double b) {
  return sqrt(a*a + b*b);
}

int main (int argc, char const* argv[]) {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
    //double cx = (x1 + x2 + x3) / 3.0;
    //double cy = (y1 + y2 + y3) / 3.0;
    //double cdist = dist(cx-x1,cy-y1) + dist(cx-x2,cy-y2) + dist(cx-x3,cy-y3);
    double cdist = dist(x1-x2,y1-y2) + dist(x1-x3,y1-y3);
    double pdist = dist(xp-x1,yp-y1) + dist(xp-x3,yp-y2) + dist(xp-x3,yp-y3);
    int res = (cdist > pdist)?0:1;
    cout<<mes[res]<<endl;
  }
  
  return 0;
}