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

class Point2d {
private:
	double x, y;
public:
	void set(double x, double y) { this->x = x; this->y = y; }
	double X() { return this->x; }
	double Y() { return this->y; }
	Point2d operator+(Point2d &p) {
		Point2d result;
		result.set(this->x + p.X(), this->y + p.Y());
		return result;
	}
	Point2d operator-(Point2d &p) {
		Point2d result;
		result.set(this->x - p.X(), this->y - p.Y());
		return result;
	}
	Point2d operator*(double a) {
		Point2d result;
		result.set(this->x * a, this->y * a);
		return result;
	}
	/* ¼ü p1p2 Æüª q1q2 ªðíÁÄ¢êÎ true ðÔ· */
	static bool interectLine(Point2d &p1, Point2d &p2, Point2d &q1, Point2d &q2) {
		Point2d p = p2 - p1, pq1 = q1 - p1, pq2 = q2 - p1;
		double tmp1, tmp2, t1z;
		tmp1 = p.X() * pq1.Y() - p.Y() * pq1.X();	/* p Æ pq1 ÌOÏÌz¬ª */
		tmp2 = p.X() * pq2.Y() - p.Y() * pq2.X();	/* p Æ pq2 ÌOÏÌz¬ª */
		t1z = tmp1 * tmp2;	/* OÏÌü«ªá¦Î¼ü p1p2 Æüª q1q2 ÍðíÁÄ¢é */
		return t1z <= 0.;
	}
	/* üª p1p2 Æüª q1q2 ªðíÁÄêÎ true ðÔ·*/
	static bool interect(Point2d &p1, Point2d &p2, Point2d &q1, Point2d &q2) {
		return interectLine(p1, p2, q1, q2) && interectLine(q1, q2, p1, p2);
	}
};

int main() {
	using namespace std;
	double x[3], y[3], xp, yp, xq, yq;
	Point2d ptR[3], ptP, ptQ;
	int count;

	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp) {
		for (int i = 0; i < 3; ++i) {
			ptR[i].set(x[i], y[i]);
		}
		ptP.set(xp, yp);
		xq = x[0];
		for (int i = 1; i < 3; ++i) {
			if (x[i] > xq) { xq = x[i]; }
		}
		xq += (double)(rand() % 100 + 10) * 0.1;
		yq = yp + (double)((rand() % 100) - 50) * 0.1;
		ptQ.set(xq, yq);

		count = 0;
		for (int i = 0; i < 3; ++i) {
			if (Point2d::interect(ptP, ptQ, ptR[i], ptR[(i + 1) % 3])) {
				++count;
			}
		}
		cout << (((count & 1) != 0) ? "YES" : "NO") << endl;
	}
	return 0;
}

C++: 
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )


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

    vector<tuple<double, double, double>> zs;

    double x1, y1, x2, y2, x3, y3, xp, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double z1 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
        double z2 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
        double z3 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
        tuple<double, double, double> t(z1, z2, z3);
        zs.push_back(t);
    }

    for (auto z : zs) {
        if ((get<0>(z) > 0 && get<1>(z) > 0 && get<2>(z) > 0) || (get<0>(z) < 0 && get<1>(z) < 0 && get<2>(z) < 0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

struct TCoordinate
{
	double x;
	double y;
};

double GetCrossProduct(const TCoordinate& V1, const TCoordinate& V2)
{
	return V1.x * V2.y - V1.y * V2.x;
}

bool IsSameSide(const TCoordinate& T1, const TCoordinate& T2, const TCoordinate& L1, const TCoordinate& L2)
{
	TCoordinate VectorL1T1 = {T1.x - L1.x, T1.y - L1.y};
	TCoordinate VectorL1T2 = {T2.x - L1.x, T2.y - L1.y};
	TCoordinate VectorL1L2 = {L2.x - L1.x, L2.y - L1.y};
	double CrossProductT1 = GetCrossProduct(VectorL1T1, VectorL1L2);
	double CrossProductT2 = GetCrossProduct(VectorL1T2, VectorL1L2);
	if(CrossProductT1 * CrossProductT2 > 0){
		return true;
	}else{
		return false;
	}
}

int main()
{
	while(true){
		TCoordinate A1, A2, A3, Ap;
		cin >> A1.x >> A1.y >> A2.x >> A2.y >> A3.x >> A3.y >> Ap.x >> Ap.y;
		if(cin.eof() == true) break;
		if(IsSameSide(A3, Ap, A1, A2) && IsSameSide(A1, Ap, A2, A3) && IsSameSide(A2, Ap, A3, A1)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <complex>

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

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
				&x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)!=EOF) {
		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");
	}
	return 0;
}

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

typedef complex<double> point;

double gaiseki(point a,point b){
	return (a*conj(b)).imag();
}

int main(void){
	double x,y;
	while(cin>>x>>y){
		point a(x,y);
		cin>>x>>y;
		point b(x,y);
		cin>>x>>y;
		point c(x,y);
		cin>>x>>y;
		point p(x,y);
		if(gaiseki(b-a,p-a)>=0.0||gaiseki(c-b,p-b)>=0.0||gaiseki(a-c,p-c)>=0.0){
			cout<<"NO"<<endl;
			continue;
		}
		cout<<"YES"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
struct Point { long double px, py; };
Point Minus(Point a, Point b) { Point C; C.px = a.px - b.px; C.py = a.py - b.py; return C; }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int contain(vector<Point> v, Point p) {
	bool in = false;
	for (int i = 0; i < v.size(); ++i) {
		Point a = Minus(v[i], p), b = Minus(v[(i + 1) % v.size()], p);
		if (a.py > b.py) swap(a, b);
		if (a.py <= 0 && 0 < b.py)
			if (crs(a, b) < 0) in = !in;
		if (crs(a, b) == 0 && dot(a, b) <= 0) return 1;
	}
	return in ? 2 : 0;
}
int main() {
	vector<Point>vec;
	Point P;
	while (cin >> P.px >> P.py) {
		vec.clear();
		vec.push_back(P);
		for (int j = 0; j < 2; j++) { cin >> P.px >> P.py; vec.push_back(P); }
		cin >> P.px >> P.py;
		int v = contain(vec, P);
		if (v == 2) { cout << "YES" << endl; }
		else { cout << "NO" << endl; }
	}
}

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

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

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(std::cin >> x1){
		std::cin >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
		bool dir = (outer_product(xp - x1, yp - y1, x2 - x1, y2 - y1) > 0);
		if ( dir == (outer_product(xp - x2, yp - y2, x3 - x2, y3 - y2) > 0) &&
			dir == (outer_product(xp - x3, yp - y3, x1 - x3, y1 - y3) > 0) ) {
			std::cout << "YES" << std::endl;
		} else {
			std::cout << "NO" << std::endl;
		}
	}
}

C++: #include <iostream>
using namespace std;
double op(double x1,double y1,double x2,double y2){
	return x1*y2-x2*y1;
}

int main(){
	double x[4],y[4];
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){
		double op1 = op(x[1]-x[0],y[1]-y[0],x[3]-x[0],y[3]-y[0]);
		double op2 = op(x[2]-x[1],y[2]-y[1],x[3]-x[1],y[3]-y[1]);
		double op3 = op(x[0]-x[2],y[0]-y[2],x[3]-x[2],y[3]-y[2]);
		if(op1<=0.0 and op2<=0.0 and op3<=0.0) cout << "YES" << endl;
		else if(op1>=0.0 and op2>=0.0 and op3>=0.0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}