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 <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

bool ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		vector<double> x(3),y(3);
		rep(i,3)
			iss>>x[i]>>y[i];
		double xp,yp;
		iss>>xp>>yp;
		
		bool in_triangle=true;
		rep(i,3){
			if(ccw(x[0],y[0],x[1],y[1],xp,yp)!=ccw(x[1],y[1],x[2],y[2],xp,yp))
				in_triangle=false;
			rotate(x.begin(),x.begin()+1,x.end());
			rotate(y.begin(),y.begin()+1,y.end());
		}
		
		cout<<(in_triangle?"YES":"NO")<<endl;
	}
	
	return 0;
}

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

bool hantei( double x1, double y1, double x2, double y2, double x3, double y3 ) {
  if ( (x1-x2)*(y3-y2) > (y1-y2)*(x3-x2) ) return true;
  return false;
}

int main() {

  double x1,y1,x2,y2,x3,y3,xp,yp;

  while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ) {

    for ( int i = 0; i < 3; i++ ) {
      if ( hantei( x1, y1, x2, y2, x3, y3 ) != hantei( x1, y1, x2, y2, xp, yp ) ) {
	cout << "NO" << endl;
	break;
      }
      if ( i != 2 ) {
	double k;
	k = x1;
	x1 = x2;
	x2 = x3;
	x3 = k;
	k = y1;
	y1 = y2;
	y2 = y3;
	y3 = k;
      }else {
	cout << "YES" << endl;
      }
    }

  }

  return 0;

}

C++: #include<cstdio>
#include<cmath>

double getd(double x, double y){
	double r = atan2(y, x) * 180 / M_PI;
	return r;
}

int main(){
	printf("%lf\n", getd(2,4));
	printf("%lf\n", getd(-1,0));
	printf("%lf\n", getd(2,2));
	printf("%lf\n", getd(2,-2));
	printf("%lf\n", getd(-2,-2));
	printf("%lf\n", getd(-2,2));
	

	double x1,y1,x2,y2,x3,y3,xp,yp,d1,d2,d3;
	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;
		d1 = getd(x1,y1);
		d2 = getd(x2,y2);
		d3 = getd(x3,y3);
		if(d1 > d2){
			h = d1;
			d1 = d2;
			d2 = h;
		}
		if(d2 > d3){
			h = d2;
			d2 = d3;
			d3 = h;
			if(d1 > d2){
				h = d1;
				d1 = d2;
				d2 = h;
			}
		}
		d2 -= d1;
		d3 -= d1;
		if(180 > d2){
			if(180 < d3 && d3 < d2 + 180){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;
const static int	de_MIN = -999999999;

struct VECTOR {
	double x;
	double y;
	double z;
};

inline VECTOR RelativePositionVector(const VECTOR A, const VECTOR B) {

	VECTOR v;
	v.x = B.x - A.x;
	v.y = B.y - A.y;
	v.z = B.z - A.z;

	return(v);

}

inline VECTOR CrossProduct(const VECTOR A,const VECTOR B) {

	VECTOR v;
	v.x = A.y*B.z - A.z*B.y;
	v.y = A.z*B.x - A.x*B.z;
	v.z = A.x*B.y - A.y*B.x;

	return(v);

}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	VECTOR A, B, C, P;
	A.z = B.z = C.z = P.z = 0;
	std::vector<std::string> ans;

	while (std::cin >> A.x) {

		std::cin >> A.y >> B.x >> B.y >> C.x >> C.y >> P.x >> P.y;
		
		VECTOR AB = RelativePositionVector(A, B);
		VECTOR AP = RelativePositionVector(A, P);
		VECTOR BC = RelativePositionVector(B, C);
		VECTOR BP = RelativePositionVector(B, P);
		VECTOR CA = RelativePositionVector(C, A);
		VECTOR CP = RelativePositionVector(C, P);

		VECTOR ABxAP = CrossProduct(AB, AP);
		VECTOR BCxBP = CrossProduct(BC, BP);
		VECTOR CAxCP = CrossProduct(CA, CP);

		if (ABxAP.z > 0 && BCxBP.z > 0 && CAxCP.z > 0) {
			ans.push_back("YES");
		}
		else if (ABxAP.z < 0 && BCxBP.z < 0 && CAxCP.z < 0) {
			ans.push_back("YES");
		}
		else {
			ans.push_back("NO");
		}
	}

	for (unsigned int i = 0; i < ans.size(); i++) {
		std::cout << ans[i] << std::endl;
	}

}

C++: #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

class vector2d
{
public:
	vector2d(float vx, float vy) : x(vx), y(vy)
	{}
	void normalize()
	{
		float n = sqrt(x*x + y*y);
		x /= n;
		y /= n;	
	}
public:
	float x,y;
};

float dot(vector2d& v1, vector2d& v2)
{
	return v1.x*v2.x + v1.y*v2.y;
}

float cross(vector2d& v1, vector2d& v2)
{
	return v1.x*v2.y - v2.x*v1.y;
}

int main(int argc, char const *argv[])
{
	float x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF)
	{
		float miny = (y1 < y2) ? y1 : y2;
		miny = (miny < y3) ? miny : y3;
		if (miny == y2)
		{
			swap(x2, x1);
			swap(y2, y1);
		}
		else if (miny == y3)
		{
			swap(x3, x1);
			swap(y3, y1);
		}
		vector2d v1(x2-x1,y2-y1); v1.normalize();
		vector2d v2(x3-x1,y3-y1); v2.normalize();
		vector2d ve(1.0,0.0);
		bool ans = true;
		vector2d vp1(xp-x1,yp-y1);
		vector2d vp2(xp-x2,yp-y2);
		vector2d vp3(xp-x3,yp-y3);
		if (dot(ve,v1) < dot(ve,v2))
		{
			vector2d v2(x3-x2,y3-y2);
			vector2d v3(x1-x3,y1-y3);
			ans &= cross(v1, vp1) < 0;
			ans &= cross(v2, vp2) < 0;
			ans &= cross(v3, vp3) < 0;
		}
		else
		{
			vector2d v1(x3-x1,y3-y1);
			vector2d v2(x1-x2,y1-y2);
			vector2d v3(x2-x3,y2-y3);
			ans &= cross(v1, vp1) < 0;
			ans &= cross(v2, vp2) < 0;
			ans &= cross(v3, vp3) < 0;
		}
		if (ans)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: // http://www.sousakuba.com/Programming/gs_hittest_point_triangle.html
#include <iostream>
using namespace std;
bool solve(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp){
	double z1, z2, z3;
	z1 = (xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1);
	z2 = (xp - x2) * (y3 - y2) - (yp - y2) * (x3 - x2);
	z3 = (xp - x3) * (y1 - y3) - (yp - y3) * (x1 - x3);
	if(z1 > 0 && z2 > 0 && z3 > 0) return 1;
	else if(z1 < 0 && z2 < 0 && z3 < 0) return 1;
	else return 0;
}

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