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 <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	double x[4], y[4], xp, yp;
	double vx, vy, vpx, vpy;
	double crossZ;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF)
	{
		bool ans = true;
		bool prev, sign;
		x[3] = x[0]; y[3] = y[0];
		for(int i = 0; i < 3; i++)
		{
			vx = x[i+1] - x[i];
			vy = y[i+1] - y[i];
			vpx = xp - x[i];
			vpy = yp - y[i];
			//printf("%d: vx=%lf vy=%lf vpx=%lf vpy=%lf\n\n",i,vx,vy,vpx,vpy);
			crossZ = vx * vpy - vy * vpx;
			sign = crossZ>0?true:false;
			//printf("cross = %lf\n", crossZ);
			if(i == 0)
			{
				prev = sign;
			}
			else
			{
				if(prev != sign)
				{
					ans = false;
					break;
				}
			}
		}
		cout << (ans?"YES":"NO") << endl;
	}
}

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

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		//cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " " << xp << " " << yp << " " << endl;
		//AB
		double abx = x2 - x1;
		double aby = y2 - y1;
		//BC
		double bcx = x3 - x2;
		double bcy = y3 - y2;
		//CA
		double cax = x1 - x3;
		double cay = y1 - y3;
		//AP
		double apx = xp - x1;
		double apy = yp - y1;
		//BP
		double bpx = xp - x2;
		double bpy = yp - y2;
		//CP
		double cpx = xp - x3;
		double cpy = yp - y3;

		//AB * BP
		double a = abx*bpy - aby*bpx;
		//BC * CP
		double b = bcx*cpy - bcy*cpx;
		//CA * AP
		double c = cax*apy - cay*apx;

		if ((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

    return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

#define EPS (1e-8)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ(a.real(), b.real()) && EQ(a.imag(), b.imag()) )

typedef complex<double> p;

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

int main() {
	while (true) {
		double x[4], y[4];
		if (scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
			&x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]) == EOF) break;
		p point[4];
		REP(i, 4) point[i] = p(x[i], y[i]);
		
		int cnt[2] = {};
		REP(i, 3) {
			int now = (i + 1) % 3;
			p v[2];
			v[0] = point[now] - point[i];
			v[1] = point[3] - point[i];
			
			if (cross(v[0], v[1]) < -EPS) cnt[0]++;
			else cnt[1]++;
		}
		
		if (cnt[0] == 3 || cnt[1] == 3) puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	double x[4], y[4], xp, yp;
	double vx, vy, vpx, vpy;
	double crossZ;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF)
	{
		bool ans = true;
		x[3] = x[0]; y[3] = y[0];
		for(int i = 0; i < 3; i++)
		{
			vx = x[i+1] - x[i];
			vy = y[i+1] - y[i];
			vpx = xp - x[i];
			vpy = yp - y[i];
			//printf("%d: vx=%lf vy=%lf vpx=%lf vpy=%lf\n\n",i,vx,vy,vpx,vpy);
			crossZ = vx * vpy - vy * vpx;
			//printf("cross = %lf\n", crossZ);
			if(crossZ < 0)
			{
				ans = false;
				break;
			}
		}
		cout << (ans?"YES":"NO") << endl;
	}
}

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

double mnk(double a,double b,double c){
  double s = (a + b + c) / 2;
  double S = sqrt(s*(s - a)*(s - b)*(s - c)); //テ」ツδ佚」ツδュテ」ツδウテ」ツ?ョテ・ツ?ャテ・ツシツ?
  return S;
}

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  
  while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){
    double a = sqrt(pow(x1-x2,2) + pow(y1-y2,2));
    double b = sqrt(pow(x1-x3,2) + pow(y1-y3,2));
    double c = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
    double S1 = mnk(a,b,c);
    
    double x = sqrt(pow(x1-xp,2) + pow(y1-yp,2));
    double y = sqrt(pow(x2-xp,2) + pow(y2-yp,2));
    double z = sqrt(pow(x3-xp,2) + pow(y3-yp,2));
    double S2 = mnk(x,y,a) + mnk(x,z,b) + mnk(y,z,c);
    
    if ((float)S1 == (float)S2){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
    
    
  }
  return 0;
}

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

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std{
	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);
}
bool in_triangle(const P& p1,const P& p2,const P& p3,const P& p){
	return cross(p2-p1,p-p1)>0 && cross(p3-p2,p-p2)>0 && cross(p1-p3,p-p3)>0;
}
int main(){
	double x1,y1,x2,y2,x3,y3,x,y;
	for(;~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x,&y);){
		P p1(x1,y1),p2(x2,y2),p3(x3,y3),p(x,y);
		bool in=in_triangle(p1,p2,p3,p);
		puts(in?"YES":"NO");
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;
double helon(double x1,double y1,double x2,double y2,double x3,double y3){
	double a,b,c,s,area;
	a = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	b = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	c = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
	s = (a+b+c)/2;
	area = sqrt(s*(s-a)*(s-b)*(s-c));
	return area;
}

int main(){
	double e=0.0000001;
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double s,s1,s2,s3;
		s = helon(x1,y1,x2,y2,x3,y3);
		s1 = helon(xp,yp,x1,y1,x2,y2);
		s2 = helon(xp,yp,x2,y2,x3,y3);
		s3 = helon(xp,yp,x3,y3,x1,y1);
		cout<<s<<" "<<s1<<" "<<s2<<" "<<s3<<endl;
		if(s1==0 || s2==0 || s3==0)
			cout<<"NO"<<endl;
		else if(fabs(s-(s1+s2+s3))<e)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
	}
	return 0;
}