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;

bool judge(double x1, double y1, double x2, double y2, double xp, double yp){
    double vecx = x2 - x1;
    double vecy = y2 - y1;
    double inner = vecx * xp + vecy * yp;
    if (inner > 0 ){
        return true;
    }else{
        return false;
    }
}

int main()
{
    double x1, x2, x3, xp, y1, y2 ,y3, yp;
    while (cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
        bool a, b, c;
        a = judge(x1, y1, x2, y2, xp, yp);
        b = judge(x1, y1, x3, y3, xp, yp);
        c = judge(x2, y2, x3, y3, xp, yp);
        if ((a == b) && (a == c) && (b == c)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
        
    }
 
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],m[2][2],inv[2][2],det,ans[2],s,t;
  while(cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>ans[0]>>ans[1]){
    b[0]-=a[0];
    b[1]-=a[1];
    c[0]-=a[0];
    c[1]-=a[1];
    ans[0]-=a[0];
    ans[1]-=a[1];
    m[0][0] = b[0];
    m[1][0] = c[0];
    m[0][1] = b[1];
    m[1][1] = c[1];
    det = m[0][0]*m[1][1]-m[1][0]*m[0][1];
    inv[0][0] = m[1][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][1] = m[0][0]/det;
    s = ans[0]*inv[0][0]+ans[1]*inv[1][0];
    t = ans[0]*inv[0][1]+ans[1]*inv[1][1];
    if(s>0 && t>0 && s+t<1){cout <<"YES\n";}
    else{cout <<"NO\n";}
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
bool judge_Cross(int, int,int,int);

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double pax = x1 - xp;
		double pay = y1 - yp;
		double pbx = x2 - xp;
		double pby = y2 - yp;
		double pcx = x3 - xp;
		double pcy = y3 - yp;

		if ((judge_Cross(pax, pay, pbx, pay) && judge_Cross(pbx, pby, pcx, pcy) && judge_Cross(pax, pay, pcx, pcy)) ||
			!((judge_Cross(pax, pay, pbx, pay) || judge_Cross(pbx, pby, pcx, pcy) || judge_Cross(pax, pay, pcx, pcy)))) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

bool judge_Cross(int x1,int y1,int x2,int y2) {
	if (x1 * y2 - x2 * y1 > 0) {
		return true;
	} else {
		return false;
	}
}

C++: #include <iostream>
#include <vector>
#include <sstream>
#include <string>
#include <cmath>

using namespace std;

const int EPS=1e-9;

namespace FP {
    bool isZero(double x) {
        return (abs(x) <= EPS);
    }
};

struct Point {
    double x, y;
    Point(double x=0, double y=0) : x(x), y(y) {}
    string to_s() {
        ostringstream os;
        os << "(" << x << "," << y << ")";
        return os.str();
    }
    bool operator<(const Point &o) const {
        return x == o.x ? y < o.y : x < o.x;
    }
    Point operator+(const Point &o) const {
        return Point(x+o.x, y+o.y);
    }
    Point operator-(const Point &o) const {
        return Point(x-o.x, y-o.y);
    }
    Point operator*(const double m) const {
        return Point(x*m, y*m);
    }
    Point operator/(const double d) const {
        return Point(x/d, y/d);
    }
    // 外積
    double cross(const Point &o) const {
        return x * o.y - y * o.x;
    }
    // 内積
    double dot(const Point &o) const {
        return x * o.x + y * o.y;
    }
    // ベクトルがx軸となす角
    double atan() const {
        return atan2(y, x);
    }
    // ベクトルの長さの二乗
    double norm() const {
        return dot(*this);
    }
};

struct Line {
    double a, b, c;
    Line(double a=0, double b=0, double c=0) :
        a(a), b(b), c(c) {}
    Point intersectionPoint(const Line &l) const {
        double d = a * l.b - l.a * b;
        if (!intersects(l)) {
            throw string("The 2 Lines are parallel");
        }
        double x = (b * l.c - l.b * c) / d;
        double y = (l.a * c - a * l.c) / d;
        return Point(x, y);
    }
    bool intersects(const Line &l) const {
        return !FP::isZero(a * l.b - l.a * b);
    }
    string to_s() {
        ostringstream os;
        os << a << ' ' << b << ' ' << c;
        return os.str();
    }
    static Line fromPoints(const Point &a, const Point &b) {
        double dx = b.x - a.x;
        double dy = b.y - a.y;
        return Line(dy, -dx, dx * a.y - dy * a.x);
    }
    static Line fromPoints(double x1, double y1, double x2, double y2) {
        return fromPoints(Point(x1, y1), Point(x2, y2));
    }
};

struct LineSegment {
    Point start, end;
    LineSegment(const Point &start, const Point &end) : start(start), end(end) {}
    LineSegment(double x1, double y1, double x2, double y2) : start(Point(x1, y1)), end(Point(x2, y2)) {}
    string to_s() {
        ostringstream os;
        os << '(' << start.x << ',' << start.y << ')' << '-' << '(' << end.x << ',' << end.y << ')' << endl;
        return os.str();
    }
    Line toLine() const {
        return Line::fromPoints(start, end);
    }
    bool intersects(const Line &l) const {
        double t1 = l.a * start.x + l.b * start.y + l.c;
        double t2 = l.a * end.x + l.b * end.y + l.c;
        return t1 * t2 <= 0;
    }
    bool intersects(const LineSegment &s) const {
        return intersects(s.toLine()) && s.intersects(toLine());
    }
    Line perpendicularBisector() const {
        Point p1 = (start + end) / 2;
        Point p2;
        p2.x = -(end - p1).y;
        p2.y = (end - p1).x;
        p2 = p2 + p1;
        return Line::fromPoints(p1, p2);
    }
};

int main() {
    Point v[3], p;
    while (cin >> v[0].x >> v[0].y) {
        for (int i = 1; i < 3; i++) cin >> v[i].x >> v[i].y;
        cin >> p.x >> p.y;
        Point g = (v[0] + v[1] + v[2]) / 3;
        vector<LineSegment> e;
        e.push_back(LineSegment(v[0], v[1]));
        e.push_back(LineSegment(v[1], v[2]));
        e.push_back(LineSegment(v[2], v[0]));

        bool inner_triangle = true;
        for (int i = 0; i < 3; i++) {
            if (LineSegment(g, p).intersects(e[i])) {
                inner_triangle = false;
            }
        }

        if (inner_triangle) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}