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

constexpr double pi = 3.14159265358979323846;

struct vec2d
{
    double x, y;

    double dot(vec2d const & other)
    {
        return x * other.x + y * other.y;
    }

    double norm()
    {
        return sqrt(x * x + y * y);
    }
};

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

    vec2d v12, v23, v31;
    vec2d v1p, v2p, v3p;
    double a121p, a232p, a313p;

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        v12 = vec2d{x2 - x1, y2 - y1};
        v23 = vec2d{x3 - x2, y3 - y2};
        v31 = vec2d{x1 - x3, y1 - y3};

        v1p = vec2d{xp - x1, yp - y1};
        v2p = vec2d{xp - x2, yp - y2};
        v3p = vec2d{xp - x3, yp - y3};

        a121p = acos(v12.dot(v1p) / (v12.norm() * v1p.norm()));
        a232p = acos(v23.dot(v2p) / (v23.norm() * v2p.norm()));
        a313p = acos(v31.dot(v3p) / (v31.norm() * v3p.norm()));

        if (a121p <= pi / 2 && a232p <= pi / 2 && a313p <= pi / 2) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

C++: #include <stdio.h>
#include <math.h>
 
int main()
{
    double x1, x2, x3, y1, y2, y3, xp, yp;
    double s, s1, s2, s3;
     
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
        //?????§????¢??????¢???
        s  = ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)) / 2.0; 
        s1 = ((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1)) / 2.0;
        s2 = ((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1)) / 2.0;
        s3 = ((xp - x2) * (y3 - y2) - (yp - y2) * (x3 - x2)) / 2.0;
         
        s  = fabs(s);
        s1 = fabs(s1);
        s2 = fabs(s2);
        s3 = fabs(s3);
         
        if (fabs(s -fabs(s1 + s2 + s3))<1e-10) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

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

int main()
{
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    if(y1 < y2){
      swap(x1, x2);
      swap(y1, y2);
    }
    if(y1 < y3){
      swap(x1, x3);
      swap(y1, y3);
    }
    
    if(((x2 - x1 != 0) ? (yp < (y2 -y1) / (x2 - x1) * (xp - x1) + y1) : (0 < (y2 - y1) * (xp - x1))) && ((x3 - x1 != 0) ? (yp < (y3 -y1) / (x3 - x1) * (xp - x1) + y1) : (0 < (y3 - y1) * (xp - x1))) && ((x2 - x3 != 0) ? (yp > (y2 -y3) / (x2 - x3) * (xp - x3) + y3) : (0 > (y2 - y3) * (xp - x3)))){
	cout << "YES" << endl;
      }else{
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    bool res = false;
    // 平行移動
    x2 -= x1;
    x3 -= x1;
    xp -= x1;
    y2 -= y1;
    y3 -= y1;
    yp -= y1;
    // 傾き
    if (((y3 * xp > yp * x3) && (yp * x2 > y2 * xp)) || ((y2 * xp > yp * x2) && (yp * x3 > y3 * xp)))
      res = true;

    if (!res) {
      cout << "NO" << endl;
      continue;
    }

    // cout << "ok" << endl;
    // 直線BCの下にある
    // y - y1 = (y2 - y1)/(x2 - x1) (x - x1)
    if ( (y3 - y2) * (xp - x2) - (x3 - x2) * (yp - y2) > 0 )
      res = false;

    if (res) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }

}

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
typedef complex<double> xy_t;

double crossPro(xy_t a, xy_t b)
{
	return (conj(a) * b).imag();
}

int main()
{
	double x[4],y[4];
	while(1)
	{
		for (int i = 0; i < 4; ++i)
		{
			cin >> x[i] >> y[i];
		}

		if (!cin) break;

		xy_t a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]),p(x[3],y[3]);
		double s1 = crossPro(a-p,b-p);
		double s2 = crossPro(b-p,c-p);
		double s3 = crossPro(c-p,a-p);
		bool ok = false;
		if (((s1>0)&&(s2>0)&&(s3>0))||((s1<0)&&(s2<0)&&(s3<0)))
		{
			ok = true;
		}

		if (ok)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

struct Point { double x,y;} p[4];

bool isIntersect(int i, int j, int k, int l){
	double kd = ((p[i].x - p[j].x) * (p[k].y - p[i].y) + (p[i].y - p[j].y) * (p[i].x - p[k].x));
	double ld = ((p[i].x - p[j].x) * (p[l].y - p[i].y) + (p[i].y - p[j].y) * (p[i].x - p[l].x));
	return (kd*ld<0);
}

int main(){
	while(1){
		if(cin.eof()) break;
		for(int i=0; i<4; i++)
			cin >> p[i].x >> p[i].y;
		if(!cin.eof()){
			if (isIntersect(0, 1, 2, 3) || isIntersect(0, 2, 1, 3) || isIntersect(1, 2, 0, 3))
				cout << "NO";
			else cout << "YES";
			cout << endl;
		}
	}
	return 0;
}

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

const double EPS = 1e-9;

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))>EPS && fabs(cross(BC,BP))>EPS && fabs(cross(CA,CP)>EPS)) cout<<"YES"<<endl;
	  else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
#include <math.h>
 
int main()
{
    double x1, y1, x2, y2, x3, y3, x, y;
    double ax, ay, bx, by;
    double z1, z2, z3; // ????????????A??¨????????????B????????????z??????
     
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y) {
        ax = x2 - x1;
        ay = y2 - y1;
        bx = x - x1;
        by = y - y1;
        z1 = ax * by - ay * bx;
         
        ax = x3 - x2;
        ay = y3 - y2;
        bx = x - x2;
        by = y - y2;
        z2 = ax * by - ay * bx;
         
        ax = x1 - x3;
        ay = y1 - y3;
        bx = x - x3;
        by = y - y3;
        z3 = ax * by - ay * bx;
         
        if ( ( (z1 > 0) && (z2 > 0) && (z3 > 0) ) || ( (z1 < 0) && (z2 < 0) && (z3 < 0) ) )
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
struct vect{
  double x,y;
};
double leng(vect a,vect b){
  return sqrt((a.x - b.x)*(a.x - b.x)+(a.y - b.y)*(a.y - b.y));
    }
double Sc(vect a,vect b,vect c){
  double S,l1,l2,l3; 
  l1 = leng(a,b);
  l2 = leng(b,c);
  l3 = leng(c,a);
  S = (l1 + l2 + l3) / 2;
  return sqrt(S*(S-l1)*(S-l2)*(S-l3));
  
}

int main(){
  vect a,b,c,p;
  double s1,s2,s3,s;
  while(cin >> a.x >> a.y  >> b.x >> b.y >>c.x >>c.y >> p.x >> p.y){
    s1 = Sc(a,b,p); s2 = Sc(a,p,c); s3 = Sc(p,b,c); 
    s = Sc(a,b,c);
    if( Sc(p,b,c) + Sc(a,p,c) < Sc(a,b,c) ){cout << "YES" << endl;
    }else {cout << "NO" << endl;}
    
  }
}