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>

using namespace std;

struct Point{
  double x, y;
  Point(){ x = 0; y = 0; }
  Point(double x_, double y_){ x = x_; y = y_; }
};

bool rotation_direction(const Point& p1, const Point& p2, const Point& p3){
  double x = p1.x*(p2.y-p3.y) + p2.x*(p3.y-p1.y) + p3.x*(p1.y-p2.y);
  return (x > 0);
}

bool solve(const Point& a, const Point& b, const Point& c, const Point& p){
  bool flag = rotation_direction(a, b, c);
  return (flag == rotation_direction(p, a, b) &&
	  flag == rotation_direction(p, b, c) &&
	  flag == rotation_direction(p, c, a));
}

int main(){
  Point a, b, c, p;
  while(cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y){
    if(solve(a, b, c, p)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

double equ(double x1, double y1, double x2, double y2, double x, double y){
    return (x1-x2)*(y-y1) - (y1-y2)*(x-x1);
}

bool same_side(double x1, double y1, double x2, double y2,
               double xa, double ya, double xb, double yb){
    return equ(x1, y1, x2, y2, xa, ya) * equ(x1, y1, x2, y2, xb, yb) > 0;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){
        double xg = (x1+x2+x3)/3, yg = (y1+y2+y3)/3;
        if( same_side(x1, y1, x2, y2, xg, yg, xp, yp) &&
            same_side(x2, y2, x3, y3, xg, yg, xp, yp) &&
            same_side(x3, y3, x1, y1, xg, yg, xp, yp) ){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    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 };
double det(double x1,double y1,double x2,double y2){
	return x1*y2-x2*y1;
}
int main() {
	long double s1,t1,s2,t2,s3,t3,sp,tp;
	while(true){ 
		cin>>s1>>t1>>s2>>t2>>s3>>t3>>sp>>tp;
		if (cin.eof())break;
		double X=det(s1-sp,t1-tp,s2-sp,t2-tp);
		double Y=det(s2-sp,t2-tp,s3-sp,t3-tp);
		double Z=det(s3-sp,t3-tp,s1-sp,t1-tp);		
		if((X>0&&Y>0&&Z>0)||(X<0&&Y<0&&Z<0)){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}	
}

C++: #include <iostream>

using namespace std;

int main()
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double a, b, c;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
    {
        a = (x3 - x2)*(yp - y2) - (y3 - y2)*(xp - x2);
        b = (x1 - x3)*(yp - y3) - (y1 - y3)*(xp - x3);
        c = (x2 - x1)*(yp - y1) - (y2 - y1)*(xp - x1);
        if((a >= 0 && b  >= 0 && c >= 0) || (a <= 0 && b <= 0 && c <= 0))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}

C++: #include <iostream>
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 = ( xp * b[1] - b[0] * yp) / (a[0] * b[1] - b[0] * a[1]);
    B = (a[0] * yp - xp * a[1]) / (a[0] * b[1] - b[0] * a[1]);
    if ((A+B < 1) && (A > 0) && (B > 0)) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <stdio.h>
#include <math.h>


double eps = 1e-10 ;
int main()
{
  double x1, x2, x3, y1, y2, y3, xp, yp;
  double s, s1, s2, s3;

  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
    //?????§????¢??????¢???
    s  = ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)) / 2; 
    s1 = ((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1)) / 2;
    s2 = ((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1)) / 2;
    s3 = ((xp - x2) * (y3 - y2) - (yp - y2) * (x3 - x2)) / 2;

    s  = fabs(s);
    s1 = fabs(s1);
    s2 = fabs(s2);
    s3 = fabs(s3);

    if (fabs(s - (s1 + s2 + s3)) <= eps) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <math.h>
#include <utility>
#include <cstdlib>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		bool ans=true;
		double x[3],y[3],xp,yp;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp;
		//???????????¨????????????
		double gaiseki[3];	//gaiseki[i]???????????????P0P1??¨????????????P0Q????????????z??§?¨?
		for(int i=0;i<3;i++){
			int k = (i+1)%3;
			double vx,vy,vpx,vpy;
			vx = x[k]-x[i];
			vy = y[k]-y[i];
			vpx = xp-x[i];
			vpy = yp-y[i];
			gaiseki[i] = vx*vpy-vy*vpx;
			if(gaiseki[i]<=0) ans = false;
		}
		if(ans){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	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;
	double m = 0;
	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)) ;

	    m = max(m,dotpro);
        if( (x2 * x2 + y2 * y2) >= (x1*x1 + y1 * y1)) continue;
	    if(  abs(1 - sqrt(dotpro))  <= 1e-2  ){
		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

	cout << "max = " << m << endl;
    }

    return 0;
}