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;
int main(){
  double p[4][2],m[2][2],mi[2][2],det,x[2],a[2];
  while(cin >>p[0][0]>>p[0][1]>>p[1][0]>>p[1][1]>>p[2][0]>>p[2][1]>>p[3][0]>>p[3][1]){
    for(int i=1; i<4; i++) for(int j=0; j<2; j++) p[i][j]-=p[0][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) m[i][j] = p[j+1][i];
    for(int i=0; i<2; i++) x[i] = p[3][i];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    mi[0][0] = m[1][1]/det;
    mi[0][1] = -m[0][1]/det;
    mi[1][0] = -m[1][0]/det;
    mi[1][1] = m[0][0]/det;
    for(int i=0; i<2; i++) a[i] = mi[i][0]*x[0]+mi[i][1]*x[1];
    if(a[0]>0 && a[1]>0 && a[0]+a[1]<1) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define EPS 10e-12
using namespace std;
double heron(double a,double b,double c){
  double s = (a+b+c)/2;
  return sqrt(s*(s - a)*(s - b)*(s - c));
}

int main(){
  double x[4],y[4];
  while(cin >> x[0]){
    cin >>y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    double A,B,C;
    A = sqrt(pow(x[2] - x[1],2)+pow(y[2] - y[1],2));
    B = sqrt(pow(x[2] - x[0],2)+pow(y[2] - y[0],2));
    C = sqrt(pow(x[1] - x[0],2)+pow(y[1] - y[0],2));

    double S1 = heron(A,B,C);

    double XA,XB,XC;
    XA = sqrt(pow(x[3] - x[0],2)+pow(y[3] - y[0],2));
    XB = sqrt(pow(x[3] - x[1],2)+pow(y[3] - y[1],2));
    XC = sqrt(pow(x[3] - x[2],2)+pow(y[3] - y[2],2));

    double S2 = heron(XA,XB,C) + heron(XA,XC,B) + heron(XB,XC,A);
    if(fabs(S1-S2) < EPS)cout <<"YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

using namespace std;

bool checker(double a, double b,double x, double y, double px, double py);

double calc_slope(double x1, double y1, double x2, double y2);

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  bool flag = true;
  string s="";
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){

    double a1, a2, a3, b1, b2, b3;

    a1 = calc_slope(x1,y1,x2,y2);
    b1 = -a1*x1+y1;
    flag &= checker(a1,b1,x3,y3,xp,yp);

    a2 = calc_slope(x2,y2,x3,y3);
    b2 = -a2*x2+y2;
    flag &= checker(a2,b2,x1,y1,xp,yp);

    a3 = calc_slope(x3,y3,x1,y1);
    b3 = -a3*x3+y3;
    flag &= checker(a3,b3,x2,y2,xp,yp);

    if(flag){
      s += "YES\n";
    }else{
      s += "NO\n";
    }
  }
  cout << s;
}

bool checker(double a, double b, double ox, double oy, double px, double py){ 
  if(a == 0){
    if(b <= ox && b <= px){
      return true;
    }
    else if(b > ox && b > px){
      return true;
    }
  }

  if(oy <= a*ox+b && py <= a*px+b){
    return true;
  }
  else if(oy > a*ox+b && py > a*px+b){
    return true;
  }
  else{
    return false;
  }
}

double calc_slope(double x1, double y1, double x2, double y2){
  if(x1 > x2){
    return (y1-y2)/(x1-x2);
  }else if(x1 < x2){
    return (y2-y1)/(x2-x1);
  }else{
    return 0;
  }
}

C++: #include<iostream>
#include<math.h>
#include<stdlib.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a),end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

double dist(double x1, double y1, double x2, double y2){
    return sqrt( ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)) );
}

double triangleArea(double x, double y, double z){
    return (y * z * sin( acos( (y * y +  z * z - x * x) / (2 * y * z) ) )) / 2;
}

double inputXY(double x1, double y1, double x2, double y2, double x3, double y3){
    double x, y ,z;
    x = dist(x1, y1, x2, y2);
    y = dist(x2, y2, x3, y3);
    z = dist(x3, y3, x1, y1);
    return triangleArea(x, y, z);
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double allArea, area12, area23, area31;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
    allArea = inputXY(x1, y1, x2, y2, x3, y3);
    area12 = inputXY(xp, yp, x2, y2, x1, y1);
    area23 = inputXY(x2, y2, x3, y3, xp, yp);
    area31 = inputXY(x3, y3, x1, y1, xp, yp);

    if(abs(allArea - (area12 + area23 + area31)) < 0.00001) 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))/2;
	return ans;
}

int main(){
	float x[4], y[4], 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; }
		SS = S(x[0], y[0], x[1], y[1], x[3], y[3]) + S(x[0], y[0], x[2], y[2], x[3], y[3]) + S(x[1], y[1], x[2], y[2], x[3], y[3]);
		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++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    ld x1, x2, x3, xp, y1, y2, y3, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        auto z1 = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
        auto z2 = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);
        auto z3 = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
        auto isIn = z1 != 0 && z2 != 0 && z3 != 0;
        if (isIn) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

int main() {
    solver();
    return 0;
}

C++: //A Point in a Triangle
#include<bits/stdc++.h>
using namespace std;

//(x1, y1)と(x2, y2)の距離
double dis(double x1, double y1, double x2, double y2){
  return sqrt(pow(x1-x2, 2.0)+pow(y1-y2, 2.0));
}

//ヘロンの公式
double helon(double x1, double y1, double x2, double y2, double x3, double y3){
  double a=dis(x1, y1, x2, y2), b=dis(x2, y2, x3, y3), c=dis(x3, y3, x1, y1);
  double s=(a+b+c)/2.0;
  return sqrt(s*(s-a)*(s-b)*(s-c));
}

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)!=EOF){
    double hx1, hy1, hx2, hy2, hx3, hy3;//それぞれの点の中点
    hx1=(x1+x2)/2.0, hx2=(x2+x3)/2.0, hx3=(x3+x1)/2.0;
    hy1=(y1+y2)/2.0, hy2=(y2+y3)/2.0, hy3=(y3+y1)/2.0;
    double s=helon(hx1, hy1, hx2, hy2, hx3, hy3);
    if(s>helon(xp, yp, hx2, hy2, hx3, hy3) && s>helon(hx1, hy1, xp, yp, hx3, hy3) && s>helon(hx1, hy1, hx2, hy2, xp, yp)) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}