Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;
#define EPS 1.0e-12
#define F(I,J,N) for(int I=J;I<N;I++)

class Line{
public:
	P p[2];
	P v;
	Line(){}
	Line(P p0,P p1){
		p[0]=p0;
		p[1]=p1;
		v=p1-p0;
	}
	//線分の長さ
	double length(){return abs(v);}
	//平行
	bool Parallel(Line l){
		return (cross(v,l.v)==0);
	}
	//線分上
	bool OnLine(P a){
		return (abs(p[0]-a)+abs(a-p[1])<length()+EPS);
	}
	double cross(Line l){
		return cross(v,l.p[0]-p[0]) * cross(v,l.p[1]-p[0]);
	}
	double cross(P a,P b){
		return (real(a)*imag(b)-imag(a)*real(b));
	}
	bool Intersection(Line l){
		if(Parallel(l)){
			return (OnLine(l.p[0])||OnLine(l.p[1])||l.OnLine(p[0])||l.OnLine(p[1]));
		}
		return ((cross(l)<EPS) && (l.cross(*this))<EPS);
	}
};

class Pi{
private:
	P *p;
	Line *l;
	int n;
public:
	Pi(){}
	Pi(int n){
		this->n=n;
		p=new P[n+1];
		l=new Line[n];
	}
	~Pi(){
		delete []p;
		delete []l;
	}
	void set(int i,P a){
		if(i==0){
			p[0]=a;
			p[n]=a;
		}
		else p[i]=a;
	}
	void set(){
		F(i,0,n) l[i]=Line(p[i],p[i+1]);
	}
	bool isin(P a,double x){
		int cnt=0;
		F(i,0,n) if(l[i].OnLine(a)) return true;
		P out(x,imag(a));
		Line buf(a,out);
		F(i,0,n){
			if(l[i].Intersection(buf)){
				if(imag(l[i].v)!=0){
					if(imag(p[i])<imag(p[i+1])) cnt++;
					else cnt--;
				}
			}
		}
		F(i,n,2*n){
			if(buf.OnLine(p[i])){
				if(imag(p[(i-1)%n])*imag(p[(i+1)%n])<=0){
					if(imag(p[(i-1)%n])<imag(p[(i+1)%n])) cnt++;
					else cnt--;
				}
			}
		}
		if(cnt&1) return true;
		return false;
	}
};

int main(){
	double a,b,c,d,e,f,g,h;
	P p[3],q;
	Pi *in;
	while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
		p[0]=P(a,b);
		p[1]=P(c,d);
		p[2]=P(e,f);
		q=P(g,h);
		in=new Pi(3);
		F(i,0,3) in->set(i,p[i]);
		in->set();
		if(in->isin(q,-101)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		delete in;
	}
	return 0;
}

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

using namespace std;

typedef complex<double> P;

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

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

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

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        P a(x1, y1), b(x2, y2), c(x3, y3), d(xp, yp);

        if ((cross(b - a, d - a) > -EPS) && 
            (cross(c - b, d - b) > -EPS) &&
            (cross(a - c, d - c) > -EPS))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

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)){
		double a = (x2 - x1) * (yp - y1) - (xp - x1) * (y2 - y1);
		double b = (x3 - x2) * (yp - y2) - (xp - x2) * (y3 - y2);
		double c = (x1 - x3) * (yp - y3) - (xp - x3) * (y1 - y3);
		if(a > 0 && b > 0 && c > 0){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.00001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

double area(double ax, double ay, double bx, double by, double cx, double cy)
{
  double sum;
  double len1,len2,len3;

  len1=sqrt( (ax-bx)*(ax-bx) + (ay-by)*(ay-by) );
  len2=sqrt( (ax-cx)*(ax-cx) + (ay-cy)*(ay-cy) );
  len3=sqrt( (bx-cx)*(bx-cx) + (by-cy)*(by-cy) );

  double s=(len1+len2+len3)/2;

  sum=sqrt(s*(s-len1)*(s-len2)*(s-len3));

  return sum;
}


int main()
{
  double x1,x2,x3,y1,y2,y3,px,py;
  double s1,s2,s3,s4;

  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
	      &x1,&y1,&x2,&y2,&x3,&y3,&px,&py)!=EOF){

    s1=area(x1,y1,x2,y2,px,py);
    s2=area(x1,y1,x3,y3,px,py);
    s3=area(x2,y2,x3,y3,px,py);
    s4=area(x1,y1,x2,y2,x3,y3);

    if(s1+s2+s3-s4<EPS)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;

  }
}

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

float S(float a, float b, float c, float d, float e, float f) {
	float ans;
	ans = abs((a - e) * (d - f) - (b - f) * (c - e));
	return ans/2;
}

int main(){
	float x[4], y[4], s[3], SS, SSS;

	while(true){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (cin.eof()) { break; }
		s[0] = S(x[0], y[0], x[1], y[1], x[3], y[3]);
		s[1] = S(x[0], y[0], x[2], y[2], x[3], y[3]);
		s[2] = S(x[1], y[1], x[2], y[2], x[3], y[3]);
		if(s[0] * s[1] * s[2] == 0){ 
			cout << "NO" << endl;
			continue;
		}
		SS = s[0] + s[1] + s[2];
		SSS = S(x[0], y[0], x[1], y[1], x[2], y[2]);

		if (SS == SSS) { cout << "YES" << endl; }
		else { cout << "NO" << endl; }
	}
	return 0;
}

C++: struct Vec2 {
  double x, y;
  Vec2(double x_, double y_) : x(x_), y(y_) {}
};

bool in_the_triangle(const Vec2& a, const Vec2& b, const Vec2& c, const Vec2& p) {
  Vec2 aa(a.x-p.x, a.y-p.y);
  Vec2 bb(b.x-p.x, b.y-p.y);
  Vec2 cc(c.x-p.x, c.y-p.y);
  double k = aa.x*bb.y - bb.x*aa.y;
  double l = bb.x*cc.y - cc.x*bb.y;
  double m = cc.x*aa.y - aa.x*cc.y;
  return (k * l > 0 && k * m > 0);
}

int main() {
Vec2 a,b,c,p;
while (scanf("%f%f%f%f%f%f%f%f",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y,&p.x,&p.y)) {
  puts(in_the_triangle(a,b,c,p) ? "YES" : "NO");
}
return 0;
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 //int v[35];
 
 double triangleArea(double xa,double ya,double xb,double yb,double xc,double yc) 
 {
    double result = ((xa * yb + xb * yc + xc * ya- xb * ya - xc * yb - xa * yc) / 2.0);
    if(result<0) result=-result;
    return result;
 }
 
 int main()
 {
   double x1,y1,x2,y2,x3,y3,xp,yp;
   while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
   {
     double triangleAreaKK = triangleArea(x1,y1, x2,y2, x3,y3);
     double area = triangleArea(xp,yp, x1,y1, x2,y2);
     area += triangleArea(xp,yp, x1,y1, x3,y3);
     area += triangleArea(xp,yp, x2,y2, x3,y3);
     if(((triangleAreaKK-area)<0.00000001)&&((triangleAreaKK-area)>-0.00000001)) puts("YES");
     else puts("NO");     
   }
   //while(1);      
   return 0;    
 }