Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

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


int main(){

  double x[4], y[4];
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){

    vector<bool> t(3, false);
    for(int i=0; i<3; i++){
      if( ( x[ i ] - x[ (i+1)%3 ] )*(y[3]-y[ (i+1)%3 ]) - (y[i]-y[ (i+1)%3 ])*(x[3]-x[ (i+1)%3 ]) > 0 ) t[i] = true;
    }

    if( !t[0] && !t[1] && !t[2] ) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}














// EOF

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

int main()
{
   double x1,x2,x3,y1,y2,y3,xp,yp;
    double gaiseki1,gaiseki2,gaiseki3;
 
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        gaiseki1 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);//全部右or全部左ならok
        gaiseki2 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
        gaiseki3 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
 
        if((gaiseki1>0&&gaiseki2>0&&gaiseki3>0) || (gaiseki1<0&&gaiseki2<0&&gaiseki3<0)){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    return 0;
}

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

int main() {
  for(int tci = 0; ; tci++) {
    double x1,y1,x2,y2,x3,y3,xp,yp;
    if(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)<8) break;
    complex<double> ps[3];
    ps[0] = complex<double>(x1,y1);
    ps[1] = complex<double>(x2,y2);
    ps[2] = complex<double>(x3,y3);
    complex<double> pp(xp,yp);
    bool ok = true;
    for(int i = 0; i < 3; i++) {
      complex<double> v0 = ps[(i+1)%3]-ps[i];
      complex<double> v1 = ps[(i+2)%3]-ps[i];
      complex<double> vp = pp-ps[i];
      double det1 = (v0*conj(v1)).imag();
      double det2 = (v0*conj(vp)).imag();
      ok = ok & (det1 * det2 > 1e-9);
    }
    printf("%s\n", ok ? "YES" : "NO");
  }
  return 0;
}

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, p, q, r, a, b, c;
	
	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;
			}
		}
		
		if(f){
			a = sqrt(mul(x[0],x[1])+mul(y[0],y[1]));
			b = sqrt(mul(x[0],x[2])+mul(y[0],y[2]));
			c = sqrt(mul(x[2],x[1])+mul(y[2],y[1]));
			p = (a+b+c)/2;
			q = sqrt(p*(p-a)*(p-b)*(p-c));
			
			for(int i = 0; i < 3; i++){
				for(int j = i+1; j < 3; j++){
					a = sqrt(mul(x[i],x[j])+mul(y[i],y[j]));
					b = sqrt(mul(s,x[j])+mul(t,y[j]));
					c = sqrt(mul(x[i],s)+mul(y[i],t));
					p = (a+b+c)/2;
					r = sqrt(p*(p-a)*(p-b)*(p-c));
					if(r > q){
						f = false;
						break;
					}
				}
				if(!f){
					break;
				}
			}
			if(f){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: 	#include <cstdio>
	#include <iostream>
	#include <math.h>

	using namespace std;
	#define rep(i,n) for(int i = 0; i < (n); ++i)

	bool judge(double x[3], double y[3]) {
		double rad1 = atan2(y[0], x[0]);
		double rad2 = atan2(y[1], x[1]);
		double rad3 = atan2(y[2], x[2]);
		if(rad3 < rad1 && rad2 < rad3 || rad1 < rad3 && rad3 < rad2) return true;
		else return false;
	}

	int main() {
		double x1, y1, x2, y2, x3, y3, xp, yp;
		while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
			double x[3], y[3];
			x[0] = x2 - x1;
			y[0] = y2 - y1; 
			x[1] = x3 - x1;
			y[1] = y3 - y1;
			x[2] = xp - x1;
			y[2] = yp - y1;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x1 - x2;
			y[0] = y1 - y2;
			x[1] = x3 - x2;
			y[1] = y3 - y2;
			x[2] = xp - x2;
			y[2] = yp - y2;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;
		}
		return 0;
	}

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

typedef complex<double> Point;

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

int main(){
    Point V[3], P;
    while(true){
        for(int i=0; i<3; i++){
            double x, y;
            if(!(cin >> x >> y))
                return 0;
            V[i] = {x, y};
        }
        double x, y; cin >> x >> y;
        P = {x, y};
        
        int sum1 = 0, sum2 = 0;
        for(int i=0; i<3; i++){
            double x = cross(V[(i+1)%3]-V[i], (P-V[i]));
            sum1 += x<0;
            sum2 += x>0;
        }
        cout << (sum1==3 || sum2==3? "YES": "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]>>y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){
  
    double A,B,C;
    A = sqrt(pow(x[0] - x[1],2)+pow(y[0] - y[1],2));
    B = sqrt(pow(x[0] - x[2],2)+pow(y[0] - y[2],2));
    C = sqrt(pow(x[2] - x[1],2)+pow(y[2] - y[1],2));

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

    double XA,XB,XC;
    XA = sqrt(pow(x[0] - x[3],2)+pow(y[0] - y[3],2));
    XB = sqrt(pow(x[1] - x[3],2)+pow(y[1] - y[3],2));
    XC = sqrt(pow(x[2] - x[3],2)+pow(y[2] - y[3],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 <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) {
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;

    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;
    }
  }
}