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>
#include <complex>
#include <vector>
using namespace std;

typedef complex<double> P;

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

vector<P> ps(3);
P p;

bool isIn() {
  for(int i = 0; i < ps.size(); ++i) {
    P q = ps[i];
    P r = ps[(i+1)%ps.size()];
    if(cross(r-q, p-q) < 0.0) return false;
  }
  return true;
}

int main() {
  while(!cin.eof()) {
    for(int i = 0; i < ps.size(); ++i) {
      cin >> ps[i].real() >> ps[i].imag();
    }
    cin >> p.real() >> p.imag();
    bool flag = false;
    if(isIn() || ( swap(ps[0], ps[1]), isIn() )) {
      cout << "YES" << endl;    
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

double relative(double ax,double ay,double bx,double by){
    return ax*by-ay*bx;
}

int main(void){
    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)){
        double r1=relative(x1-x3, y1-y3, xp-x1, yp-x1);
        double r2=relative(x2-x1, y2-y1, xp-x2, yp-y2);
        double r3=relative(x3-x2, y3-y2, xp-x3, yp-y3);
        if((r1<0&&r2<0&&r3<0) || (r1>0&&r2>0&&r3>0)) cout << "YES" <<"\n";
        else cout << "NO" << "\n";
    }
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

struct fPoint
{
    double x;
    double y;
};

float sign(fPoint p1, fPoint p2, fPoint p3)
{
  return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
}

bool PointInTriangle(fPoint pt, fPoint v1, fPoint v2, fPoint v3)
{
  bool b1, b2, b3;

  b1 = sign(pt, v1, v2) < 0.0f;
  b2 = sign(pt, v2, v3) < 0.0f;
  b3 = sign(pt, v3, v1) < 0.0f;

  return ((b1 == b2) && (b2 == b3));
}


int main()
{
    fPoint p1,p2,p3,pp;
    while(cin>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y>>pp.x>>pp.y)
    {
        cout<<(PointInTriangle(pp,p1,p2,p3)?"YES":"NO")<<endl;
    }
}

C++: #include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  ifstream cin("../test.txt");
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    bool res = false;
    // 平行移動
    x2 -= x1;
    x3 -= x1;
    xp -= x1;
    y2 -= y1;
    y3 -= y1;
    yp -= y1;
    // 傾き
    if (((y3 * xp > yp * x3) && (yp * x2 > y2 * xp)) || ((y2 * xp > yp * x2) && (yp * x3 > y3 * xp)))
      res = true;

    if (!res) {
      cout << "NO" << endl;
      continue;
    }

    // cout << "ok" << endl;
    // 直線BCの下にある
    // y - y1 = (y2 - y1)/(x2 - x1) (x - x1)
    if ( ((y3 - y2) * (xp - x2) - (x3 - x2) * (yp - y2)) * ((y3 - y2) * (0 - x2) - (x3 - x2) * (0 - y2)) < 0 )
      res = false;

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

}

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

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;

bool operator < (const P& a, const P& b) {
  return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

int main() {
  double x1,y1,x2,y2,x3,y3, x, y;
  while(cin >> x1) {
    cin >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y;
    P a1(x1,y1), a2(x2,y2), a3(x3,y3), a(x,y);

    if (ccw(a1,a2,a)==1 && ccw(a2,a3,a)==1 && ccw(a3, a1, a)==1
      || ccw(a1,a2,a)==-1 && ccw(a2,a3,a)==-1 && ccw(a3, a1, a)==-1)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}

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

typedef struct {
	double x;
	double y;
}vector;

bool ex_product(double x0,double y0,double x1,double y1,double xp,double yp ){
	vector a={x1-x0,y1-y0};
	vector b={xp-x0,yp-y0};

	return (a.x*b.y-a.y*b.x)>=0;
}

int main(int argc, char *argv[]){
    
	double x1,y1,x2,y2,x3,y3,xp,yp;
	cin >> x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
	
	bool a=ex_product(x1,y1,x2,y2,xp,yp); 
	bool b= ex_product(x2,y2,x3,y3,xp,yp) ;
	bool c=ex_product(x3,y3,x1,y1,xp,yp) ;
	
	if((a && b && c) || ((!a) && (!b) && (!c)))cout <<"YES"<<endl;
	else cout <<"NO"<<endl;
					 
	
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define PI (acos(-1.0))
#define POSARG(a) (arg((a)) > 0.0? arg((a)) : 2.0*PI + arg((a)))
#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> paii;
typedef complex<double> P;

double ccw(P& p1, P& p2, P& p3)
{
	return ((p2.real() - p1.real())*(p3.imag() - p1.imag()) 
				- (p2.imag() - p1.imag())*(p3.real() - p1.real())) > 0;
}// ccw>0 ...ccw, ccw=0 ...colinear, ccw<0 ...cw

int main()
{
	double x, y;
	P p1, p2, p3, px;
	
	cin >> x >> y;
	p1 = P(x, y);
	cin >> x >> y;
	p2 = P(x, y);
	cin >> x >> y;
	p3 = P(x, y);
	cin >> x >> y;
	px = P(x, y);
	
	if( ccw(p1, p2, px) > 0 && ccw(p2, p3, px) > 0 && ccw(p3, p1, px) > 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	
	return 0;
}