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 <utility>
using namespace std;
int main(){
	pair<double,double> tp[3];
	pair<double,double> p;
	bool flag;
	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 {
				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<iostream>
#include<cmath>

using namespace std;

struct Point{
  double x, y;
  Point(){ x = 0; y = 0; }
  Point(double x_, double y_){ x = x_; y = y_; }
};

struct Segment{
  Point a, b;
  Segment(): a(), b(){}
  Segment(Point a_, Point b_){ a = a_; b = b_; }
};

static double ER = 1.0e-8;

bool isZero(double x){
  return (abs(x) < ER);
}

bool isEqual(double x, double y){
  return isZero(x - y);
}

int isIntersection_ss(const Segment& ab, const Segment& cd){
  double m = (ab.b.x - ab.a.x)*(cd.b.y - cd.a.y)
    - (ab.b.y - ab.a.y)*(cd.b.x - cd.a.x);
  if(isZero(m)) return false;
  double r = ((cd.a.x - ab.a.x)*(cd.b.y - cd.a.y)
              - (cd.a.y - ab.a.y)*(cd.b.x - cd.a.x)) / m;
  double s = ((cd.a.x - ab.a.x)*(ab.b.y - ab.a.y)
              - (cd.a.y - ab.a.y)*(ab.b.x - ab.a.x)) / m;
  if(r < 0 || r > 1 || s < 0 || s > 1)  return true;
  return false;
}

bool isPointInnerTriangle(const Point& a, const Point& b,
			  const Point& c, const Point& p){
  if(isEqual((a.x - c.x)*(a.y - b.y), (a.x - b.x)*(a.y - c.y))) return false;
  return isIntersection_ss(Segment(a, b), Segment(c, p)) &&
    isIntersection_ss(Segment(b, c), Segment(a, p)) &&
    isIntersection_ss(Segment(c, a), Segment(b, p));
}

int main(){
  Point a, b, c, p;
  while(cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y){
    if(isPointInnerTriangle(a, b, c, p)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	double m = 0;
	bool flg = false;
	REP(i,1e6){
	    s = ((double)i/1e6);
	    t = (double)1 - s;
	    double x1 = s * (x[2] - x[0]) + t * ( x[1] - x[0]);
	    double y1 = s * (y[2] - y[0]) + t * ( y[1] - y[0]);
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    double dotpro =  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2)) ;

	    m = max(m,dotpro);
        if( (x2 * x2 + y2 * y2) >= (x1*x1 + y1 * y1)) continue;
	    if(  abs(1 - sqrt(dotpro))  <= 1e-3  ){
		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

	cout << "max = " << m << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	double m = 0;
	bool flg = false;
	REP(i,1e6){
	    s = ((double)i/1e6);
	    t = (double)1 - s;
	    double x1 = s * (x[2] - x[0]) + t * ( x[1] - x[0]);
	    double y1 = s * (y[2] - y[0]) + t * ( y[1] - y[0]);
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    double dotpro =  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2)) ;

        if( (x2 * x2 + y2 * y2) >= (x1*x1 + y1 * y1)) continue;
	    if(  abs(1 - sqrt(dotpro))  <= 1e-3  ){
	
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}

C++: #include<iostream>
#include<cstdlib>
#include<stdio.h>
using namespace std;

int main()
{
 double x1, y1, x2, y2, x3, y3, xp, yp, a, b, c;
 while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
 {
     a = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
     b = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
     c = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
     
     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 <vector>

using namespace std;

vector<double> simlu_eq(int N, vector<vector<double>> M){
    int i, j, k, n;
    double pivot, mul;
    
    for (i = 0; i < N; ++i){
        pivot = M[i][i];
        for (j = 0; j < N + 1; ++j){
            M[i][j] = (1 / pivot) * M[i][j];
        }
        
        
        for (k = i + 1; k < N; ++k){
            mul = M[k][i];
            for (n = i; n < N + 1; ++n){
                M[k][n] = M[k][n] - mul * M[i][n];
            }
        }
    }
    
    // for (auto x:M){for(auto y:x){ cout << y << " ";}cout << endl;}

        
     for (i = N -1; i > 0; --i){
         for (k = i -1; k >= 0; --k){
             mul = M[k][i];
             for (n = i; n < N + 1; ++n){
                 M[k][n] = M[k][n] - mul * M[i][n];
             }
         }
     }
      
    // for (auto x:M){for(auto y:x){ cout << y << " ";}cout << endl;}
  
      
    vector<double> res;
    for (i = 0; i < N; ++i){
        res.push_back(M[i][N]);
    }
    return res;
}


int main(){
    vector<double> a(2), b(2), c(2), p(2), ab(2), ac(2);
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &a[0], &a[1], &b[0], &b[1], &c[0], &c[1], &p[0], &p[1])+1){
        ab[0] = b[0] - a[0];
        ab[1] = b[1] - a[1];
        ac[0] = c[0] - a[0];
        ac[1] = c[1] - a[1];
 
    
    vector<vector<double>>M;
    M = vector<vector<double>>(2, vector<double>(3));
    M[0][0] = ab[0];  M[0][1] = ac[0];  M[0][2] = p[0];
    M[1][0] = ab[1];  M[1][1] = ac[1];  M[1][2] = p[1];
    vector<double> w = simlu_eq(2, M);
    
    if (w[0] > 0 && w[1] > 0 && w[0] + w[1] < 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    }
}