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 <cstdio>

using namespace std;

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	double max_x, min_x, max_y, min_y;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp), x1 != EOF){
		max_x = min_x = x1;
		max_y = min_y = y1;
		
		if (max_x < x2) max_x = x2;
		if (max_x < x3) max_x = x3;
		if (min_x > x2) min_x = x2;
		if (min_x > x3) min_x = x3;
		if (max_y < y2) max_y = y2;
		if (max_y < y3) max_y = y3;
		if (min_y > y2) min_y = y2;
		if (min_y > y3) min_y = y3;
		
		if (min_x < xp && xp < max_x && min_y < yp && yp < max_y){
			printf("YES\n");
		}
		else printf("NO\n");
	}
}

C++: #include <cstdio>
#include <iostream>
#include <complex>
#define rep(i,n) for(int i=0; i<(n); i++)
#define EPS 1e-10
using namespace std;

typedef complex<double> cd;

double s(cd a, cd b){
  return abs(double(a.real()*b.imag()-a.imag()*b.imag()));
}

int main(){
  cd a[4];

  for(;;){
    rep(i,4){
      double x,y;
      if(!~scanf(" %lf %lf", &x,&y))
        return 0;
      a[i]=cd(x,y);
    }
    
    if(abs(
            s(a[0]-a[3], a[1]-a[3])
            + s(a[1]-a[3], a[2]-a[3])
            + s(a[2]-a[3], a[1]-a[3])
            - s(a[0]-a[1],a[1]-a[2])) < EPS)
      printf("IN\n");
    else
      printf("OUT\n");
  }
  
  return 0;
}

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

int judge(pair<double, double> p1, pair<double, double> p2){
	double S = p1.first*p2.second - p2.first*p1.second;
	if (0 < S) return 1;
	if (0 > S) return -1;
	if (0 == S) return 0;
}

int main(){
	pair<double, double> A, B, C, P;

	while (cin >> A.first >> A.second >> B.first >> B.second >> C.first >> C.second >> P.first >> P.second){
		pair<double, double> AB, BC, CA, AP, BP, CP;
		AB = { B.first - A.first, B.second - A.second };
		BC = { C.first - B.first, C.second - B.second };
		CA = { A.first - C.first, A.second - C.second };
		AP = { P.first - A.first, P.second - A.second };
		BP = { P.first - B.first, P.second - B.second };
		CP = { P.first - C.first, P.second - C.second };
		
		if (judge(AP, AB) == judge(BP, BC) && judge(BP, BC) == judge(CP, CA) && judge(CP, CA) == judge(AP, AB)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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)) * ((y3 - y2) * (0 - x2) - (x3 - x2) * (0 - y2)) < 0 )
      res = false;

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

}

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

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

	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{
		abc=(x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
		if(abc<0) abc*=(-1.0);

		pab=(x1-xp)*(y2-yp)-(x2-xp)*(y1-yp);
		if(pab<0) pab*=(-1.0);

		pac=(x1-xp)*(y3-yp)-(x3-xp)*(y1-yp);
		if(pac<0) pac*=(-1.0);

		pbc=(x2-xp)*(y3-yp)-(x3-xp)*(y2-yp);
		if(pbc<0) pbc*=(-1.0);

		if(abc==(pab+pac+pbc)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

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

int main() {
	double x1, x2, x3, y1, y2, y3, xp, yp, v1, v2, v3;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		v1 = (x2 - x1)*(yp - y1) - (y2 - y1)*(xp - x1);
		v2 = (x3 - x2)*(yp - y2) - (y3 - y2)*(xp - x2);
		v3 = (x1 - x3)*(yp - y3) - (y1 - y3)*(xp - x3);
		if ((v1 > 0 && v2 > 0 && v3 > 0) || (v1 < 0 && v2 < 0 && v3 < 0))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	int x1, x2, x3, y1, y2, y3, xp ,yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		int ab = (y2-y1)/(x2-x1)*(xp-x1)+y1-yp;
		int bc = (y3-y2)/(x3-x2)*(xp-x2)+y2-yp;
		int ca = (y1-y3)/(x1-x3)*(xp-x3)+y3-yp;
		if (ab < 0 && bc < 0 && ca > 0) {
			cout << "YES" << endl;
		} else if (ab < 0 && bc > 0 && ca < 0) {
			cout << "YES" << endl;
		} else if (ab > 0 && bc < 0 && ca < 0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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 ba = sub_vector(v[0] , v[1]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector cb = sub_vector(v[1] , v[2]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ac = sub_vector(v[2] , v[0]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ba.x * bp.y - ba.y * bp.x; //??????
		double c2 = cb.x * cp.y - cb.y * cp.x;
		double c3 = ac.x * ap.y - ac.y * ap.x;
		if((c1<0 && c2<0 && c3 <0)||(c1>0 && c2>0 && c3>0)) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}