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 <math.h>
using namespace std;

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double d_12, d_13, d_23, d_p1, d_p2, d_p3;
	double t1, t2, t3, t4, s1, s2, s3, s4;
	
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		
		d_12 = sqrt(pow((x2-x1), 2)+pow((y2-y1), 2));
		d_13 = sqrt(pow((x3-x1), 2)+pow((y3-y1), 2));
		d_23 = sqrt(pow((x3-x2), 2)+pow((y3-y2), 2));
		
		d_p1 = sqrt(pow((xp-x1), 2)+pow((yp-y1), 2));
		d_p2 = sqrt(pow((xp-x2), 2)+pow((yp-y2), 2));
		d_p3 = sqrt(pow((xp-x3), 2)+pow((yp-y3), 2));
		
		t1 = (d_12 + d_p1 + d_p2) / 2;
		t2 = (d_13 + d_p1 + d_p3) / 2;
		t3 = (d_23 + d_p2 + d_p3) / 2;
		t4 = (d_12 + d_13 + d_23) / 2;
		
		s1 = sqrt(t1*(t1-d_12)*(t1-d_p1)*(t1-d_p2));
		s2 = sqrt(t2*(t2-d_13)*(t2-d_p1)*(t2-d_p3));
		s3 = sqrt(t3*(t3-d_23)*(t3-d_p2)*(t3-d_p3));
		s4 = sqrt(t4*(t4-d_12)*(t4-d_13)*(t4-d_23));
		
		if(fabs((s1+s2+s3)-s4) < 1.0E-10){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
    return 0;
}

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

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double sall = (x1-x2)*(y1+y2) + (x2-x3)*(y2+y3) + (x3-x1)*(y3+y1);
		double s1 = (x1-x2)*(y1+y2) + (x2-xp)*(y2+yp) + (xp-x1)*(yp+y1);
		double s2 = (x1-xp)*(y1+yp) + (xp-x3)*(yp+y3) + (x3-x1)*(y3+y1);
		double s3 = (xp-x2)*(yp+y2) + (x2-x3)*(y2+y3) + (x3-xp)*(y3+yp);
		sall = sall < 0 ? -1*sall : sall;
		s1 = s1 < 0 ? -1*s1 : s1;
		s2 = s2 < 0 ? -1*s2 : s2;
		s3 = s3 < 0 ? -1*s3 : s3;
		// ½Ì©fabsÆ©absªstdilib.hÆ©CN[hµÄàg¦È¢
		if(sall == s1+s2+s3){
			cout<<"YES"<<endl;
		} else {
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>
#define out(x1,y1,x2,y2) x1 * y2 - x2 * y1

int main(void){
	double x[3], y[3], xp, yp;
	int i;
	for(i = 0;i < 3;i++)
		scanf("%lf%lf",&x[i],&y[i]);
	scanf("%lf%lf",&xp,&yp);
	if((out(xp - x[0],yp - y[0],x[1] - x[0],y[1] - y[0]) > 0 && out(xp - x[0],yp - y[0],x[2] - x[0],y[2] - y[0]) > 0 && out(xp - x[1],yp - y[1],x[2] - x[1],y[2] - y[1]) > 0) ||out(xp - x[0],yp - y[0],x[1] - x[0],y[1] - y[0]) < 0 && out(xp - x[0],yp - y[0],x[2] - x[0],y[2] - y[0]) < 0 && out(xp - x[1],yp - y[1],x[2] - x[1],y[2] - y[1]) < 0)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct pos{
	double x;
	double y;
};
int main() {
	vector<pos> point(4);
	while (cin >> point[0].x >> point[0].y >> point[1].x >> point[1].y >> point[2].x >> point[2].y >> point[3].x >> point[3].y){
		bool yes = true;
		REP(j, 3){
			double cross = (point[(j + 1) % 3].x - point[(j) % 3].x)*(point[3].x - point[(j) % 3].x) + (point[(j + 1) % 3].y - point[(j) % 3].y)*(point[3].y - point[(j) % 3].y);
			if (cross <= 0){
				yes = false;
			}
		}
		if (yes)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#define mul(s, t) ((s-t)*(s-t))

using namespace std;

int main()
{
	double x[3], y[3], u[2], s, t, v;
	
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> s >> t){
		bool f = true;
		for(int i = 0; i < 3; i++){
			int p = 0;
			for(int j = 0; j < 3; j++){
				if(i != j){
					u[p++] = sqrt(mul(x[i], x[j])+mul(y[i], y[j]));
				}
			}
			v = sqrt(mul(x[i], s)+mul(y[i], t));
			
			if(u[0] =< v || u[1] =< v){
				f = false;
				break;
			}
		}
		cout << ((f)? "YES" : "NO") << endl;
	}
	
	return 0;
}

C++: /* 
3点A(x1, y1),B(x2, y2),C(x3, y3)で囲まれた3角形の内部に
P(xp, yp)が含まれるかどうかを判定
*/

#include <iostream>
using namespace std;

int main(void) {
    double x1, x2, x3, y1, y2, y3;
    double xp, yp;
    double ABAP, BCBP, CACP;
// ABとAP,BCとBP,CAとCPの傾きの大小関係を条件式に用いる。
// 不等式の両辺に負の数を掛けると大小関係が入れ替わることに注意。
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        ABAP = (y2 - y1)*(xp - x1) - (x2 - x1)*(yp - y1);
        BCBP = (y3 - y2)*(xp - x2) - (x3 - x2)*(yp - y2);
        CACP = (y1 - y3)*(xp - x3) - (x1 - x3)*(yp - y3);
        if((ABAP > 0 && BCBP > 0 && CACP > 0) ||(ABAP < 0 && BCBP < 0 && CACP < 0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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


#define EPSILON 1e-9
 
 
class vector_t {
public:
  double x;
  double y;
  double z;
 
public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};
 
public:
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
};
 
 
class point_t {
public:
  double x;
  double y;
  double z;
  double w;
 
public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};
   
public:
  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };
};
 
 
class point_triangle_intersect : public std::unary_function<point_t, bool> {
public:
  point_triangle_intersect(const point_t& p1,
                           const point_t& p2,
                           const point_t& p3) :
    p1_(p1), p2_(p2), p3_(p3), s_(((p2 - p1) ^ (p3 - p1)).z)
  {
  };
 
public:
  bool operator()(const point_t& p) const {
    double u = ((p1_ - p3_) ^ (p - p3_)).z / s_;
    double v = ((p2_ - p1_) ^ (p - p1_)).z / s_;

    return (u >= 0 && v >= 0 && u + v <= 1.0 + EPSILON);
  };
 
private:
  point_t p1_;
  point_t p2_;
  point_t p3_;

  double s_;
};
 
 
int main(int argc, char** argv)
{
  double x1, y1, x2, y2, x3, y3, xp, yp;
 
  while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    point_t p1(x1, y1);
    point_t p2(x2, y2);
    point_t p3(x3, y3);
    point_t p (xp, yp);
 
    if (point_triangle_intersect(p1, p2, p3)(p)) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }
  }
}