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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define Eps (1e-10)

int main() {
  double x[4], y[4];
  while (cin >> x[0] >> y[0]) {
    for (int i = 1; i < 4; ++i) cin >> x[i] >> y[i];
    double S, subS;
    S = fabs((x[0]*y[1] + x[1]*y[2] + x[2]*y[0]
              - y[0]*x[1] - y[1]*x[2] - y[2]*x[0]) / 2);
    
    subS = fabs((x[0]*y[1] + x[1]*y[3] + x[3]*y[0]
              - y[0]*x[1] - y[1]*x[3] - y[3]*x[0]) / 2);
    subS += fabs((x[0]*y[3] + x[3]*y[2] + x[2]*y[0]
              - y[0]*x[3] - y[3]*x[2] - y[2]*x[0]) / 2);
    subS += fabs((x[3]*y[1] + x[1]*y[2] + x[2]*y[3]
              - y[3]*x[1] - y[1]*x[2] - y[2]*x[3]) / 2);
    printf("%s\n", (fabs(S-subS) < Eps) ? "YES" : "NO");
  }
 
  return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
using namespace std;
const string mes[2] = {"YES", "NO"};
double dist(double a, double b) {
  return sqrt(a*a + b*b);
}

int main (int argc, char const* argv[]) {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
    double cx = (x1 + x2 + x3) / 3.0;
    double cy = (y1 + y2 + y3) / 3.0;
    double cdist = dist(cx-x1,cy-y1) + dist(cx-x2,cy-y2) + dist(cx-x3,cy-y3);
    //double cdist = dist(x1-x2,y1-y2) + dist(x1-x3,y1-y3);
    double pdist = dist(xp-x1,yp-y1) + dist(xp-x3,yp-y2) + dist(xp-x3,yp-y3);
    int res = (cdist > pdist)?0:1;
    cout<<mes[res]<<endl;
  }
  
  return 0;
}

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

using namespace std;

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

#ifdef ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif

#define pb emplace_back
#define lb lower_bound
#define ul unsigned long
#define ull unsigned long long
#define ll long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second

#define ALL(c) (c).begin(),(c).end()

#define DBG0(x)    {if(DEBUG){ cout << #x << ": " << x << "\t"; }}
#define DBG(x)     {if(DEBUG){DBG0(x); cout << endl;}}
#define DBG2(x, y) {if(DEBUG){DBG0(x); DBG(y);}}
#define DBG3(x, y, z) {if(DEBUG){DBG0(x); DBG2(y, z);}}
#define DBG4(w, x, y, z) {if(DEBUG){DBG0(w); DBG3(x, y, z);}}

template <class T>
ostream& operator<<(ostream& os, vector<T> xs){ for(T x: xs) os << x << ' '; return os; }
template <class S, class T>
ostream& operator<<(ostream& os, pair<S,T> st){ os << "(" << st.first << "," << st.second <<")"; return os; }

using namespace std;
const double EPS = 1.0e-14;
typedef complex<double> Point;
istream& operator>>(istream& is, Point &pt){
    double a, b;
    is >> a >> b;
    pt.real(a); pt.imag(b);
    return is;
}

ostream& operator<<(ostream& os, const Point &pt){
    os << make_pair(pt.real(), pt.imag());
    return os;
}

inline double cross(const Point &a, const Point &b){
    return (a.real()*b.imag() - a.imag()*b.real());
}

inline double myarg(Point &a){
    double ret = arg(a);
    return (ret >= 0 ? ret : ret + 2*M_PI);
}

inline double signed_area(const Point &a, const Point &b, const Point &c){
    Point ab = b - a;
    Point ac = c - a;
    return cross(ab, ac) / 2.0;
}

inline bool intersect(const Point &a1, const Point &a2, const Point &b1, const Point &b2) {
  return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS) &&
          (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS));
}

void sort_by_arg(vector<Point> &pts){
    sort(pts.begin(), pts.end(), [](Point a, Point b){ return (myarg(a) < myarg(b)); });
}

double area(vector<Point> &vs){
    int n = vs.size();
    vector<Point> pts(n - 1);
    rep(i, n - 1) pts[i] = vs[i + 1] - vs[0];
    sort_by_arg(pts);
    double ans = 0.0;
    rep(i, n - 1) ans += cross(vs[i], vs[i + 1]);
    return ans / 2.0;
}


typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef vector<bool> vbl;
typedef pair<int, int> pii;

bool counter_clock_wise(const Point &a, const Point &b, const Point &c){
    if(cross(a, b) > 0 && cross(b, c) > 0) return true;
    else return false;
}

int main(void){
    Point a, b, c, p;
    while(cin >> a >> b >> c >> p){
        double A, B, C;
        A = cross(b - a, p - a);
        B = cross(c - b, p - b);
        C = cross(a - c, p - c);
        if((A > 0 && B > 0 && C > 0) || 
           (A < 0 && B < 0 && C < 0))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

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

using namespace std;

#define EPS 1e-10

double heron(double a,double b,double c){
      double s = (a + b + c) / 2;

      return sqrt(s * (s - a) * (s - b) * (s - c));
}

int main() {
    double x[3],y[3],xp,yp,a,b,c,d,e,f,sq,sqd,sqe,sqf;
    
    while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
        a = sqrt(pow((x[1] - x[0]),2) + pow((y[1] - y[0]),2));
        b = sqrt(pow((x[2] - x[0]),2) + pow((y[2] - y[0]),2));
        c = sqrt(pow((x[2] - x[1]),2) + pow((y[2] - y[1]),2));

        sq = heron (a,b,c);

        d = sqrt(pow((xp - x[0]),2) + pow((yp - y[0]),2));
        e = sqrt(pow((xp - x[1]),2) + pow((yp - y[1]),2));
        f = sqrt(pow((xp - x[2]),2) + pow((yp - y[2]),2));

        sqd = heron(e,a,d);
        sqe = heron(d,b,f);
        sqf = heron(f,c,e);
        
        if(sqd == 0 || sqe == 0 || sqf == 0){
             cout << "NO" << endl;
             return 0;
         }
         if(abs(sq - (sqd + sqe + sqf)) < EPS){
            cout << "YES" << endl;
            
        }
        else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

bool judge(double s1, double t1, double s2, double t2, double s3, double t3, double xp, double yp);

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;

	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		if(judge(x1,y1,x2,y2,x3,y3,xp,yp) && judge(x2,y2,x1,y1,x3,y3,xp,yp) && judge(x3,y3,x1,y1,x2,y2,xp,yp)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return(0);
}


bool judge(double s1, double t1, double s2, double t2, double s3, double t3, double xp, double yp){
	double a, b1, b2, b3;

	if(s2-s3 == 0.0){
		if(min(s1,s2) < xp && xp < max(s1,s2)){
			return true;
		}else{
			return false;
		}
	}else{
		a = (t2-t3)/(s2-s3);
		b1 = t2 - a*s2;
		b2 = t1 - a*s1;
		b3 = yp - a*xp;
	}

	if(min(b1,b2) < b3 && b3 < max(b1,b2)){
		return true;
	}else{
		return false;
	}
}