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

class Point{
    public:
    double x;
    double y;
};

 double vecProduct(Point p1, Point p2, Point p3)
{
    return ((p1.x - p3.x)*(p2.y - p3.y) - (p2.x - p3.x)*(p1.y - p3.y));
}
    
bool isPointInTriangle(Point pt, Point v1, Point v2, Point v3)
{
    
    bool r1 = vecProduct(pt,v1,v2) < 0.0;
    bool r2 = vecProduct(pt,v2,v3) < 0.0;
    bool r3 = vecProduct(pt,v3,v1) < 0.0;
    
    return ((r1 == r2) && (r2 == r3));
}

int main(void){
   Point p1,p2,p3,pt;
   
   while(cin>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y>>pt.x>>pt.y)
   {
        if(isPointInTriangle(pt,p1,p2,p3))
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
   }
}

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

int main(void) {
	double x[4], y[4];
	double px, py;

	while(!cin.eof()) {
		bool l, r;
		l = r = false;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> px >> py;
		x[3] = x[0];
		y[3] = y[0];

		for(int i = 0; i < 3; i++) {
			if(x[i]*py - y[i]*px < 0)
				r = true;
			else
				l = true;
		}

		cout << (r ^ l ? "NO" : "YES") << endl;
	}
	return 0;

}

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


int main(){
	
	double x1,x2,x3;
	double	y1,y2,y3;
	double xp,yp;
	double	A,B,C,a,b,c;
	
	while(cin>>x1){
		cin>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
		
		A=pow(x1-x2,2)+pow(y1-y2,2);
		B=pow(x1-x3,2)+pow(y1-y3,2);
		C=pow(x2-x3,2)+pow(y2-y3,2);
		a=pow(xp-x1,2)+pow(yp-y1,2);
		b=pow(xp-x2,2)+pow(yp-y2,2);
		c=pow(xp-x3,2)+pow(yp-y3,2);
		
		if(a>A||a>B||a>C||b>A||b>B||b>C||c>A||c>B||c>C)
			cout<<"NO"<<endl;
		else
			cout<<"YES"<<endl;
	}
	
}

C++: #include <cstdio>
#include <algorithm>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){

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

while(scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&xp,&yp) != EOF){

sort(x,x+3);
sort(y,y+3);

if(x[0] < xp && xp < x[2] && y[0] < yp && yp < y[2]){
	printf("YES\n");
}else{
	printf("NO\n");
}

}
return 0;		
}

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

bool is_inner(d a1,d a2,d b1,d b2,d c1,d c2) {
  if(((b1-a1)*(c2-b2)-(b2-a2)*(c1-b1)) >0) return true;
  return false;
}
int main() {
  d x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    bool a,b,c;
    a = is_inner(x1,y1,x2,y2,xp,yp);
    b = is_inner(x2,y2,x3,y3,xp,yp);
    c = is_inner(x3,y3,x1,y1,xp,yp);
    if(a == b && b == c) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

struct vector2D
{
	double x, y;

	vector2D(double x, double y)
	{
		this->x = x;
		this->y = y;
	}
};

vector2D vec(double ax, double ay, double bx, double by)
{
	return vector2D(bx - ax, by - ax);
}

double outer(vector2D a, vector2D b)
{
	return a.x * b.y - a.y * b.x;
}

int main()
{
	vector<double> x(3);
	vector<double> y(3);
	double xp, yp;
	for (;cin >> x.at(0) >> y.at(0) >> x.at(1) >> y.at(1) >> x.at(2) >> y.at(2) >> xp >> yp;)
	{
		vector2D ab = vec(x.at(1), y.at(1), x.at(0), y.at(0));
		vector2D bc = vec(x.at(2), y.at(2), x.at(1), y.at(1));
		vector2D ca = vec(x.at(0), y.at(0), x.at(2), y.at(2));

		vector2D ap = vec(xp, yp, x.at(0), y.at(0));
		vector2D bp = vec(xp, yp, x.at(1), y.at(1));
		vector2D cp = vec(xp, yp, x.at(2), y.at(2));


		if ((outer(ab, bp) >= 0 && outer(bc, cp) >= 0 && outer(ca, ap) >= 0) || (outer(ab, bp) <= 0 && outer(bc, cp) <= 0 && outer(ca, ap) <= 0))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

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

int edinton(int i,int j, int k);
double cross(double *a,double *b);

int main(){
    double p[4][3],z[3];
    int sum=0;
    for(int l=0;l<4;l++){
        cin >> p[l][0] >> p[l][1];
        p[l][2]=0;
    }
    for(int i=0;i<3;i++){
        z[i]=cross(p[i],p[3]);
        z[i]=z[i]/fabs(z[i]);
        sum+=z[i];
    }
    if(sum==3) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

int edinton(int i,int j, int k){
    int a=1,b=2,c=3,d;
    for(int l=0;l<3;l++){
        if(i==a&&j==b&&k==c) return 1;
        d=c;c=b;b=a;a=d;
    }
    a=3; b=2; c=1;
    for(int l=0;l<3;l++){
        if(i==a&&j==b&&k==c) return -1;
        d=c;c=b;b=a;a=d;
    }
    return 0;
}
double cross(double *a,double *b){
    double c=0;
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)
            for(int k=1;k<=3;k++){
                c+=edinton(i, j, k)*a[j]*b[k];
            }
    return c;
}

C++: #include<iostream>
using namespace std;
class Vector {
public:
  double x;
  double y;
  Vector(double xx=0,double yy=0) {x=xx;y=yy;}
  Vector operator+(Vector p) ;
  Vector operator-(Vector p);
};
Vector Vector::operator+(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
Vector Vector::operator-(Vector p) {
  Vector tmp;
  tmp.x=x-p.x;
  tmp.y=y-p.y;
  return tmp;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P);

int main() {
  double x1,x2,x3,y1,y2,y3,x,y;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y) {
    Vector A(x1,y1);
    Vector B(x2,y2);
    Vector C(x3,y3);
    Vector P(x,y);
    if(check_hit(A,B,C,P))
      cout<<"YES\n";
    else
      cout<<"NO\n"; 
   }
  return 0;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P) {
  Vector AB=B-A;
  Vector BC=C-B;
  Vector CA=A-C;
  Vector AP=P-A;
  Vector BP=P-B;
  Vector CP=P-C;
  double calc1=AB.x*BP.y - AB.y*BP.x;
  double calc2=BC.x*CP.y - BC.y*CP.x;
  double calc3=CA.x*AP.y - CA.y*AP.x;
  if( (calc1>0 && calc2>0 && calc3>0)||(calc1<0 && calc2<0 && calc3<0) )
    return true;
  return false;
      }

C++: #include <iostream>
#include <cmath>
#define EPS 1.0e-5
using namespace std;

int main() {
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a[2],b[2];
  double A,B;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    //    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " " << xp << " " << yp << endl;
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;
    if(fabs(a[0]*b[0]+a[1]*b[1]) != 1) {
      A = ( b[1] * xp - b[0] * yp) / (a[0] * b[1] - b[0] * a[1]);
      B = (a[1] * xp - yp * a[0]) / (a[1] * b[0] - b[1] * a[0]);
      if ((A+B < 1) && (A > 0) && (B > 0)) {
        cout << "YES" << endl;
      }
      else {
        cout << "NO" << endl;
      }
    }
    else
      cout << "NO" << endl;
  }
}