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 <math.h>
 
using namespace std;
 
typedef struct Point {
    double x;
    double y;
} POINT;
 
double area(Point l, Point m, Point n);
 
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) {
        double diff = area(a, b, c) - (area(a, b, p) + area(b, c, p) + area(c, a, p));
        if (fabs(diff) < 0.001) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        } 
    }
}
 
double area(Point l, Point m, Point n) {
    return fabs( (m.x - l.x) * (n.y - l.y)
            - (m.y - l.y) * (n.x - l.x)) * 0.5;
}

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

int main() {
  for(int tci = 0; ; tci++) {
    complex<double> ps[3];
    complex<double> pp;
    int rr = scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
        &ps[0].real(), &ps[0].imag(),
        &ps[1].real(), &ps[1].imag(),
        &ps[2].real(), &ps[2].imag(),
        &pp.real(), &pp.imag());
    if(rr<8) break;
    bool ok = true;
    for(int i = 0; i < 3; i++) {
      double det1 = imag( (ps[(i+1)%3]-ps[i]) * conj(pp-ps[i]) );
      double det2 = imag( (ps[(i+2)%3]-ps[i]) * conj(pp-ps[i]) );
      if(det1 * det2 > 1e-9) {
        ok = false;
      }
    }
    printf("%s\n", ok ? "YES" : "NO");
  }
  return 0;
}

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


int main()
{
	int i,count1,count2,ind1,ind2;
	float x[3],y[3],xp,yp;
	while( cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp ) {
		count1 = 0;
		count2 = 0;
		for( i = 0; i < 3; i++ ) {
			ind1 = i;
			ind2 = ( (i+1) % 3);
			if( ( ( xp -x[ind1] ) *( yp-y[ind2]) - (xp-x[ind2])*(yp-y[ind1]) ) < 0 ){
				count1 ++;
			}
			else if( ( ( xp -x[ind1] ) *( yp-y[ind2]) - (xp-x[ind2])*(yp-y[ind1]) ) > 0 ){
				count2 ++;
			}
		}
		if( count1 == 3 || count2 == 3 )
			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;
	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.00001  ){
//		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}

C++: #include <iostream>
#define formula(i,X,Y) ((x[(i+1)%3]-x[(i+2)%3])*(Y-y[(i+1)%3])-(y[(i+1)%3]-y[(i+2)%3])*(X-x[(i+1)%3]))
#define check(i) formula(i,xp,yp)*formula(i,x[i],y[i])

using namespace std;

int main(void){
	float x[3],y[3],xp,yp;

	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp)
		cout << (check(0)>0&&check(1)>0&&check(2)>0 ? "YES" : "NO") << endl;

	return 0;
}

C++: #include <stdio.h>
double root(double a1, double b1, double a2, double b2, double a3, double b3) {double S=a1*b2+a2*b3+a3*b1-b1*a2-b2*a3-b3*a1;if (S<0) return -S; else return S;}
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)) {
    double s=root(x1,y1,x2,y2,x3,y3),s1=root(x1,y1,x2,y2,xp,yp),s2=root(x1,y1,xp,yp,x3,y3),s3=root(xp,yp,x2,y2,x3,y3);
    if (s==s1+s2+s3) puts("YES"); else puts("NO");} 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] - x1[i] ) > fabs( x3[i] - xp[i] ) ) )
                f = true;

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

    }
    return 0;
}