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 <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 };
int main() {
	long double x1,y1,x2,y2,x3,y3,xp,yp,s1,s2,s3,S;
	int A,B,C,D;
	while(true){
		if (cin.eof())break; 
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
		S=(x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);
		s1=(x1-xp)*(y2-yp)-(x2-xp)*(y1-yp);
		s2=(x2-xp)*(y3-yp)-(x3-xp)*(y2-yp);
		s3=(x3-xp)*(y1-yp)-(x1-xp)*(y3-yp);
		S=fabs(S);
		s1=fabs(s1);
		s2=fabs(s2);
		s3=fabs(s3);
		A=S*1000;
		B=s1*1000;
		C=s2*1000;
		D=s3*1000;
		if(A==B+C+D){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}	
}

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

#define EPS 1e-15

struct point { double x, y; };

int main()
{
    point p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);

        double p_side[3], side[3];
        for (int i = 0; i < 3; i++){
            p_side[i] = sqrt((p[i].x - p[3].x) * (p[i].x - p[3].x) + (p[i].y - p[3].y) * (p[i].y - p[3].y));
            side[i] = sqrt((p[(i + 1) % 3].x - p[i].x) * (p[(i + 1) % 3].x - p[i].x) + (p[(i + 1) % 3].y - p[i].y) * (p[(i + 1) % 3].y - p[i].y));
        }

        double p_s[3], s;
        for (int i = 0; i < 3; i++){
            double tmp = (p_side[i] + p_side[(i + 1) % 3] + side[i]) / 2;
            p_s[i] = sqrt(tmp * (tmp - p_side[i]) * (tmp - p_side[(i + 1) % 3]) * (tmp - side[i]));
        }
        double tmp = (side[0] + side[1] + side[2]) / 2;
        s = sqrt(tmp * (tmp - side[0]) * (tmp - side[1]) * (tmp - side[2]));

        //printf("%.20f\n", p_s[0] + p_s[1] + p_s[2] - s);
        if (p_s[0] + p_s[1] + p_s[2] - s <= EPS) puts("YES");
        else puts("NO");
    }

    return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(void)
{
  int n;
  int i;
  cin>>n;
  rep(i,n){
    double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	if(abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

C++: #include <stdio.h>

int main(void)
{
	float x[3], y[3], xp, yp;
	float sM, s1, s2, s3;
	
	while (scanf("%f %f %f %f %f %f %f %f", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF){
		
		printf("%f %f %f %f %f %f %f %f\n", x[0], y[0], x[1], y[1], x[2], y[2], xp, yp);
		
		sM = ((x[1] - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (y[1] - y[0])) / 2;
		printf("sM = %f\n", sM);
		if (sM < 0){
			sM *= -1;
		}
		
		
		
		s1 = ((xp - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (yp - y[2])) / 2;
		if (s1 < 0){
			s1 *= -1;
		}
		
		printf("s1 = %f\n", s1);
		
		s2 = ((xp - x[1]) * (y[0] - y[1]) - (x[0] - x[1]) * (yp - y[1])) / 2;
		if (s2 < 0){
			s2 *= -1;
		}
		
		printf("s2 = %f\n", s2);
		
		s3 = ((xp - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (yp - y[0])) / 2;
		if (s3 < 0){
			s3 *= -1;
		}
		
		printf("s3 = %f\n", s3);
		
		if (sM == s1 + s2 + s3){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

C++: #include<iostream>
typedef double f;f a,b,c,d,h,i,e,g;f r(f k,f l,f m,f n){m-=k;n-=l;k=e-k;l=g-l;return m*l-n*k?m*l-n*k>0?1:-1:0;}int main(){for(;!(std::cin>>a>>b>>c>>d>>h>>i>>e>>g).eof();)std::cout<<(r(a,b,c,d)==r(c,d,h,i)==r(h,i,a,b)?"YES\n":"NO\n");}

C++: #include <iostream>

using namespace std;

struct P{
	double x;
	double y;
};

int ccw(P p0, P p1, P p2)
{
	double dx1 = p1.x-p0.x;
	double dy1 = p1.y-p0.y;
	double dx2 = p2.x-p0.x;
	double 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 intersect(P p1, P p2, P p3, P p4)
{
	return (((ccw(p1, p2, p3)*ccw(p1, p2, p4)) <= 0)
				 &&((ccw(p3, p4, p1)*ccw(p3, p4, p2)) <= 0));
}

int main()
{
	bool f;
	P pr[3], o, g;
	
	while(cin >> pr[0].x >> pr[0].y >> pr[1].x >> pr[1].y >> pr[2].x >> pr[2].y >> o.x >> o.y){
		f = true;
		g.x = g.y = 0;
		for(int i = 0; i < 3; i++){
			g.x += pr[i].x;
			g.y += pr[i].y;
		}
		g.x /= 3.0;
		g.y /= 3.0;
		
		if(intersect(pr[0], pr[1], o, g) > 0){
			f = false;
		}
		if(f && intersect(pr[0], pr[2], o, g) > 0){
			f = false;
		}
		if(f && intersect(pr[2], pr[1], o, g) > 0){
			f = false;
		}
		if(f){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

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

struct TCoordinate
{
	double x;
	double y;
};

bool JudgeSameSide(TCoordinate T1, TCoordinate T2, TCoordinate L1, TCoordinate L2)
{
	if(L1.x == L2.x){
		if((T1.x - L1.x) * (T2.x - L2.x) > 0){
			return true;
		}else{
			return false;
		}
	}else{
		if(((L2.x - L1.x) * (T1.y - L1.y) - (L2.y - L1.y) * (T1.x - L1.x)) * ((L2.x - L1.x) * (T2.y - L1.y) - (L2.y - L1.y) * (T2.x - L1.x)) > 0){
			return true;
		}else{
			return false;
		}
	}
}

int main()
{
	bool SameSideFlagA1A2, SameSideFlagA2A3, SameSideFlagA3A1;
	while(true){
		TCoordinate A1, A2, A3, Ap;
		cin >> A1.x >> A1.y >> A2.x >> A2.y >> A3.x >> A3.y >> Ap.x >> Ap.y;
		if(cin.eof() == true) break;
		SameSideFlagA1A2 = JudgeSameSide(A3, Ap, A1, A2);
		SameSideFlagA2A3 = JudgeSameSide(A1, Ap, A2, A3);
		SameSideFlagA3A1 = JudgeSameSide(A2, Ap, A3, A1);
		if(SameSideFlagA1A2 == true && SameSideFlagA2A3 == true && SameSideFlagA3A1 == true){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		double c1 = (x2 - x1) * (yp - x1) - (y2 - y1) * (xp - x1);
		double c2 = (x3 - x2) * (yp - x2) - (y3 - y2) * (xp - x2);
		double c3 = (x1 - x3) * (yp - x3) - (y1 - y3) * (xp - x3);
		bool flag1 = (c1 < 0 && c2 < 0 && c3 < 0);
		bool flag2 = (c1 > 0 && c2 > 0 && c3 > 0);
		if(flag1 || flag2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}