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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,c,d,e,f,xp,yp;
  while(cin >> a >> b >> c >> d >> e >> f >> xp >> yp){
    bool f = true;
    double acx = c-a,abx = d-a,acy = d-b,aby = e-b,apx = xp-a,apy = yp - b;
    double t,s;
    if(acx == 0 || acy == 0){
      s = 0;
      t = apx/acx;
    }
    else if(abx == 0 || aby == 0){
      t = 0;
      s = apy/aby;
    }
    else{
      t = (abx * apy - apx * aby)/(acy - acx*aby);
      s = (apx - t * acx)/abx;
    }
    cout << s + t << endl;
    Ans(0 < t+s && t+s < 1);
  }
  return 0;
}

C++: //
//  practise.h
//  c++practise
//
//  Created by Ubnit04 on 2015/06/10.
//
//

#include <iostream>
#include <math.h>

using namespace std;

float getSquare(float x1, float y1, float x2, float y2, float x3, float y3)
{
    float xAB, yAB;
    float xBC, yBC;

    xAB = x2 - x1;
    yAB = y2 - y1;

    xBC = x3 - x2;
    yBC = y3 - y2;
    
    return fabs(xAB * yBC - yAB * xBC) / 2.0f; //square of tri-angle
    
}

void isIn()
{
    float x1, y1;
    float x2, y2;
    float x3, y3;
    float xp, yp;
    
    float sABC, sABP, sACP, sBCP;
    
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
    {
        sABC = getSquare(x1, y1, x2, y2, x3, y3);
        sABP = getSquare(x1, y1, x2, y2, xp, yp);
        sBCP = getSquare(x2, y2, x3, y3, xp, yp);
        sACP = getSquare(x1, y1, x3, y3, xp, yp);
        
        if(((sABC > 0) && (sBCP > 0) && (sACP > 0)) || ((sABC < 0) && (sBCP < 0) && (sACP < 0)))
        {
            if (sABC == sABP + sACP + sBCP) //if p is including triangle this should be worked
            {
                cout<<"YES"<<endl;
            }
            else if (sABC < sABP + sACP + sBCP)
            {
                cout<<"NO"<<endl;
            }
        }
    }
    
    return;
}

int main()
{
    isIn();
    return 0;
}

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

using namespace std;

int main() {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    double det[3];
    for (int i = 0; i < 3; i++) {
      double x0, y0;
      double xa, ya;
      double xb = xp, yb = yp;
      if (i == 0) { x0 = x1; y0 = y1; xa = x2; ya = y2; }
      else if (i == 1) { x0 = x2; y0 = y2; xa = x3; ya = y3; }
      else if (i == 2) { x0 = x3; y0 = y3; xa = x1; ya = y1; }
      xa -= x0; ya -= y0; xb -= x0; yb -= y0;
      det[i] = xa * yb - xb * ya;
    }
    if ((det[0] > 0 && det[1] > 0 && det[2] > 0) || 
        (det[0] < 0 && det[1] < 0 && det[2] < 0)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct point{ double x, y; };

int ccw(point p0, point p1, point p2){
  double dx1, dx2, dy1, dy2;
  dx1 = p1.x - p0.x; dy1 = p1.y - p0.y;
  dx2 = p2.x - p0.x; dy2 = p2.y - p0.y;
  if(dx1*dy2 > dy1*dx2) return 1;
  if(dx1*dy2 < dy1*dx2) return -1;
  if((dx1*dx2 < 0) || (dy1*dy2 < 0)) return -1;
  if((dx1*dx1+dy1*dy1) < (dx2*dx2+dy2*dy2)) return 1;
  return 0;
}

int main(){
  double x1, x2, x3, xp, y1, y2, y3, yp;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) && x1+y1+x2+y2+x3+y3+xp+yp){
    point a, b, c, P;
    a.x = x1; a.y = y1;
    b.x = x2; b.y = y2;
    c.x = x3; c.y = y3;
    P.x = xp; P.y = yp;
    //    printf("%d %d %d\n", ccw(a, b, P), ccw(b, c, P), ccw(c, a,P));
    if(ccw(a, b, P) == ccw(b, c, P) && ccw(b, c, P) == ccw(c, a, P)) puts("YES");
    else puts("NO");
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cmath>
 
using namespace std;

int checkPoint(double x1, double y1, double x2, double y2, double x, double y){
    if(x1 - x2 == 0) { if(x1 - x == 0) return 0; if(x - x1 > 0) { return 1; } else return -1; }
    if((y - y1) - (y2 - y1) / (x2 - x1) * (x - x1) == 0) return 0;
    if((y - y1) - (y2 - y1) / (x2 - x1) * (x - x1) > 0) { return 1; } else return -1;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        if(checkPoint(x1, y1, x2, y2, x3, y3) * checkPoint(x1, y1, x2, y2, xp, yp) == 1){
            if(checkPoint(x1, y1, x3, y3, x2, y2) * checkPoint(x1, y1, x3, y3, xp, yp) == 1){
                if(checkPoint(x2, y2, x3, y3, x1, y1) * checkPoint(x2, y2, x3, y3, xp, yp) == 1){ cout << "YES" << endl; }}}
        else cout << "NO" << endl;
    }
    return 0;
}