Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

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

struct Vec2D {
	double x = 0.0, y = 0.0;

	Vec2D() = default;
	Vec2D(const Vec2D&) = default;
	Vec2D& operator = (const Vec2D&) = default;

	Vec2D(double _x, double _y) :
		x(_x), y(_y) {}

	Vec2D operator - (const Vec2D& vec) {
		return Vec2D(x - vec.x, y - vec.y);
	}
};

inline Vec2D normalize(const Vec2D& vec) {
	double k = vec.x * vec.x + vec.y * vec.y;
	return Vec2D(vec.x / k, vec.y / k);
}
inline double cross(const Vec2D& v1, const Vec2D& v2) {
	return v1.x * v2.y - v1.y * v2.x;
}

int main() {
	Vec2D vecs[3];
	Vec2D p;

	while (std::cin) {
		for (auto&& vec : vecs) {
			std::cin >> vec.x >> vec.y;
		}

		std::cin >> p.x >> p.y;

		double res[3];
		for (int i = 0; i < 3; ++i) {
			res[i] = cross(
				p - vecs[i],
				normalize(vecs[(i + 1) % 3] - vecs[i])
				);
		}

		if (
			std::all_of(res, std::end(res), [](double x) {return x > 0; }) ||
			std::all_of(res, std::end(res), [](double x) {return x < 0; })
			) {
			std::cout << "YES" << std::endl;
		}
		else
			std::cout << "NO" << std::endl;
	}
}

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

#include <utility>
using namespace std;


pair<double,double> tp[3];
pair<double,double> p;
bool flag=true;


int main(){
	
	
	
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tp[0].first,&tp[0].second,&tp[1].first,&tp[1].second,&tp[2].first,&tp[2].second,&p.first,&p.second) == 8){
		flag=true;
		
		for(int i=0;i<3;i++){
					
			if (tp[i%3].second-tp[(i+1)%3].second==0){
				if(
					(p.second-tp[i%3].second)
					*(tp[(i+2)%2].second-tp[i%3].second)
					<0
				)flag=false;
			}else {
				printf("%lf\n",
					(p.second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(p.first-tp[i%3].first)+tp[i%3].second)
					*(tp[(i+2)%2].second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(tp[(i+2)%2].first-tp[i%3].first)+tp[i%3].second));
				if(
					(p.second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(p.first-tp[i%3].first)+tp[i%3].second)
					*(tp[(i+2)%2].second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(tp[(i+2)%2].first-tp[i%3].first)+tp[i%3].second)
					<0
				)flag=false;
			}
		}
		
		
		
		
		if(flag)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		
	}
	return 0;
}

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

using namespace std;

const double ESP=1e-8;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define eq(a,b) a-b<ESP

double x[3],y[3];
double xp,yp;

int main(){
  while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
    bool yes=true;
    REP(i,3){
      double flg,flg2;
      if (eq(x[i],x[(i+1)%3])){
	flg=x[(i+2)%3]-x[i];
	flg2=xp-x[i];
	if (flg*flg2<0){
	  yes=false;
	}
      }
      else{
	double m=(y[(i+1)%3]-y[i])/(x[(i+1)%3]-x[i]);
	double n=-x[i]*m+y[i];
	flg=y[(i+2)%3]-(m*x[(i+2)%3]+n);
	flg2=yp-(m*xp+n);
	if (flg*flg2<0){
	  yes=false;
	}
      }
    }
    cout<<(yes ? "YES" : "NO")<<endl;
  }
  return 0;
}

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

#define EPS (1e-10)
double length(double x1, double y1, double x2, double y2){
	return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double a, b, c, x, pa, pb, pc;
	double S, Sp, Sa, Sb, Sc;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		a = length(x2, y2, x3, y3);
		b = length(x3, y3, x1, y1);
		c = length(x1, y1, x2, y2);
		x = (a + b + c) / 2;
		S = sqrt(x*(x-a)*(x-b)*(x-c)); // Heron's formula

		pa = length(xp, yp, x1, y1);
		pb = length(xp, yp, x2, y2);
		pc = length(xp, yp, x3, y3);
		x = (a + pb + pc) / 2;
		Sa = sqrt(x*(x-a)*(x-pb)*(x-pc));
		x = (pa + b + pc) / 2;
		Sb = sqrt(x*(x-pa)*(x-b)*(x-pc));
		x = (pa + pb + c) / 2;
		Sc = sqrt(x*(x-pa)*(x-pb)*(x-c));
		Sp = Sa + Sb + Sc;
		if (fabs(Sp-S) < EPS) {
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <utility>
using namespace std;

#define x first
#define y second
#define EPS 1e-20

struct vector { double x, y, l; };

int main()
{
    pair<double, double> p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        vector v[3];
        double angle[3];

        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);
        for (int i = 0; i < 3; i++){
            v[i].x = p[i].x - p[3].x;
            v[i].y = p[i].y - p[3].y;
            v[i].l = sqrt(v[i].x * v[i].x + v[i].y * v[i].y);
        }
        for (int i = 0; i < 3; i++){
            double product = v[i].x * v[(i + 1) % 3].x + v[i].y * v[(i + 1) % 3].y;
            angle[i] = acos(product / v[i].l / v[(i + 1) % 3].l) + EPS;
        }

        if (angle[0] + angle[1] + angle[2] == 2 * M_PI){
            puts("YES");
        }
        else {
            puts("NO");
        }
    }

    return 0;
}