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>
using namespace std;
int main() {
  float x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    float a_x = x2 - x1, a_y = y2 - y1;
    float b_x = x3 - x1, b_y = y3 - y1;
    float c_x = xp - x1, c_y = yp - y1;
    float det = a_x * b_y - a_y * b_x;
    float s = (b_y * c_x - b_x * c_y) / det, t = (-a_y * c_x + a_x * c_y) / det;
    cout << ((0 <= s && s <= 1 && 0 <= t && t <= 1 && s + t <= 1) ? "YES" : "NO") << endl;
  }
}

C++: #include<cstdio>
using namespace std;
int main(){
	double a[8],matrix[4],ans[2];
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7]) != EOF){
		matrix[0] = a[2]-a[0];
		matrix[1] = a[4]-a[0];
		matrix[2] = a[3]-a[1];
		matrix[3] = a[5]-a[1];
		ans[0] = a[6]-a[0];
		ans[1] = a[7]-a[1];
		double t = matrix[0]*matrix[3]-matrix[1]*matrix[2];
		double x = matrix[3]*ans[0]/t-matrix[1]*ans[1]/t;
		double y = matrix[0]*ans[1]/t-matrix[2]*ans[0]/t;
		if(x+y<1 && x>0 && y>0){printf("YES\n");}
		else{printf("NO\n");}
	}
	return 0;
}

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

using namespace std;

//I can't understand, so I search the solution at http://oshiete.goo.ne.jp/qa/5729013.html

int main(){
	double x1,x2,x3,y1,y2,y3,xp,yp;
	double calc1,calc2,calc3;
	int count;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		count=0;
		calc1 = (x1-xp)*(x2-xp)+(y1-yp)*(y2-yp);
		if(calc1 < 0)count++;
		calc2 = (x1-xp)*(x3-xp)+(y1-yp)*(y3-yp);
		if(calc2 < 0)count++;
		calc3 = (x3-xp)*(x2-xp)+(y3-yp)*(y2-yp);
		if(calc3 < 0)count++;

		if(count >= 2)printf("YES\n");
		else{
			printf("NO\n");
		}
	}
    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<stdio.h>
int main(){
    double x1,x2,x3,x4,y1,y2,y3,y4;
    while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)){
        bool ok1=true;
        bool ok2=true;
        if((x2-x1)*(y4-y1)-(x4-x1)*(y2-y1)<0)ok1=false;
        else ok2=false;
        if((x3-x2)*(y4-y2)-(x4-x2)*(y3-y2)<0)ok1=false;
        else ok2=false;
        if((x1-x3)*(y4-y3)-(x4-x3)*(y1-y3)<0)ok1=false;
        else ok2=false;
        printf((ok1||ok2)?"YES\n":"NO\n");
    }
}

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

double helon(double x1,double y1,double x2,double y2,double x3,double y3){
	double a,b,c,s,area;
	a = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	b = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	c = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
	s = (a+b+c)/2;
	area = sqrt(s*(s-a)*(s-b)*(s-c));
	return area;
}

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

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

using namespace std;

inline double sq (double x) {
    return x * x;
}

double rad (double x1, double y1, double x2, double y2) {
    return acos((x1 * x2 + y1 + y2) /
        (sqrt(sq(x1) + sq(y1)) * sqrt(sq(x2) + sq(y2))));
}

int main (void) {
    double x1, x2, x3, xp;
    double y1, y2, y3, yp;
    for (;;) {
        cin >> x1; cin >> y1;
        cin >> x2; cin >> y2;
        cin >> x3; cin >> y3;
        cin >> xp; cin >> yp;
        if (cin.eof()) break;
        double d1, d2, d3;
        d1 = rad(x1 - xp, y1 - yp, x2 - xp, y2 - yp);
        d2 = rad(x1 - xp, y1 - yp, x3 - xp, y3 - yp);
        d3 = rad(x2 - xp, y2 - yp, x3 - xp, y3 - yp);
        if (d1 + d2 + d3 < 2 * M_PI)
            cout << "NO" << endl;
        else
            cout << "YES" << endl;
    }
    return 0;
}

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

double f(double x1, double y1, double x2, double y2, double xp, double yp) {
    return (y2 - y1) * xp + (-x2 + x1) * yp - x1 * (y2 - y1) + y1 * (x2 - x1);
}


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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
        x2-=x1;
        x3-=x1;
        xp-=x1;
        y2-=y1;
        y3-=y1;
        yp-=y1;
        double m=(x3*y2-x2*y3);
        double p=(x3*yp-xp*y3)/m;
        double q=(xp*y2-x2*yp)/m;
        cout<<((p>=0&&q>=0&&p+q<=1)?"YES\n":"NO\n");
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double s, t;
	
	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF)
	{
		s = ((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1)) /
			((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1));
		t = ((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1)) /
			((x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1));
		
		if (s > 0 && t > 0 && s + t < 1)
		{
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> P;

double cross(P a, P b) {
  return (a.real()*b.imag()-a.imag()*b.real());
}

P vector_coord(P a, P b, P x){
  return P(-cross(b,x),cross(a,x))/cross(a,b);
}

int main(){
  double a1,b1,a2,b2,a3,b3,x1,y1;
  while(cin >>a1 >>b1 >>a2 >>b2 >>a3>>b3>>x1>>y1){
  P o=P(a1,b1);
  P a=P(a2,b2)-o;
  P b=P(a3,b3)-o;
  P x=P(x1,y1)-o;
  P v = vector_coord(a,b,x);
  if (0<v.real()&&0<v.imag()&&v.real()+v.imag()<1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  }
  return 0;
}