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 <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cmath>
 
using namespace std;

int checkPoint(double x1, double y1, double x2, double y2, double x, double y){
    if(x1 - x2 == 0) { if(x1 - x == 0) return 0; if(x - x1 > 0) { return 1; } else return -1; }
    if((y - y1) - (y2 - y1) / (x2 - x1) * (x - x1) == 0) return 0;
    if((y - y1) - (y2 - y1) / (x2 - x1) * (x - x1) > 0) { return 1; } else return -1;
}

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

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


int main(){
    // ax + y + c = 0
    float x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], xp[100], yp[100], a1, c1, a2, c2, a3, c3;
    int i = 0,n = 0;
    bool f = false;
    while(scanf("%f %f %f %f %f %f %f %f",&x1[i], &y1[i], &x2[i], &y2[i], &x3[i], &y3[i], &xp[i],&yp[i]) != EOF){
        n++;
        i++;
    }
    printf("%d %d\n",i,n);
    for(i = 0; i < n; i++){
        f = false;
        if( !( y1[i] == y2[i] || y2[i] == y3[i] || y3[i] == y1[i] )){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

        }else if(x1[i] == x2[i]){
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( fabs( x1[i] - x3[i] ) > fabs( x1[i] - xp[i] ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

        }else if(x2[i] == x3[i]){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( fabs( x2[i] - x1[i] ) > fabs( x2[i] - xp[i] ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

       }else if(x3[i] == x1[i]){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];

            if( ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( fabs( x3[i] - x2[i] ) > fabs( x3[i] - xp[i] ) ) )
                f = true;

       }
        if(f){
            printf("YES\n");
        }else{
            printf("NO\n");
        }

    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	long double x1,y1,x2,y2,x3,y3,xp,yp,s1,s2,s3,S;
	int A,B,C,D;
	while(true){
		if (cin.eof())break; 
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
		S=(x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);
		s1=(x1-xp)*(y2-yp)-(x2-xp)*(y1-yp);
		s2=(x2-xp)*(y3-yp)-(x3-xp)*(y2-yp);
		s3=(x3-xp)*(y1-yp)-(x1-xp)*(y3-yp);
		S=fabs(S);
		s1=fabs(s1);
		s2=fabs(s2);
		s3=fabs(s3);
		A=S*10000000;
		B=s1*10000000;
		C=s2*10000000;
		D=s3*10000000;
		if(A==B+C+D){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}	
}

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

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double sall = (x1-x2)*(y1+y2) + (x2-x3)*(y2+y3) + (x3-x1)*(y3+y1);
		double s1 = (x1-x2)*(y1+y2) + (x2-xp)*(y2+yp) + (xp-x1)*(yp+y1);
		double s2 = (x1-xp)*(y1+yp) + (xp-x3)*(yp+y3) + (x3-x1)*(y3+y1);
		double s3 = (xp-x2)*(yp+y2) + (x2-x3)*(y2+y3) + (x3-xp)*(y3+yp);
		if(abs(sall) == abs(s1)+abs(s2)+abs(s3)){
			cout<<"YES"<<endl;
		} else {
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    double x1,x2,x3,y1,y2,y3,xp,yp;
    double calc1,calc2,calc3;
 
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        calc1 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
        calc2 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
        calc3 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
 
        if((calc1>0&&calc2>0&&calc3>0) || (calc1<0&&calc2<0&&calc3<0)){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    return 0;
}