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 <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;



int isPointInsidePolygon(vector<pair<double,double>> angle,pair<double,double> point){    //点が多角形の内側にあるかどうかを求める
    long angleSum=angle.size();
    int count=0;
    
    for(int i=0;i<angleSum;i++){
        double x1=angle[i].first;
        double y1=angle[i].second;
        double x2=angle[(i+1)%angleSum].first;
        double y2=angle[(i+1)%angleSum].second;
        double xp=point.first;
        double yp=point.second;
        
        double result=(x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
        
        if(result==0)count+=2;
        else if(result>0)count++;
        
    }
    if(count%angleSum==0)return 1;    //点は内側にある
    else return 0;
    
}



int main(){
    double a,b,c,d,e,f,g,h;
    while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
        vector<pair<double,double>> angle;
        angle.pb(pair<double,double>(a,b));
        angle.pb(pair<double,double>(c,d));
        angle.pb(pair<double,double>(e,f));

        if(isPointInsidePolygon(angle,pair<double,double>(g,h))){
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;
    }


    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct point{ double x, y; };

int ccw(point p0, point p1, point p2){
  double dx1, dx2, dy1, dy2;
  dx1 = p1.x - p0.x; dy1 = p1.y - p0.y;
  dx2 = p2.x - p0.x; dy2 = p2.y - p0.y;
  if(dx1*dy2 > dy1*dx2) return 1;
  if(dx1*dy2 < dy1*dx2) return -1;
  if((dx1*dx2 < 0) || (dy1*dy2 < 0)) return -1;
  if((dx1*dx1+dy1*dy1) < (dx2*dx2+dy2*dy2)) return 1;
  return 0;
}

int main(){
  double x1, x2, x3, xp, y1, y2, y3, yp;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) && x1+y1+x2+y2+x3+y3+xp+yp){
    point a, b, c, P;
    a.x = y1; a.y = x1;
    b.x = y2; b.y = x2;
    c.x = y3; c.y = x3;
    P.x = yp; P.y = xp;
    //    printf("%d %d %d\n", ccw(a, b, P), ccw(b, c, P), ccw(c, a,P));
    if(ccw(a, b, P) == ccw(b, c, P) && ccw(b, c, P) == ccw(c, a, P)) puts("YES");
    else puts("NO");
  }
  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-1  ){
		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

	cout << "max = " << m << 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;
	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))); 
	    if(  abs(1 - sqrt(dotpro))  <= 0.000001  ){
//		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}

C++: #include <iostream>
#include <cmath>
#define EPS 10e-10
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]){
    cin >>y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    double A,B,C;
    A = sqrt(pow(x[2] - x[1],2)+pow(y[2] - y[1],2));
    B = sqrt(pow(x[2] - x[0],2)+pow(y[2] - y[0],2));
    C = sqrt(pow(x[1] - x[0],2)+pow(y[1] - y[0],2));

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

    double XA,XB,XC;
    XA = sqrt(pow(x[3] - x[0],2)+pow(y[3] - y[0],2));
    XB = sqrt(pow(x[3] - x[1],2)+pow(y[3] - y[1],2));
    XC = sqrt(pow(x[3] - x[2],2)+pow(y[3] - y[2],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>
using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double vx1, vy1, vx2, vy2, vxp, vyp;
	double s, t;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		vx1 = x2 - x1;
		vy1 = y2 - y1;
		vx2 = x3 - x1;
		vy2 = y3 - y1;
		vxp = xp - x1;
		vyp = yp - y1;
		s = (vyp*vx2 - vxp*vy2) / (vy1*vx2 - vx1*vy2);
		if (vx2) {
			t = (vxp - vx1*s) / vx2;
		} else {
			t = (vyp - vy1*s) / vy2;
		}

		if (s>0.0 && t>0.0 && s + t<1.0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}