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 FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

bool collision_detection( double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp ) {
	x2 -= x1;
	x3 -= x1;
	xp -= x1;
	y2 -= y1;
	y3 -= y1;
	yp -= y1;
	double t_size = fabs( ( x2 * y3 - y2 * x3 ) / 2 );
	t_size -= fabs( ( x2 * yp -  y2 * xp ) / 2 );
	t_size -= fabs( ( x3 * yp -  y3 * xp ) / 2 );
	x2 -= xp;
	x3 -= xp;
	y2 -= yp;
	y3 -= yp;
	yp = xp = 0;
	t_size -= fabs( ( x2 * y3 - y2 * x3 ) / 2 );
	return fabs( t_size ) < 1e-10;
}

int main() {
	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 ) ) {
		printf( "%s\n", collision_detection( x1, y1, x2, y2, x3, y3, xp, yp ) ? "YES" : "NO" );
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
typedef double d;
d cross(d x1,d y1,d x2,d y2){
	return (x1 * y2) - (y1 * x2);
}

int main(){
  d x[3],y[3],xp,yp;
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
    d ret[3];
    for(int i = 0;i<3;i++){
      int nx =(i + 1) % 3;
      ret[i]=cross(xp- x[i],yp - y[i], x[nx] - x[i] ,y[nx] - y[i]);
    }
    if((ret[0] < 0 && ret[1] < 0 && ret[2] < 0) ||  
       (ret[0] > 0 && ret[1] > 0 && ret[2] > 0) ){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

class Vector2{
public:
	Vector2(){}
	Vector2( double aX, double aY ) : x( aX ), y( aY ){}

	double dot( Vector2& a ){
		return ( x * a.x ) + ( y * a.y );
	}

	double x;
	double y;
};


int main(){
	Vector2 p0, p1, p2, q;

	cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> q.x >> q.y;
	bool isInner = false;
	Vector2 a( p1.x - p0.x, p1.y - p0.y );
	Vector2 b( p2.x - p0.x, p2.y - p0.y );
	Vector2 c( q.x - p0.x, q.y - p0.y );

	double aa = a.dot( a );
	double ab = a.dot( b );
	double ac = a.dot( c );
	double bb = b.dot( b );
	double bc = b.dot( c );

	double s = ( bc*ab - ac*bb ) / ( ab*ab - aa*bb );
	if ( ( s > 0.0 ) && ( s < 1.0 ) ){
		double t = ( ac*ab - bc*aa ) / ( ab*ab - aa*bb );
		if ( ( t > 0.0 ) && ( s + t < 1.0 ) ){
			isInner = true;
		}
	}

	cout << ( isInner ? "Yes" : "No" ) << endl;

	return 0;
}

C++: 	#include <cstdio>
	#include <iostream>
	#include <math.h>

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

	bool judge(double x[2], double y[2]) {
		double cross = x[0] * y[1] - y[0] * x[1];
		if(cross >= 0) return true;
		else return false;
	}

	int main() {
		double x1, y1, x2, y2, x3, y3, xp, yp;
		while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
			double x[2], y[2];
			x[0] = x2 - x1;
			y[0] = y2 - y1; 
			x[1] = xp - x1;
			y[1] = yp - y1;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x3 - x2;
			y[0] = y3 - y2;
			x[1] = xp - x2;
			y[1] = yp - y2;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x1 - x3;
			y[0] = y1 - y3;
			x[1] = xp - x3;
			y[1] = yp - y3;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;
		}
		return 0;
	}

C++: #include<iostream>

using namespace std;

int main(){
	double x1, y1, x2, y2, x3, y3, px, py;
	double det, s, t;

	// 入力の終わりまでループ
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py){
		// 係数行列の行列式を計算
		det = ((x2 - x1) * (y3 - y1)) - ((x3 - x1) * (y2 - y1));
		// 係数行列の行列式が0でないことを確かめる
		if(det == 0){
			cerr << "行列式の値が0です" << endl;
			return -1;
		}

		// s, t の値を求める
		s = (((y3 - y1) * (px - x1)) + ((x1 - x3) * (py - y1))) / det;
		t = (((y1 - y2) * (px - x1)) + ((x2 - x1) * (py - y1))) / det;

		// 結果の判定・表示
		if((s > 0) && (s < 1) && (t > 0) && (t < 1) && ((s + t) < 1)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
double x
{
double x1,y1,x2,y2,x3,y3,xp,yp;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
{
	if(y1<y2&&y3<y2)
	{
	for(double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-((y1-y2)/(x1-x2)*x1)>(y1-y2)/(x1-x2)*xp+y1-((y1-y2)/(x1-x2)*x1)&&(y2-y3)/(x2-x3)*x+y2-((y2-y3)/(x2-x3)*x2)>(y2-y3)/(x2-x3)*xp+y2-((y2-y3)/(x2-x3)*x2)&&(y1-y3)/(x1-x3)*x+y1-((y1-y3)/(x1-x3)*x2)<(y1-y3)/(x1-x3)*xp+y1-((y1-y3)/(x1-x3)*x1))
{
cout<<"YES"<<endl;
break;	
}
}
else if(y1>y2&&y1>y1)
{
for(double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-((y1-y2)/(x1-x2)*x1)>(y1-y2)/(x1-x2)*xp+y1-((y1-y2)/(x1-x2)*x1)&&(y2-y3)/(x2-x3)*x+y2-((y2-y3)/(x2-x3)*x2)<(y2-y3)/(x2-x3)*xp+y2-((y2-y3)/(x2-x3)*x2)&&(y1-y3)/(x1-x3)*x+y1-((y1-y3)/(x1-x3)*x2)>(y1-y3)/(x1-x3)*xp+y1-((y1-y3)/(x1-x3)*x1))
{
cout<<"YES"<<endl;
break;	
	}	
	}	
}
else if(y3>y1&&y3>y2)
{
	for(double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-((y1-y2)/(x1-x2)*x1)<(y1-y2)/(x1-x2)*xp+y1-((y1-y2)/(x1-x2)*x1)&&(y2-y3)/(x2-x3)*x+y2-((y2-y3)/(x2-x3)*x2)>(y2-y3)/(x2-x3)*xp+y2-((y2-y3)/(x2-x3)*x2)&&(y1-y3)/(x1-x3)*x+y1-((y1-y3)/(x1-x3)*x2)>(y1-y3)/(x1-x3)*xp+y1-((y1-y3)/(x1-x3)*x1))
{
cout<<"YES"<<endl;
break;
}
else
{
	cout<<"NO"<<endl;
}
return 0;
}