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>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-7)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

//作成中
class Point3d{
public:
  double x,y,z;

  Point3d(double x=0,double y=0,double z=0):x(x),y(y),z(z){}

  Point3d operator + (const Point3d& a){
    return Point3d(x+a.x,y+a.y,z+a.z);
  }
  Point3d operator - (const Point3d& a){
    return Point3d(x-a.x,y-a.y,z-a.z);
  }
  Point3d operator * (const double& d){
    return Point3d(x*d,y*d,z*d);
  }
  Point3d operator / (const double& d){
    return Point3d(x/d,y/d,z/d);
  }

  bool operator < (const Point3d& p)const{
    return !equals(x,p.x)?x<p.x:((!equals(y,p.y))?y<p.y:z<p.z);
  }

  bool operator == (const Point3d& p)const{
    return equals(x,p.x) && equals(y,p.y) && equals(z,p.z);
  }

};

struct Segment3d{
  Point3d p[2];
  Segment3d(Point3d p1=Point3d(),Point3d p2=Point3d()){
    p[0] = p1, p[1] = p2;
  }
  bool operator == (const Segment3d& seg)const{
    return p[0] == seg.p[0] && p[1] == seg.p[1];
  }
};

typedef Point3d Vector3d;
typedef Segment3d Line3d;

ostream& operator << (ostream& os,const Point3d& p){
  os << "(" << p.x << "," << p.y << "," << p.z << ")";
}

ostream& operator << (ostream& os,const Segment3d& seg){
  os << "(" << seg.p[0] << "," << seg.p[1] << ")";
}

double dot(const Point3d& a,const Point3d& b){
  return a.x*b.x + a.y*b.y + a.z*b.z;
}

Vector3d cross(const Point3d& a,const Point3d& b){
  return Vector3d(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);
}

bool point_on_the_triangle3d(Point3d tri1,Point3d tri2,Point3d tri3,Point3d p){
  Vector3d v1 = tri2 - tri1;
  Vector3d v2 = tri3 - tri2;
  Vector3d v3 = tri1 - tri3;
  bool res  = ( cross(v1,p-tri1).z >= 0 ); //線分上にある場合もtrue,　線分上にある場合は駄目とするならば > 0 とすること
  bool res2 = ( cross(v2,p-tri2).z >= 0 );
  bool res3 = ( cross(v3,p-tri3).z >= 0 );
  return res == res2 && res2 == res3;
}

const string Y = "YES", N = "NO";
int main(){
  Point3d tri[3],p;
  while(cin >> tri[0].x >> tri[0].y >> tri[1].x >> tri[1].y >> tri[2].x >> tri[2].y >> p.x >> p.y){
    cout << (point_on_the_triangle3d(tri[0],tri[1],tri[2],p)?Y:N) << endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
  double x[3], y[3], cx, cy;
  double p[3];
  
  while (scanf("%lf%lf", &x[0], &y[0])){
    scanf("%lf%lf%lf%lf%lf%lf", &x[1], &y[1], &x[2], &y[2], &cx, &cy);
    for (int i=0; i<3; i++){
      int j=(i+1)%3;
      p[i] = (x[i]-cx)*(y[j]-cy)-(x[j]-cx)*(y[i]-cy);
      printf("%lf\n", p[i]);
    }
    puts(p[0]*p[1]<0||p[1]*p[2]<0||p[2]*p[0]<0 ? "NO": "YES");
  }
  return 0;
}

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.0000000001;
	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;
}

C++: #include<iostream>

using namespace std;

bool get_line( double , double , double , double , double& , double& );

int main(void)
{
	double x1, x2, x3, xp;
	double y1, y2, y3, yp;
	double a1, a2, a3, b1, b2, b3;
	bool result1 , result2 , result3;

	int flag1, flag2, flag3;
	int flag1p , flag2p , flag3p;

	while(1)
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
		if( cin.eof() ) break;

		result1 = get_line( x1 , y1 , x2 , y2 , a1 , b1 );
		result2 = get_line( x2 , y2 , x3 , y3 , a2 , b2 );
		result3 = get_line( x3 , y3 , x1 , y1 , a3 , b3 );

		if( result1 == true )
		{
			if( y3 > a1 * x3 + b1 ) flag1 = 1;
			else flag1 = 0;
			if( yp > a1 * xp + b1 ) flag1p = 1;
			else flag1p = 0;
		}
		else
		{
			if( x3 > (x1+x2)/2 ) flag1 = 1;
			else flag1 = 0;
			if( xp > (x1+x2)/2 ) flag1p = 1;
			else flag1p = 0;
		}
		if( result2 == true )
		{
			if( y1 > a2 * x1 + b2 ) flag2 = 1;
			else flag2 = 0;
			if( yp > a2 * xp + b2 ) flag2p = 1;
			else flag2p = 0;

		}
		else
		{
			if( x1 > (x2+x3)/2 ) flag2 = 1;
			else flag2 = 0;
			if( xp > (x2+x3)/2 ) flag2p = 1;
			else flag2p = 0;
		}
		if( result3 == true )
		{
			if( y2 > a3 * x2 + b3 ) flag3 = 1;
			else flag3 = 0;
			if( yp > a3 * xp + b3 ) flag3p = 1;
			else flag3p = 0;
		}
		else
		{
			if( x2 > (x3+x1)/2 ) flag3 = 1;
			else flag3 = 0;
			if( xp > (x3+x1)/2 ) flag3p = 1;
			else flag3p = 0;
		}

		if( flag1 == flag1p && flag2 == flag2p && flag3 == flag3p ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}


	return 0;
}

bool get_line( double x1 , double y1 , double x2 , double y2 , double& a , double& b )
{
	if( x1 - x2 >= -0.0001 && x1 - x2 <= 0.0001 )
	{
		return false;
	}
	else
	{
		a = ( y1 - y2 )/( x1 - x2 );
		b = y1 - a * x1;

		return true;
	}
}

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

int main(){
	double a,b,c,d,e,f,p,q;
	bool j;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
		
			j = true;
			if(a==c){
				if(!(p>a==e>a))j=false;
			}
			else{
				if( !( (q>(b-d)/(a-c)*p-(a*d-b*c)/(c-a))==(f>(b-d)/(a-c)*e-(a*d-b*c)/(c-a)) ) )j=false;
			}
			if(c==e){
				if(!(p>c==a>c))j=false;
			}
			else{
				if(!( (q>(d-f)/(c-e)*p-(c*f-d*e)/(e-c))==(b>(d-f)/(c-e)*a-(c*f-d*e)/(e-c)) ))j=false;
			}
			if(e==a){
				if(!(p>e==c>e))j=false;
			}
			else{
				if(!( (q>(f-b)/(e-a)*p-(e*b-a*e)/(a-e))==(d>(f-b)/(e-a)*c-(e*b-a*f)/(a-e)) ))j=false;
			}
			if(j){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		
	}
	return 0;
}