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;
typedef pair<double, double> P;

double CalcTriSquare(P p1, P p2, P p3)
{
	double a, b, c;
	double s;
	a = sqrt((p2.first - p1.first) * (p2.first - p1.first) + (p2.second - p1.second) * (p2.second - p1.second));
	b = sqrt((p3.first - p1.first) * (p3.first - p1.first) + (p3.second - p1.second) * (p3.second - p1.second));
	c = sqrt((p3.first - p2.first) * (p3.first - p2.first) + (p3.second - p2.second) * (p3.second - p2.second));
	s = (a + b + c) / 2;
	return(sqrt(s * (s - a) * (s - b) * (s - c)));
}

void solve()
{
	P p[4];
	while(cin >> p[0].first >>p[0].second >> p[1].first >> p[1].second >> p[2].first >> p[2].second >> p[3].first >> p[3].second)
	{
		double sum = 0;
		sum += CalcTriSquare(p[0], p[1], p[3]);
		sum += CalcTriSquare(p[0], p[2], p[3]);
		sum += CalcTriSquare(p[1], p[2], p[3]);
		double square = CalcTriSquare(p[0], p[1], p[2]);
		if(fabs(sum - square) < 0.001)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <assert.h>
using namespace std;
typedef  struct{
	double x,y;
}coord;

int main(){
	coord  vPolygon[3],pPoint;
	while(cin >> vPolygon[0].x >> vPolygon[0].y){
		for (int i=1;i<3;i++) cin >> vPolygon[i].x >> vPolygon[i].y;
		cin >> pPoint.x >> pPoint.y;
		int count= 0;
		for (int i=0;i<3;i++){
			if ( ((vPolygon[i%3].y <= pPoint.y)&&(pPoint.y < vPolygon[(i+1)%3].y))
				|| ((vPolygon[(i+1)%3].y <= pPoint.y)&&(pPoint.y < vPolygon[i%3].y)) ){
				double vt = (pPoint.y - vPolygon[i%3].y)/(vPolygon[(i+1)%3].y - vPolygon[i%3].y);
			if (pPoint.x < vPolygon[i%3].x + ( vt * ( vPolygon[(i+1)%3].x - vPolygon[i%3].x) )){
				++count;
			}
		}
	}
	cout << ((count&1)?"YES":"NO") << endl;
}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

double cross (double x1, double y1, double x2, double y2 )
{
	return (x1*y2 - x2*y1 );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.APT", "r", stdin );
	string str = "";
	while (getline (cin, str ) && !str.empty() ){
		stringstream ss (str );
		double x1, y1, x2, y2, x3, y3, xp, yp;
		ss >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
		double c1 = cross (xp - x1, yp - y1 , x2 - x1, y2 - y1 );
		double c2 = cross (xp - x2, yp - y2 , x3 - x2, y3 - y2 );
		double c3 = cross (xp - x3, yp - y3 , x1 - x3, y1 - y3 );
		if ((c1 > 0. && c2 > 0. && c3 > 0. ) || (c1 < 0. && c2 < 0. && c3 < 0. ) ){
			printf ("YES\n" );
		}else{
			printf ("NO\n" );
		} // end if
	} // end while

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
    double x[3],y[3],px,py;
    while(cin>>x[0]>>y[0]){
        for(int i=1;i<3;i++)cin>>x[i]>>y[i];
        cin>>px>>py;
        bool ok=true;
        for(int i=0;i<3;i++){
            bool plus=false;
            if(x[(i+1)%3]==x[(i+2)%3]){
                if(x[i]>x[(i+1)%3])plus=true;
            }
            else{
                double a,b;
                a=(x[i]-x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
                b=(y[i]-y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
                if(a>b)plus=true;
            }
            bool pnt=false;
            if(x[(i+1)%3]==x[(i+2)%3]){
                if(px>x[(i+1)%3])pnt=true;
            }
            else{
                double a,b;
                a=(px-x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
                b=(py-y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
                if(a>b)pnt=true;
            }
            if(pnt!=plus)ok=false;
        }
        if(ok)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

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

class Vector2{
public:
	Vector2(){}
	Vector2( double aX, double aY ) : x( aX ), y( aY ){}

	double dot( Vector2& a ){
		return ( x * a.x ) + ( y * a.y );
	}

	double x;
	double y;
};


int main(){
	Vector2 p0, p1, p2, q;

	while ( cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> q.x >> q.y ){
		bool isInner = false;
		Vector2 a( p1.x - p0.x, p1.y - p0.y );
		Vector2 b( p2.x - p0.x, p2.y - p0.y );
		Vector2 c( q.x - p0.x, q.y - p0.y );

		double aa = a.dot( a );
		double ab = a.dot( b );
		double ac = a.dot( c );
		double bb = b.dot( b );
		double bc = b.dot( c );

		double s = ( bc*ab - ac*bb ) / ( ab*ab - aa*bb );
		if ( ( s > 0.0 ) && ( s < 1.0 ) ){
			double t = ( ac*ab - bc*aa ) / ( ab*ab - aa*bb );
			if ( ( t > 0.0 ) && ( s + t < 1.0 ) ){
				isInner = true;
			}
		}

		cout << ( isInner ? "Yes" : "No" ) << endl;
	}


	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    double x1, y1, x2, y2, x3, y3, xp, yp;
	
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		/*
		if( ((x1-x2)*yp-xp*(y1-y2))>0 && ((x2-x3)*yp-xp*(y2-y3))>0 && ((x3-x1)*yp-xp*(y3-y1))>0 ){
			cout<<"YES"<<endl;
		}else if( ((x1-x2)*yp-xp*(y1-y2))<0 && ((x2-x3)*yp-xp*(y2-y3))<0 && ((x3-x1)*yp-xp*(y3-y1))<0 ){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		*/
		
		if( (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1) >0 && (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2) >0 && (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3) >0 ){
			cout << "YES" << endl;
		}else if( (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1) <0 && (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2) <0 && (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3) <0 ){
			cout << "YES" << endl;
		}else{
			cout <<"NO" <<endl;
		}
	}
	return 0;
}

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

double helon(double x1,double y1,double x2,double y2,double x3,double y3){
	double a,b,c,s,area;
	a = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	b = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	c = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
	s = (a+b+c)/2;
	area = sqrt(s*(s-a)*(s-b)*(s-c));
	return area;
}

int main(){
	double e=0.0000001;
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double s,s1,s2,s3;
		s = helon(x1,y1,x2,y2,x3,y3);
		s1 = helon(xp,yp,x1,y1,x2,y2);
		s2 = helon(xp,yp,x2,y2,x3,y3);
		s3 = helon(xp,yp,x3,y3,x1,y1);
		//cout<<s<<" "<<s1<<" "<<s2<<" "<<s3<<endl;
		if(s1==0 || s2==0 || s3==0)
			cout<<"NO"<<endl;
		else if(abs(s-(s1+s2+s3))<e)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
	}
	return 0;
}