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 <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(abs(sq - (sqd + sqe + sqf)) < EPS){
            if(sqd == 0 || sqe == 0 || sqf == 0){
                cout << "NO" << endl;
            }
            else {
                cout << "YES" << endl;
            }
        }
        else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

#define EPS 1e-3

using namespace std;

typedef complex<double> P;

double cross(P v1,P v2){
	return v1.real()*v2.imag()-v1.imag()*v2.real();
}

bool che(P v1,P v2,P v3,P v){
	if(cross(v2-v1,v-v1)<-EPS&&cross(v3-v2,v-v2)<-EPS&&cross(v1-v3,v-v3)<-EPS)return true;
	else if(cross(v2-v1,v-v1)>EPS&&cross(v3-v2,v-v2)>EPS&&cross(v1-v3,v-v3)>EPS)return true;
	return false;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xP,yP;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xP>>yP){
		P v=P(xP,yP);
		P v1=P(x1,y1);
		P v2=P(x2,y2);
		P v3=P(x3,y3);
		
		if(che(v1,v2,v3,v))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		
		
	}
}

C++: //template
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

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

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl
#define CIN(x) cin>>(x)

int main(){

	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){

		//A点を原点に移動
		x2 -= x1; y2 -= y1;
		x3 -= x1; y3 -= y1;
		xp -= x1; yp -= y1;

		double k1, k2;
		k2 = (yp - (y2 / x2)*xp) / (y3 - (y2 / x2)*x3);
		k1 = (xp - k2*x3) / x2;

		if ((k1 > 0) && (k2 > 0) && (k1 + k2 < 1)) COUT("YES");
		else COUT("NO");
	}

	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,&x1,&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 <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

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 x1,x2,x3,y1,y2,y3,xp,yp,AB,BC,CA,AP,BP,CP,S,PS;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		//A(x1,y1) B(x2,y2) C(x3,y3) P(xp,yp)
		AB = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
		BC = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
		CA = sqrt(pow(x3-x1,2)+pow(y3-y1,2));

		AP = sqrt(pow(xp-x1,2)+pow(yp-y1,2));
		BP = sqrt(pow(xp-x2,2)+pow(yp-y2,2));
		CP = sqrt(pow(xp-x3,2)+pow(yp-y3,2));

		S = heron(AB,BC,CA);
		PS = (heron(AB,AP,BP)+heron(BC,BP,CP)+heron(CA,CP,AP));
		
		if((PS-S)<0.0001)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	
	}

	return 0;
}

C++: #include <cstdio>

using namespace std;

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	double max_x, min_x, max_y, min_y;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp), x1 != EOF){
		max_x = min_x = x1;
		max_y = min_y = y1;
		
		if (max_x < x2) max_x = x2;
		if (max_x < x3) max_x = x3;
		if (min_x > x2) min_x = x2;
		if (min_x > x3) min_x = x3;
		if (max_y < y2) max_y = y2;
		if (max_y < y3) max_y = y3;
		if (min_y > y2) min_y = y2;
		if (min_y > y3) min_y = y3;
		
		if (min_x < xp && xp < max_x && min_y < yp && yp < max_y){
			printf("YES\n");
		}
		else printf("NO\n");
	}
}

C++: #include <cstdio>
#include <iostream>
#include <complex>
#define rep(i,n) for(int i=0; i<(n); i++)
#define EPS 1e-10
using namespace std;

typedef complex<double> cd;

double s(cd a, cd b){
  return abs(double(a.real()*b.imag()-a.imag()*b.imag()));
}

int main(){
  cd a[4];

  for(;;){
    rep(i,4){
      double x,y;
      if(!~scanf(" %lf %lf", &x,&y))
        return 0;
      a[i]=cd(x,y);
    }
    
    if(abs(
            s(a[0]-a[3], a[1]-a[3])
            + s(a[1]-a[3], a[2]-a[3])
            + s(a[2]-a[3], a[1]-a[3])
            - s(a[0]-a[1],a[1]-a[2])) < EPS)
      printf("IN\n");
    else
      printf("OUT\n");
  }
  
  return 0;
}

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

int judge(pair<double, double> p1, pair<double, double> p2){
	double S = p1.first*p2.second - p2.first*p1.second;
	if (0 < S) return 1;
	if (0 > S) return -1;
	if (0 == S) return 0;
}

int main(){
	pair<double, double> A, B, C, P;

	while (cin >> A.first >> A.second >> B.first >> B.second >> C.first >> C.second >> P.first >> P.second){
		pair<double, double> AB, BC, CA, AP, BP, CP;
		AB = { B.first - A.first, B.second - A.second };
		BC = { C.first - B.first, C.second - B.second };
		CA = { A.first - C.first, A.second - C.second };
		AP = { P.first - A.first, P.second - A.second };
		BP = { P.first - B.first, P.second - B.second };
		CP = { P.first - C.first, P.second - C.second };
		
		if (judge(AP, AB) == judge(BP, BC) && judge(BP, BC) == judge(CP, CA) && judge(CP, CA) == judge(AP, AB)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}