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 <iomanip>
#include <math.h>
#include <utility>
#include <cstdlib>
using namespace std;

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

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
using namespace std;
int main(){
	pair<double,double> tp[3];
	pair<double,double> p;
	bool flag;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tp[0].first,&tp[0].second,&tp[1].first,&tp[1].second,&tp[2].first,&tp[2].second,&p.first,&p.second) == 8){
		flag=true;
		for(int i=0;i<3;i++){
			if (tp[i%3].second-tp[(i+1)%3].second==0){
				if((p.second-tp[i%3].second)*(tp[(i+2)%2].second-tp[i%3].second)<0)flag=false;
			}else {
				if((p.second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(p.first-tp[i%3].first)+tp[i%3].second)*(tp[(i+2)%2].second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(tp[(i+2)%2].first-tp[i%3].first)+tp[i%3].second)<0)flag=false;
			}
		}
		if(flag)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

int main(){
	double a,b,c,d,e,f,p,q;
	bool j;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
		if( (q==(b-d)/(a-c)*p-(a*d-b*c)/(c-a))||
			(q==(d-f)/(c-e)*p-(c*f-d*e)/(e-c))||
			(q==(f-b)/(e-a)*p-(e*b-a*f)/(a-e))){
				printf("NO\n");
		}
		else{
			j = true;
			if(a==c){
				if(!(p>a==e>a))j=false;
			}
			else{
				if( !( (q>(b-d)/(a-c)*p-(a*d-b*c)/(c-a))==(f>(b-d)/(a-c)*e-(a*d-b*c)/(c-a)) ) )j=false;
			}
			if(c==e){
				if(!(p>c==a>c))j=false;
			}
			else{
				if(!( (q>(d-f)/(c-e)*p-(c*f-d*e)/(e-c))==(b>(d-f)/(c-e)*a-(c*f-d*e)/(e-c)) ))j=false;
			}
			if(e==a){
				if(!(p>e==c>e))j=false;
			}
			else{
				if(!( (q>(f-b)/(e-a)*p-(e*b-a*e)/(a-f))==(d>(f-b)/(e-a)*b-(e*b-a*f)/(a-e)) ))j=false;
			}
			if(j){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        if (((x2-x1)*(y2-y3))-((y1-y3)*(x2-x3))>0 && ((x3-x2)*(y3-yp))-((y1-yp)*(x3-xp))>0) {
        //if(((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)>0)&&((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)>0)&&((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)>0)){
            printf("YES\n");
        //}else if(((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)<0)&&((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)<0)&&((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)<0)){
        //    printf("YES\n");
        }else{
            printf("NO\n");
        }

    }
    return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

#include<complex>
typedef complex<double> Point;

double cross(Point a, Point b){
  return imag(conj(a) * b);
}

int ccw(Point a, Point b, Point c){
  b -= a;
  c -= a;
  if(cross(b, c) > EPS) return +1;
  if(cross(b, c) < -EPS) return -1;
  return 0;
}
// テァツつケテ」ツ?古、ツクツ嘉ィツァツ津・ツスツ「abcテ」ツ?ョテ」ツ?ゥテ」ツ?禿」ツ?ォテ」ツ?づ」ツつ凝」ツ?ョテ」ツ?凝・ツ按、テ・ツョツ堙」ツ?凖」ツつ?
enum { OUT, ON, IN };
int contains(Point a, Point b, Point c, Point p){
  int A = ccw(a, b, p);
  int B = ccw(b, c, p);
  int C = ccw(c, a, p);
  if(A == B && B == C && abs(A) == 1) return IN;
  if(!A || !B || !C) return ON;
  return OUT;
}

int main(){
  Point a, b, c, d;
  while(cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag()){
    int C = contains(a, b, c, d);
    if(C == IN){
      cout << "YES" << endl;
    }else if(C == OUT){
      cout << "NO" << endl;
    }else if(C == ON){
      cout << "ON!" << endl;
    }
  }
  return 0;
}

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

float arean(float x1,float y1,float x2,float y2,float x3,float y3)
{
    float a;
    return a=(x3*(y1-y2)+x1*(y2-y3)+x2*(y3-y1))/2;

}
int main()
{
    float x1,y1,x2,y2,x3,y3,px,py,b,a1,a2,a3;
    freopen("in.txt","r",stdin);
   while(scanf("%d%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&px,&py)!=EOF)
   {
   cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py;

        b=arean(x1,y1,x2,y2,x3,y3);

        a1=arean(x1,y1,x2,y2,px,py);

        a2=arean(px,py,x2,y2,x3,y3);

        a3=arean(x1,y1,x3,y3,px,py);
        if(b==a1+a2+a3)
        cout<<"YES";
        else
        cout<<"NO";

        cout<<endl;
   }





return 0;
}

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

int main(){
	int i;
	double x[4],y[4],xp,yp;
	double ax,px,ay,py;
	bool left,right;
	
	while(std::cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		x[3]=x[0];
		y[3]=y[0];
		
		left = false;
		right = false;
		
		for(i=0;i<3;i++){
			ax = x[i+1]-x[i];
			ay = y[i+1]-y[i];
			px = xp - x[i];
			py = yp - y[i];
			if(ax*py-px*ay < 0){
				right = true;
			}else{
				left = true;
			}
		}
		
		if(left^right){
			std::cout << "YES" << std::endl;
		}else{
			std::cout << "NO" << std::endl;
		}
	}
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

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


int main(){
    double x1,x2,x3,y1,y2,y3,xp,yp;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        double d1 = (x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
        double d2 = (x3-x2)*(yp-y2) - (xp-x2)*(y3-y2);
        double d3 = (x1-x3)*(yp-y3) - (xp-x3)*(y1-y3);
        if (( d1<0 && d2<0 && d3<0 ) || ( d1>0 && d2>0 && d3>0 )) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}