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 <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
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 v1, v2, v3;
        v1 = (x1-x2)*(y1-yp) - (y1-y2)*(x1-xp);
        v2 = (x2-x3)*(y2-yp) - (y2-y3)*(x2-xp);
        v3 = (x3-x1)*(y3-yp) - (y3-y1)*(x3-xp);
        //printf("%f %f %f\n", v1, v2, v3);
        if ( (v1 < 0 && v2 < 0 && v3 < 0) || (v1 > 0 && v2 > 0 && v3 > 0) ) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

C++: #include <iostream>
#include <math.h>
using namespace std;
double getCross( double x1, double y1, double x2, double y2 )
{
	return x1 * y2 - y1 * x2;
}
int main( void )
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while ( cin >> x1 >> y1 >> x2 >> y2>> x3 >> y3 >> xp >> yp )
	{
		double a = getCross( xp-x1, yp-y1, xp-x2, xp-y2 );
		double b = getCross( xp-x2, yp-y2, xp-x3, yp-y3 );
		double c = getCross( xp-x3, yp-y3, xp-x1, yp-y1 );

		if ( a < 0.0 || b < 0.0 || c < 0.0 )
			cout << "NO" << endl;
		else
			cout << "YES" << endl;

	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define MAX 1000000

using namespace std;

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

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
	{

		z1=(x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
		z2=(x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
		z3=(x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);

		
		if((z1>0&&z2>0&&z3>0)||(z1<0&&z2<0&&z3<0)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef vector<P> G;
inline double dot(const P& a, const P& b) { return real(conj(a)*b);}
inline double cross(const P& a, const P& b) { return imag(conj(a)*b);}

#define curr(g, i) g[i]
#define next(g, i) g[(i+1)%g.size()]
enum { OUT, ON, IN };
int contains(const G& g, const P& p) {
    bool in = false;
    for (int i = 0; i < g.size(); ++i) {
        P a = curr(g,i) - p, b = next(g,i) - p;
        if (imag(a) > imag(b)) swap(a, b);
        if (imag(a) <= 0 && 0 < imag(b))
            if (cross(a, b) < 0) in = !in;
        if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;
    }
    return in ? IN : OUT;
}

int main(){
    G g(3);
    P p;
    while(~scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
                 &g[0].real(), &g[0].imag(), &g[1].real(), &g[1].imag(), &g[2].real(), &g[2].imag(),
                 &p.real(), &p.imag())){
        cout << (contains(g,p)==IN? "YES": "NO") << endl;
    }
}

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]);
	rad1 += acos(-1);
	double rad2 = atan2(y[1], x[1]);
	rad2 += acos(-1);
	double rad3 = atan2(y[2], x[2]);
	rad3 += acos(-1);
	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("%lf %lf %lf %lf %lf %lf %lf %lf\n", &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();
}

int main(){
    Point V[3], P;
    while(true){
        double x, y;
        for(int i=0; i<3; i++){
            cin >> x >> y;
            V[i] = {x, y};
        }
        cin >> x >> y;
        P = {x, y};
        
        if(!cin)break;
        
        int sum = 0;
        for(int i=0; i<3; i++){
            sum += cross(V[(i+1)%3]-V[i], (P-V[i])) > 0;
        }
        cout << (sum==0 || sum==3? "YES": "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	double x[4], y[4];
	bool left, right;
	double ax, ay, px, py;

	while(1){
		for(int i = 0; i < 4; i++){
			if(!(cin >> x[i] >> y[i])){
				return 0;
			}
		}

		left = false;
		right = false;
		for(int i = 0; i < 3; i++){
			ax = x[(i+1)%3]-x[i];
			ay = y[(i+1)%3]-y[i];
			px = x[3] - x[i];
			py = y[3] - y[i];
			if( ax*py-px*ay < 0){
				right = true;
			}else{
				left = true;
			}
		}

		if(left^right){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

int main(){
	double a,b,c,d,e,f,p,q;
	bool j;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
		if( (q==(b-d)/(a-c)*p-(a*d-b*c)/(c-a))||
			(q==(d-f)/(c-e)*p-(c*f-d*e)/(e-c))||
			(q==(f-b)/(e-a)*p-(e*b-a*f)/(a-e))){
				printf("NO\n");
		}
		else{
			j = true;
			if(a==c){
				if(!(p>a==e>a))j=false;
			}
			else{
				if( !( (q>(b-d)/(a-c)*p-(a*d-b*c)/(c-a))==(f>(b-d)/(a-c)*e-(a*d-b*c)/(c-a)) ) )j=false;
			}
			if(c==e){
				if(!(p>c==a>c))j=false;
			}
			else{
				if(!( (q>(d-f)/(c-e)*p-(c*f-d*e)/(e-c))==(b>(d-f)/(c-e)*a-(c*f-d*e)/(e-c)) ))j=false;
			}
			if(e==a){
				if(!(p>e==c>e))j=false;
			}
			else{
				if(!( (q>(f-b)/(e-a)*p-(e*b-a*e)/(a-e))==(d>(f-b)/(e-a)*c-(e*b-a*f)/(a-e)) ))j=false;
			}
			if(j){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
	}
	return 0;
}