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 <math.h>
using namespace std;

double length(double, double, double, double);

double triangle(double x1, double y1, double x2, double y2, double x3, double y3) {
    double a = length(x1, y1, x3, y3);
    double b = length(x2, y2, x3, y3);
    double c = length(x1, y1, x2, y2);

    double d = (a + b - c) / sqrt(a * b) / 2.0; // cos(radian)

    // cout << d << endl;

    return d;
}

double length(double x, double y, double ox, double oy) {
    return pow(x - ox, 2) + pow(y - oy, 2);
}

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double ta = triangle(x1, y1, x2, y2, xp, yp);
        double tb = triangle(x1, y1, x3, y3, xp, yp);
        double tc = triangle(x2, y2, x3, y3, xp, yp);

        if (ta < 0 && tb < 0 && tc < 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }

        if (cin.eof()) break;
    }

    return 0;
}

C++: #include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;
#define EPS (1e-6)
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef pair<double,double> P;

bool isCross(P p1, P p2, P p3, P p4){
  double c = ((p1.first - p2.first) * (p3.second - p1.second) + (p1.second - p2.second) * (p1.first - p3.first)) * 
    ((p1.first - p2.first) * (p4.second - p1.second) + (p1.second - p2.second) * (p1.first - p4.first));
  if(c<=0.0)
    return true;
  return false;
}

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(3);

  int INF = 1000000;

  double x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin >>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    P p1(x1,y1),p2(x2,y2),p3(x3,y3),px(xp,yp);
    if( isCross(p1,p2,p3,px) || isCross(p1,p3,p2,px) || isCross(p2,p3,p1,px) )
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  


  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    double x[4],y[4],xe[2]={},ye[2]={};
    while(cin>>x[0]>>y[0]){
        for(int i=1;i<4;i++)cin>>x[i]>>y[i];
        for(int i=0;i<3;i++){
            xe[0]=max(x[i],xe[0]);
            xe[1]=min(x[i],xe[1]);
            ye[0]=max(y[i],ye[0]);
            ye[1]=min(y[i],ye[1]);
        }
        if(xe[0]>x[3]&&xe[1]<x[3]&&ye[0]>y[3]&&ye[1]<y[3])cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

using namespace std;

typedef struct{
    double x;
    double y;
}vec;
vec makeVec(vec p,vec q){
    vec r;
    r.x=q.x-p.x;
    r.y=q.y-p.y;
    return r;
}

double crossZe(vec p,vec q){
    if(p.x*q.y-p.y*q.x==0.0) return 0.0;
    return (p.x*q.y-p.y*q.x)/fabs(p.x*q.y-p.y*q.x);
}

bool Tri(vec p[3],vec q[3]){
    double c,d;
    c = crossZe(p[0],q[0]);
    if(c==0) return false;
    for(int i=1;i<3;i++){
        d=crossZe(p[i],q[i]);
        if(c!=d||d==0.0) return false;
    }
    return true;
}
int main(int argc, const char * argv[]) {
    vec p[3],q,r[3],rq[3];
    while(cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y){
        cin >> q.x >> q.y;
        r[0]=makeVec(p[0],p[1]);
        r[1]=makeVec(p[1],p[2]);
        r[2]=makeVec(p[2],p[0]);
        rq[0]=makeVec(q,p[1]);
        rq[1]=makeVec(q,p[2]);
        rq[2]=makeVec(q,p[0]);
        if(Tri(r,rq)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

struct TPoint
{
    double x;
    double y;
    TPoint(){}
    TPoint(int X, int Y)
     : x(X), y(Y){}
};
struct TTriangle
{
    TPoint p1;
    TPoint p2;
    TPoint p3;
};
typedef TPoint TVector;
TVector Vector(const TPoint& A, const TPoint& B)
{
    return TVector(B.x - A.x, B.y - A.y);
    // return TVector(A.x - B.x, A.y - B.y);
}
double Cross(const TVector& A, const TVector& B)
{
    return A.x * B.y - B.x * A.y;
}

bool IsContain(const TTriangle& Tri, const TPoint& P)
{
    bool s1 = Cross(Vector(Tri.p1, Tri.p2), Vector(Tri.p1, P)) < 0;
    bool s2 = Cross(Vector(Tri.p2, Tri.p3), Vector(Tri.p2, P)) < 0;
    bool s3 = Cross(Vector(Tri.p3, Tri.p1), Vector(Tri.p3, P)) < 0;
    // std::cout << s1 << s2 << s3 << std::endl;
    return s1 == s2 && s2 == s3;
}
int main()
{
    while(true){
        TTriangle Tri;
        TPoint P;
        std::cin >> Tri.p1.x >> Tri.p1.y >> Tri.p2.x >> Tri.p2.y >> Tri.p3.x >> Tri.p3.y >> P.x >> P.y;
        if(std::cin.eof()) break;
        std::cout << (IsContain(Tri, P) ? "YES" : "NO") << std::endl;
    }
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	while(1){
		bool ans=true;
		double x[3],y[3],xp,yp;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp;
		if(!x[0]&&!x[1]&&!x[2]&&!y[0]&&!y[1]&&!y[2]&&!xp&&!yp) break;
		//???????????¨????????????
		double gaiseki[3];	//gaiseki[i]???????????????P0P1??¨????????????P0Q????????????z??§?¨?
		for(int i=0;i<3;i++){
			int k = (i+1)%3;
			double vx,vy,vpx,vpy;
			vx = x[k]-x[i];
			vy = y[k]-y[i];
			vpx = xp-x[i];
			vpy = yp-y[i];
			gaiseki[i] = vx*vpy-vy*vpx;
			if(gaiseki[i]<=0) ans = false;
		}
		if(ans){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

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

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double EPS = 1e-6;

double x[3],y[3];
double xp,yp;

double dist(P a,P b){
	return (sqrt((real(a)-real(b))*(real(a)-real(b))+(imag(a)-imag(b))*(imag(a)-imag(b))));
}

double tri_pro(P a,P b,P c){
	double aa,bb,cc;
	aa = dist(b,c);
	bb = dist(c,a);
	cc = dist(a,b);
	double s = (aa+bb+cc)/2.0;
	return sqrt(s*(s-aa)*(s-bb)*(s-cc));
}


int main(){
	while(cin>>x[0]>>y[0]){
		rep(i,2) cin>>x[i+1]>>y[i+1];
		cin>>xp>>yp;
		P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
		P p(xp,yp);
		double sa,sb,sc;
		sa = tri_pro(b,c,p);
		sb = tri_pro(c,a,p);
		sc = tri_pro(a,b,p);
		double s = tri_pro(a,b,c);
		//cout<<"s="<<s<<"\nsa sb sc "<<sa<<" "<<sb<<" "<<sc<<endl;
		//printf("s=%.8f\nsa+sb+sc %.8f\n",s,sa+sb+sc);
		if((sa+sb+sc)-s<EPS) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}