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;

struct Vector{
	double x;
	double y;
};

Vector sub_vector(Vector &a , Vector &b){
	Vector ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ab = sub_vector(v[1] , v[0]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector bc = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ab.x * ap.y - ab.y * ap.x; //??????
		double c2 = bc.x * bp.y - bc.y * bp.x;
		double c3 = ca.x * cp.y - ca.y * cp.x;
		if((c1<=0 && c2<=0 && c3 <=0)||(c1>=0 && c2>=0 && c3>=0)) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}

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

bool ss(double a, double b, double c, double u, double v, double x, double y) {
	if ((a * u + b * v + c) * (a * x + b * y + c) > 0) {
		return true;
	}
	else
		return false;
}

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
		
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		if (ss(y1 - y2, x2 - x1, x1 * y2 - x2 * y1, x3, y3, xp, yp) &&
			ss(y2 - y3, x3 - x2, x2 * y3 - x3 * y2, x1, y1, xp, yp) &&
			ss(y3 - y1, x1 - x3, x3 * y1 - x1 * y3, x2, y2, xp, yp))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

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

using namespace std;

struct Point2D {
  double x,y;

  Point2D operator-(Point2D &p);
  friend istream &operator>>(istream &is, Point2D &t);
  friend double cross(Point2D &a, Point2D &b);
};

Point2D Point2D::operator-(Point2D &p) {
  Point2D t;
  t.x = x - p.x;
  t.y = y - p.y;
  return t;
}

istream &operator>>(istream &is, Point2D &t) {
  is >> t.x >> t.y;
  return is;
}

double cross(Point2D &a, Point2D &b) {
  return a.x * b.y - a.y * b.x;
}

int judge(double t) {
  if(t>0.0) return 1;
  else if(t<0.0) return -1;
  else return 0;
}

int main() {
  vector<Point2D> t(3);
  Point2D p;
  
  while(cin >> t[0] >> t[1] >> t[2] >> p) {
    int key = 0;
        
    for(int i = 0; i < 3; i++) {
      Point2D m = t[i] - t[( i + 1 ) % 3];
      Point2D n = t[i] - p;
      key += judge(cross(m, n));
    }
    cout << ((abs(key) == 3) ? "YES" : "NO") << endl;
  }
  
  return 0;
}

C++: #include<stdio.h>
int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)){
		bool ok=true;
		if(x1*y4-x4*y1<0)ok=false;
		if(x2*y4-x4*y2<0)ok=false;
		if(x3*y4-x4*y3<0)ok=false;
		printf(ok?"NO\n":"YES\n");
	}
}

C++: #include <iostream>
#include <cmath>
#define mul(s, t) ((s-t)*(s-t))

using namespace std;

int main()
{
	double x[3], y[3], u[2], s, t, v;
	
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> s >> t){
		bool f = true;
		for(int i = 0; i < 3; i++){
			int p = 0;
			for(int j = 0; j < 3; j++){
				if(i != j){
					u[p++] = sqrt(mul(x[i], x[j])+mul(y[i], y[j]));
				}
			}
			v = sqrt(mul(x[i], s)+mul(y[i], t));
			
			if(u[0] <= v || u[1] <= v){
				f = false;
				break;
			}
		}
		cout << ((f)? "YES" : "NO") << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double a,b,c,d,e,f,x,y;
  double s,t;

  while(cin>>a>>b>>c>>d>>e>>f>>x>>y){
    s=((e-d)*(x-c)-(e-c)*(y-d))/((a-c)*(e-d)-(e-c)*(b-d));
    t=((a-c)*(y-d)-(b-d)*(x-c))/((a-c)*(e-d)-(e-c)*(b-d));

    if(0<s+t&&s+t<1){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

struct Vec2d{
  double x,y;
};

double cross(Vec2d &A, Vec2d &B){
  return A.x*B.y - A.y*B.x;
}

int main(void){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
	  Vec2d AB,AP,BC,BP,CA,CP;
	  AB.x = x2-x1; AB.y = y2-y1;
	  BC.x = x3-x2; BC.y = y3-y2;
	  CA.x = x1-x3; CA.y = y1-y3;
	  AP.x = xp-x1; AP.y = yp-y1;
	  BP.x = xp-x2; BP.y = yp-y2;
	  CP.x = xp-x3; CP.y = yp-y3;
	  if(fabs(cross(AB,AP))>0.0 
	  && fabs(cross(BC,BP))>0.0
	  && fabs(cross(CA,CP))>0.0)
	  	cout<<"YES"<<endl;
	  else
	  	cout<<"NO"<<endl;
  }
  return 0;
}

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-x1) - b[0] * (yp-y1)) / (a[0] * b[1] - b[0] * a[1]);
      B = (a[1] * (xp-x1) - (yp-y1) * 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;
  }
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;

int main(){
	double x1, x2, x3, y1, y2, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double xa = x2 - x1;
		double ya = y2 - y1;
		double xb = x3 - x1;
		double yb = y3 - y1;
		double x = xp - x1;
		double y = yp - y1;
		double div = xa * yb - xb * ya;
		double a = (yb * x - xb * y) / div;
		double b = (-ya * x + xa * y) / div;
		if (a >= 0 && b >= 0 && a + b <= 1) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdlib>
#include<complex>
using namespace std;
typedef complex<double> Po;

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

double area(Po a,Po b, Po c){return abs(cross(b-a,c-a))/2;}

bool inter(Po a, Po b,Po c,Po x){
return (fabs(area(a,b,x)+area(b,c,x)+area(c,a,x)-area(a,b,c))<1e-10);
}

int main(){
Po p[4];
while(cin>>p[0].real() >> p[0].imag()){
for(int i=1;i<4;i++)cin >> p[i].real() >> p[i].imag();
if(inter(p[0],p[1],p[2],p[3]))cout << "YES\n";
else cout << "NO\n";
}
}

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

struct point{
    double x,y;
    point(double _x , double _y){
        x = _x , y = _y;
    }
};

bool insidePoly( point p,vector<point>P  ) {
	bool inside = false;
	int n = P.size();
	for( int i = 0, j = n - 1; i < n; j = i++ )
		if( (( P[i].x < p.x ) ^ ( P[j].x < p.x )) &&
        (P[i].y - P[j].y) * fabs(p.x - P[j].x) < (p.y - P[j].y) * abs(P[i].x - P[j].x) )
			inside = !inside;
	return inside;
}

int main()
{

     double x,y;
    while(cin>>x>>y)
    {
        vector<point>P;
        P.push_back(point(x,y));

        for( int i = 0 ; i < 2 ; i++ ){
                scanf("%lf %lf",&x,&y);
                P.push_back(point(x,y));
        }
        scanf("%lf %lf",&x,&y);

        bool f = insidePoly(point(x,y),P);

        if(f)puts("YES"); else puts("NO");

    }
}