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

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	bool flg = false;
	REP(i,1e6){
	    s = ((double)i/1e6);
	    t = (double)1 - s;
	    double x1 = s * (x[2] - x[0]) + t * ( x[1] - x[0]);
	    double y1 = s * (y[2] - y[0]) + t * ( y[1] - y[0]);
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    double dotpro = (  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2))); 
	    //cout << dotpro << endl;
	    if(  1 - dotpro  <= 0.001  ){
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}