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 <vector>

using namespace std;

bool checker(double a, double b,double x, double y, double px, double py, bool f);

double calc_slope(double x1, double y1, double x2, double y2);

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a1, a2, a3, b1, b2, b3;
  vector<double> x1s,y1s,x2s,y2s,x3s,y3s,xps,yps;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    x1s.push_back(x1);
    y1s.push_back(y1);
    x2s.push_back(x2);
    y2s.push_back(y2);
    x3s.push_back(x3);
    y3s.push_back(y3);
    xps.push_back(xp);
    yps.push_back(yp);
  }

  for(int i=0; i<x2s.size(); i++){
    bool flag = true, f;
    x1 = x1s[i];
    y1 = y1s[i];
    x2 = x2s[i];
    y2 = y2s[i];
    x3 = x3s[i];
    y3 = y3s[i];
    xp = xps[i];
    yp = yps[i];


    a1 = calc_slope(x1,y1,x2,y2);
    if(a1==0 && y1==y2){
      b1 = y1;
      f = false;
    }else if(a1==0 && x1==x2){
      b1 = x1;
      f = true;
    }else{
      b1 = -a1*x1+y1;
    }
    flag &= checker(a1,b1,x3,y3,xp,yp,f);

    a2 = calc_slope(x2,y2,x3,y3);
    if(a2==0&&y2==y3){
      b2 = y2;
      f = false;
    }else if(a2==0&&x2==x3){
      b2 = x2;
      f = true;
    }else{
      b2 = -a2*x2+y2;
    }
    flag &= checker(a2,b2,x1,y1,xp,yp,f);

    a3 = calc_slope(x3,y3,x1,y1);
    if(a3==0&&y3==y1){
      b3 = y3;
      f = false;
    }else if(a3==0&&x3==x1){
      b3 = x3;
      f = true;
    }else{
      b3 = -a3*x3+y3;
    }
    flag &= checker(a3,b3,x2,y2,xp,yp,f);

    if(flag){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

bool checker(double a, double b, double ox, double oy, double px, double py, bool flag){
  if(a == 0 && flag){
    if(b < ox && b < px){
      return true;
    }
    else if(b > ox && b > px){
      return true;
    }else{
      return false;
    }
  }else if(a==0){
    if(b < oy && b < py){
      return true;
    }
    else if(b > oy && b > py){
      return true;
    }else{
      return false;
    }
  }

  if(oy < a*ox+b && py < a*px+b){
    return true;
  }
  else if(oy > a*ox+b && py > a*px+b){
    return true;
  }
  else{
    return false;
  }
}

double calc_slope(double x1, double y1, double x2, double y2){
  if(x1 > x2){
    return (y1-y2)/(x1-x2);
  }else if(x1 < x2){
    return (y2-y1)/(x2-x1);
  }else{
    return 0;
  }
}

C++: #include <iostream>
using namespace std;
double x[4],y[4],px,py,ax,ay,bx,by;
int main()
{
	while(true)
	{
		for(int i = 1;i<=3;i++){cin >> x[i];cin >> y[i];}
		if(cin.eof())break;
		cin >> px;
		cin >> py;
		double m,n,s;
		ax = x[2]-x[1];
		ay = y[2]-y[1];
		bx = x[3]-x[1];
		by = y[3]-y[1];
		double det = ax*by-ay*bx;
		m = (by*px-bx*py)/det;
		n = (-ay*px+ax*py)/det;
		if((m+n)<1&&m>0 && n > 0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double eps = 1e-8;

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

double dist(P a,P b){
	return (sqrt((real(a)-real(b))*(real(a)-real(b))+(imag(a)-imag(b))*(imag(a)-imag(b))));
}

double tri_pro(P a,P b,P c){
	double aa,bb,cc;
	aa = dist(b,c);
	bb = dist(c,a);
	cc = dist(a,b);
	double s = (aa+bb+cc)/2.0;
	return sqrt(s*(s-aa)*(s-bb)*(s-cc));
}


int main(){
	while(cin>>x[0]>>y[0]){
		rep(i,2) cin>>x[i+1]>>y[i+1];
		cin>>xp>>yp;
		P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
		P p(xp,yp);
		double sa,sb,sc;
		sa = tri_pro(b,c,p);
		sb = tri_pro(c,a,p);
		sc = tri_pro(a,b,p);
		double s = tri_pro(a,b,c);
		cout<<"s="<<s<<"\nsa sb sc "<<sa<<" "<<sb<<" "<<sc<<endl;
		if(s-(sa+sb+sc)<eps) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

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

int main(void) {
	double x[4], y[4];
	double xp, yp;

	while(!cin.eof()) {
		bool l, r;
		l = r = false;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp;
		x[3] = x[0];
		y[3] = y[0];

		for(int i = 0; i < 3; i++) {
			double ax = x[i+1] - x[i];
			double ay = y[i+1] - y[i];
			double px = xp - x[i];
			double py = yp - x[i];
			if(ax*py - ay*px < 0)
				r = true;
			else
				l = true;
		}
		cout << (r ^ l ? "YES" : "NO") << endl;
	}
	return 0;
}

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

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double ax, ay, bx, by;
    while(1){cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
        double m,n;
        ax = x2 - x1;
        ay = y2 - y1;
        bx = x3 - x1;
        by = y3 - y1;
        xp = xp - x1;
        yp = yp - y1;
        double point = ax*by - ay*bx;
        m = (by*xp - bx*yp)/point;
        n = (-ay*xp + ax*yp)/point;
        if(point == 0){
            cout << "NO"<<endl;
        }
        else if(m > 0 && m <= 1 && n > 0 && n <= 1 && m+n <= 1 ){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

using db = double;
const db eps = 1e-6;

struct poi {
	db x, y;
	void r() { cin >> x >> y; }
	poi operator -(poi p) {
		return {x - p.x, y - p.y};
	}
	db cross(poi p) {
		return x * p.y - y * p.x;
	}
};
db xmul(poi a, poi b, poi c) {
	return (b - a).cross(c - a);
}

int main() {
	ios :: sync_with_stdio(false);
	poi a, b, c, p;
	while(cin >> a.x >> a.y) {
		b.r(); c.r(); p.r();
		poi s = abs(xmul(a, b, c));
		poi t = abs(xmul(p, a, b)) + abs(xmul(p, b, c)) + abs(xmul(p, c, a));
		if(s < t + eps && t < s + eps)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

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

#define range(a, l, r) a >= l && r >= a

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double s, t;
	while(cin >> x1){
		cin >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
		s = ((xp-x1)*(y3-y1)-(yp-y1)*(x3-x1)) / ((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1));
		t = ((xp-x1)*(y2-y1)-(yp-y1)*(x2-x1)) / ((x3-x1)*(y2-y1)-(y3-y1)*(x2-x1));
		if(range(s, 0, 1) && range(t, 0, 1) && s+t <= 1) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}