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;

int gaiseki(double,double,double,double,double,double);

int main() {
	double x[4],y[4];
	int n[3],ans;
	while ( cin >> x[0] ) {
		cin >> y[0];
		for ( int i = 1; i < 4; i++ ) {
			cin >> x[i] >> y[i];
		}
		//三角形の各辺の外積(求めたい点と始点、求めたい点と終点との外積)を取り、全て右か左だったら中に含まれる
		for ( int i = 0; i < 2; i++ ) 
			n[i] = gaiseki(x[i],y[i],x[i + 1],y[i + 1],x[3],y[3]);
		n[2] = gaiseki(x[2],y[2],x[0],y[0],x[3],y[3]);
		
		ans = 0;
		for ( int i = 0; i < 3; i++ ){
			ans += n[i];
		}
		
		if ( ans == 3 || ans == -3 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

int gaiseki(double x1,double y1,double x2,double y2,double xp,double yp) {
	double ans;
	ans =  xp * ( y1 - y2 ) + x1 * ( y2 - yp ) + x2 * ( yp - y1 );
	if ( ans > 0 ) return 1; //右側
	else return 0; //左側(＝だと線上だが、今回は考えなくて良い)
}

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

int main() {
double x1, y1, x2, y2, x3, y3, xp ,yp,ss,s1,s2,s3;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
ss=fabs((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1));
s1=fabs((x3-xp)*(y2-yp)-(x2-xp)*(y3-yp));
s2=fabs((x3-xp)*(y1-yp)-(x1-xp)*(y3-yp));
s3=fabs((x2-xp)*(y1-yp)-(x1-xp)*(y2-yp));

if(fabs(s1+s2+s3-ss)<0.001){
	cout<<"YES"<<endl;
}
else{
	cout<<"NO"<<endl;
}}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void) {
	double x[3] = { 0,0,0 };
	double y[3] = { 0,0,0 };
	double xp = 0, yp = 0;
	int flag[3] = { 0,0,0 };

	while (cin >> x[0]>> y[0]>> x[1]>> y[1]>> x[2]>> y[2]>> xp>> yp) {
		for (int i = 0; i < 3; i++) {
			int temp1 = (i + 1) % 3;
			int temp2 = (i + 2) % 3;
			double checkI = (y[temp1] - y[i]) * (x[temp2] - x[i]) + (x[temp1] - x[i]) * (y[temp2] - y[i]);
			double checkP = (y[temp1] - y[i]) * (xp - x[i]) + (x[temp1] - x[i]) * (yp - y[i]);

			if (checkI * checkP > 0) {
				flag[i] = 1;
			}
		}
		if (flag[0] == 1 && flag[1] == 1 && flag[2] == 1) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
		flag[0] = 0;
		flag[1] = 0;
		flag[2] = 0;
	}
	

	return 0;
}

C++: #include <cstdio>

int main(){
  double x[4],y[4],s[3];
  while(1){
    for(int i=0; i<4; i++)
      if(scanf("%lf %lf",&x[i],&y[i]) == EOF)
	goto outer;

    for(int i=0; i<3; i++){
      int j=(i+1)%3;
      s[i] = (x[i]-x[j])*(y[j]-y[3])-(y[i]-y[j])*(x[j]-x[3]);
    }

    if((s[0]>0&&s[1]>0&&s[2]>0)||(s[0]<0&&s[1]<0&&s[2]<0))
      printf("YES\n");
    else
      printf("NO\n");
  }
 outer: ;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string.h>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

double x[5];
double y[5];

int main()
{
	while (cin >> x[0] >> y[0]) {
		for (int i = 1; i < 4; i++) {
			cin >> x[i] >> y[i];
		}

		double abc = fabs((x[1] - x[0])*(y[2] - y[0]) - (x[2] - x[0])*(y[1] - y[0]));
		double pab = fabs((x[0] - x[3])*(y[1] - y[3]) - (x[1] - x[3])*(y[0] - y[3]));
		double pbc = fabs((x[1] - x[3])*(y[2] - y[3]) - (x[2] - x[3])*(y[1] - y[3]));
		double pca = fabs((x[2] - x[3])*(y[0] - y[3]) - (x[0] - x[3])*(y[2] - y[3]));

		if (fabs(abc - pab - pbc - pca) < EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp, a, b, c, d, e, f, s1, s2, s3,s4, S1, S2, S3,S4;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		a = pow((pow(x1 - xp, 2) + pow(y1 - yp, 2)), 1.0 / 2);
		b = pow((pow(x2 - xp, 2) + pow(y2 - yp, 2)), 1.0 / 2);
		c = pow((pow(x3 - xp, 2) + pow(y3 - yp, 2)), 1.0 / 2);
		d = pow((pow(x2 - x3, 2) + pow(y2 - y3, 2)), 1.0 / 2);
		e = pow((pow(x1 - x3, 2) + pow(y1 - y3, 2)), 1.0 / 2);
		f = pow((pow(x1 - x2, 2) + pow(y1 - y2, 2)), 1.0 / 2);
		s1 = (b + c + d) / 2;
		s2 = (a + c + e) / 2;
		s3 = (a + b + f) / 2;
		s4 = (d + e + f) / 2;
		S1 = pow(s1*(s1 - b)*(s1 - c)*(s1 - d), 1.0 / 2);
		S2 = pow(s2*(s2 - a)*(s2 - c)*(s2 - e), 1.0 / 2);
		S3 = pow(s3*(s3 - a)*(s3 - b)*(s3 - f), 1.0 / 2);
		S4 = pow(s4*(s4 - d)*(s4 - e)*(s4 - f), 1.0 / 2);
		if ((S4+0.001>S1+S2+S3)&&(S1 + S2 + S3 > S4-0.001)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
double area_3point(double x1,double y1,double x2,double y2,double x3,double y3);
int main(){
        while(1){               
                double x1,y1,x2,y2,x3,y3,xp,yp;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
                if(cin.eof()) break;
		double s,s1,s2,s3;  
                s=area_3point(x1,y1,x2,y2,x3,y3);
 		s1= area_3point(x1,y1,x2,y2,xp,yp);
		s2=area_3point(x1,y1,xp,yp,x3,y3);               
  		s3=area_3point(xp,yp,x2,y2,x3,y3);  
                if(s<(s1+s2+s3-0.0000001)){ 
                       cout<<"NO"<<endl;
                }else {     
                        cout<<"YES"<<endl; }        
        }
        return 0;
}

double area_3point(double x1,double y1,double x2,double y2,double x3,double y3){
     double s,a,b,c,area;
     a = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
     b = sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
     c = sqrt((x3-x1)*(x3-x1) + (y3-y1)*(y3-y1));
     s=(a+b+c)/2.0;
     area=sqrt(s*(s-a)*(s-b)*(s-c));

     return area;
}

C++: #include <iostream>
#include <vector>
#include <limits>
using namespace std;
struct Point
{
	Point() :x(0.0), y(0.0) {}
	Point(double _x, double _y) : x(_x), y(_y) {}
	double x;
	double y;
};
bool HalfPlaneTest(const Point& P1, const Point& P2, const Point& P)
{
	return ((P2.y - P1.y) * P.x - (P2.x - P1.x) * P.y + (P2.x * P1.y - P1.x * P2.y)) > 0;
}
struct Triangle
{
	Triangle() : minX(DBL_MAX), maxX(DBL_MIN), minY(DBL_MAX), maxY(DBL_MIN) {}
	void add(double x, double y) {
		vP.push_back(Point(x, y));
		if (x < minX) minX = x;
		if (x > maxX) maxX = x;
		if (y < minY) minY = y;
		if (y > maxY) maxY = y;
		if (vP.size() == 3){
			if (HalfPlaneTest(vP[0], vP[1], vP[2]))
				swap(vP[1], vP[2]);
		}
	}
	bool IsInclude(double x, double y){
		if (x <= minX || x >= maxX || y <= minY || y >= maxY)
			return false;
		Point p(x, y);
		if (HalfPlaneTest(vP[0], vP[1], p)) return false;
		if (HalfPlaneTest(vP[1], vP[2], p)) return false;
		if (HalfPlaneTest(vP[2], vP[0], p)) return false;
		return true;
	}
	vector<Point> vP;
	double minX;
	double maxX;
	double minY;
	double maxY;
};

int main()
{
	double x1, y1, x2, y2, x3, y3, x, y;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y){
		Triangle triangle;
		triangle.add(x1, y1);
		triangle.add(x2, y2);
		triangle.add(x3, y3);
		if (triangle.IsInclude(x, y))	cout << "YES\n";
		else							cout << "NO\n";
	}
	return 0;
}