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>
#include <cmath>

using namespace std;

#define EPS 1e-5

double heron(double a,double b,double c){
      double s = (a + b + c) / 2;

      return sqrt(s * (s - a) * (s - b) * (s - c));
}

int main() {
    double x[3],y[3],xp,yp,a,b,c,d,e,f,sq,sqd,sqe,sqf;
    
    while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
        a = sqrt(pow((x[1] - x[0]),2) + pow((y[1] - y[0]),2));
        b = sqrt(pow((x[2] - x[0]),2) + pow((y[2] - y[0]),2));
        c = sqrt(pow((x[2] - x[1]),2) + pow((y[2] - y[1]),2));

        sq = heron (a,b,c);

        d = sqrt(pow((xp - x[0]),2) + pow((yp - y[0]),2));
        e = sqrt(pow((xp - x[1]),2) + pow((yp - y[1]),2));
        f = sqrt(pow((xp - x[2]),2) + pow((yp - y[2]),2));

        sqd = heron(e,a,d);
        sqe = heron(d,b,f);
        sqf = heron(f,c,e);
        
        if(sqd == 0 || sqe == 0 || sqf == 0){
             cout << "NO" << endl;
             return 0;
         }
        
         if(abs(sq - (sqd + sqe + sqf)) < EPS){
            cout << "YES" << endl;
            
        }
        else {
            cout << "NO" << endl;
        }
    }

    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*1000)-(int)((sa+sb+sc)*1000)==0) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    return 0;
}

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

int sign(float n){
	if(n < 0)return -1;
	else if(n > 0)return 1;
	return 0;
}

float angle(float ax, float ay, float bx, float by, float cx, float cy){
    //angle between ab and ac
    float ab = atan2(by-ay,bx-ax);
    float ac = atan2(cy-ay,cx-ax);
    if(ab < 0)ab += 2*M_PI;
    if(ac < 0)ac += 2*M_PI;
    float ang = ac - ab;
    return (fabs(ang) < M_PI ? ang : -sign(ang) * 2 * M_PI + ang) * 180 / M_PI;
}

bool isPointInPolygon(complex< float > a, vector< complex< float > > p){
	int n = p.size();
	float sum = 0;
	
	for(int i = 0; i < n; ++i){
		sum += angle(a.real(), a.imag(), p[i].real(), p[i].imag(), p[(i+1)%n].real(), p[(i+1)%n].imag());
	}
	
	if(sum >= 300){ //if sum is 360
		return true;
	}
	return false; //if sum is 0
}

int main(){
	float x1, y1, x2, y2, x3, y3 , xp, yp;
	vector< complex< float > > triangle;
	complex< float > point;
	
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		point = complex< float >(xp, yp);
		triangle.push_back(complex< float >(x1, y1));
		triangle.push_back(complex< float >(x2, y2));
		triangle.push_back(complex< float >(x3, y3));
		
		if(isPointInPolygon(point, triangle))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iterator>
#include<math.h>
#define debug() puts("what the fuck")
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
int main()
{
    double ax,ay,bx,by,cx,cy,px,py,mx,my,nx,ny,a1x,a1y,b1x,b1y,c1x,c1y;
    while(cin>>ax>>ay>>bx>>by>>cx>>cy>>px>>py)
    {
        mx=bx-ax;my=by-ay;
        nx=cx-ax;ny=cy-ay;
        a1x=ax-px;a1y=ay-py;
        b1x=bx-px;b1y=by-py;
        c1x=cx-px;c1y=cy-py;
        if(abs(abs(mx*ny-my*nx)-(abs(a1x*b1y-b1x*a1y)+abs(a1x*c1y-c1x*a1y)+abs(c1x*b1y-b1x*c1y)))<=1e-6)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }

    return 0;
}

C++: #include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

bool isAbove(pair<double, double> p1, pair<double, double> p2, pair<double, double> p3) {
	if (p1.first == p2.first) {
		return p3.first > p1.first;
	} else {
		return p3.second > p1.second + (p2.second - p1.second) * (p3.first - p1.first) / (p2.first - p1.first);
	}
}

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	vector<pair<double, double>> vertices(4);
	while (cin >> vertices[0].first) {
		cin >> vertices[0].second;
		rep(i, 3) cin >> vertices[i + 1].first >> vertices[i + 1].second;

		bool flag = (isAbove(vertices[0], vertices[1], vertices[2]) == isAbove(vertices[0], vertices[1], vertices[3]));
		flag &= (isAbove(vertices[0], vertices[2], vertices[1]) == isAbove(vertices[0], vertices[2], vertices[3]));
		flag &= (isAbove(vertices[1], vertices[2], vertices[0]) == isAbove(vertices[1], vertices[2], vertices[3]));

		cout << (flag ? "YES" : "NO") << endl;
	}


}




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	solve();
	system("PAUSE");
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#define EPS 1e-10
using namespace std;

int main(){
  double x1,x2,x3,xp,y1,y2,y3,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    double A = sqrt(pow(x1-x2,2)+pow(y1-y2,2)),B = sqrt(pow(x2-x3,2)+pow(y2-y3,2)), C = sqrt(pow(x1-x3,2)+pow(y1-y3,2)) ;
    double s = (A+B+C)/2.0;
    double S = sqrt(s*(s-A)*(s-B)*(s-C));
 
   double A12 = sqrt(pow(x1-x2,2)+pow(y1-y2,2)),B1p =sqrt(pow(x1-xp,2)+pow(y1-yp,2)), C2p = sqrt(pow(xp-x2,2)+pow(yp-y2,2)) ;
    double s2 = (A12+B1p+C2p)/2.0;
    double S2 = sqrt(s2*(s2-A12)*(s2-B1p)*(s2-C2p));
    /*
    if(S2 == 0){
      cout << "NO" << endl;
      break;
    }
    */
    double A13 = sqrt(pow(x1-x3,2)+pow(y1-y3,2)), Cp3 = sqrt(pow(xp-x3,2)+pow(yp-y3,2));
    double s3 = (A13+B1p+Cp3)/2.0;
    double S3 =  sqrt(s3*(s3-A13)*(s3-B1p)*(s3-Cp3));
    /*
    if(s3 == 0){
      cout << "NO" << endl;
      break;
    }
    */
    double A23 = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
    double s4 = (A23+C2p+Cp3)/2.0;
    double S4 =  sqrt(s4*(s4-A23)*(s4-C2p)*(s4-Cp3));
    /*
    if(S3 == 0){
      cout << "NO" << endl;
      break;
    }
    */
    double Ssum = S2+S3+S4;
    
    fabs(Ssum - S)< EPS?cout << "YES" << endl:cout << "NO" << endl;


  }
  return 0;
}