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 <cstdio>
	#include <iostream>
	#include <math.h>

	using namespace std;
	#define rep(i,n) for(int i = 0; i < (n); ++i)

	bool judge(double x[3], double y[3]) {
		double rad1 = atan2(y[0], x[0]);
		double rad2 = atan2(y[1], x[1]);
		double rad3 = atan2(y[2], x[2]);
		if(rad3 < rad1 && rad2 < rad3 || rad1 < rad3 && rad3 < rad2) return true;
		else return false;
	}

	int main() {
		double x1, y1, x2, y2, x3, y3, xp, yp;
		while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
			double x[3], y[3];
			x[0] = x2 - x1;
			y[0] = y2 - y1; 
			x[1] = x3 - x1;
			y[1] = y3 - y1;
			x[2] = xp - x1;
			y[2] = yp - y1;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x1 - x2;
			y[0] = y1 - y2;
			x[1] = x3 - x2;
			y[1] = y3 - y2;
			x[2] = xp - x2;
			y[2] = yp - y2;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x1 - x3;
			y[0] = y1 - y3;
			x[1] = x2 - x3;
			y[1] = y2 - y3;
			x[2] = xp - x3;
			y[2] = yp - y3;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;
		}
		return 0;
	}

C++: #include<iostream>
#include<vector>
int main()
{
	std::vector<bool>result;
	while (true)
	{
		double x1, y1, x2, y2, x3, y3, xp, yp;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
		if (!std::cin)
		{
			break;
		}
		double k = ((x2 - x3)*(y3 - y1) - (x3 - x1)*(y2 - y3)) / ((x2 - x3)*(yp - y1) - (xp - x1)*(y2 - y3));
		double s = ((x1 - x3)*(yp - y1) - (xp - x1)*(y1 - y3)) / ((x2 - x3)*(yp - y1) - (xp - x1)*(y2 - y3));
		result.push_back(1 < k && 0 < s && s < 1);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	system("pause");
	return 0;
}

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

int winding_number(double x, double y, double p[][2], int n)
{
  double x1 = p[n - 1][0] - x, y1 = p[n - 1][1] - y;
  double s = 0;
  for(int i = 0; i < n; i++)
  {
    double x2 = p[i][0] - x, y2 = p[i][1] - y;
    double tx = acos((x1 * x2 + y1 * y2) / sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2)));
    s += tx;
    x1 = x2; y1 = y2;
  }
  return (abs(s) + 0.000001) / 2 / PI;
}


double p[3][2];
int main()
{
  while(cin >> p[0][0] >> p[0][1] >> p[1][0] >> p[1][1] >> p[2][0] >> p[2][1])
  {
    double x, y;
    cin >> x >> y;
    cout << (winding_number(x, y, p, 3) ? "YES" : "NO") << endl;;
  }
}

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

bool point(double x1, double y1, double x2, double y2, double x3, double y3, double px, double py){
	double a1 = (x2 != x1) ? (y2 - y1) / (x2 - x1) : 100000 * (((y2 - y1) < 0) * 2 - 1 );
	double a2 = (x3 != x1) ? (y3 - y1) / (x3 - x1) : 100000 * (((y3 - y1) < 0) * 2 - 1 );
	double ap = (px != x1) ? (py - y1) / (px - x1) : 100000 * (((py - y1) < 0) * 2 - 1 );
	
	if ((a1 > ap && a2 < ap) || (a1 < ap && a2 > ap))
		return true;
	else
		return false;
}

int main(){
	double x1, y1, x2, y2, x3, y3, px, py;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py)
		std::cout << ((point(x1, y1, x2, y2, x3, y3, px, py) && point(x2, y2, x3, y3, x1, y1, px, py)) ? "YES" : "NO") << std::endl;

	return 0;
}

C++: #include <iostream>
double x[3], y[3], xp, yp;
int main() {
	while (std::cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp) {
		int bit = 2;
		for (int i=0; i<3; ++i) {
			double tmp = (x[(i+1)%3]-x[i])*(yp-y[i])-(y[(i+1)%3]-y[i])*(xp-x[i]);
			bit &= ~((tmp < 0) + 1);
		}
		std::cout << (bit ? "YES" : "NO") << "\n";
	}
}

C++: //知ってるか知らないかだと思ったので解答例を見た、受験の時にそういえばやった
#include<complex>
#include<cmath>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef complex<double> P;

//ベクトルa,bの張る三角形の面積(外戚の1/2)(符号つき)
double triangle_area_product(P a,P b){return (conj(a)*b).imag()/2;}

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    P p1(x1-xp,y1-yp);P p2(x2-xp,y2-yp);P p3(x3-xp,y3-yp);
    double d1=triangle_area_product(p1,p2);
    double d2=triangle_area_product(p2,p3);
    double d3=triangle_area_product(p3,p1);
    bool ok=(d1>0 and d2>0 and d3>0) or (d1<0 and d2<0 and d3<0);
    //三項演算子積極的に使いたい
    cout << (ok ? "YES" : "NO") << endl;
  }
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,px,py;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
    double s1=0,s2=0,s3=0,s=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,a2=0,b2=0,c2=0,a3=0,b3=0,c3=0;
    a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s=(a+b+c)/2;
    s=sqrt(s*(s-a)*(s-b)*(s-c));

    a1=sqrt((px-x2)*(px-x2)+(py-y2)*(py-y2));
    b1=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c1=sqrt((x3-px)*(x3-px)+(y3-py)*(y3-py));
    s1=(a1+b1+c1)/2;
    s1=sqrt(s1*(s1-a1)*(s1-b1)*(s1-c1));

    a2=sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
    b2=sqrt((px-x3)*(px-x3)+(py-y3)*(py-y3));
    c2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s2=(a2+b2+c2)/2;
    s2=sqrt(s2*(s2-a2)*(s2-b2)*(s2-c2));

    a3=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b3=sqrt((x2-px)*(x2-px)+(y2-py)*(y2-py));
    c3=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    s3=(a3+b3+c3)/2;
    s3=sqrt(s3*(s3-a3)*(s3-b3)*(s3-c3));

    if((-N<s1 && s1<N) || (-N<s2 && s2<N) || (-N<s3 && s3<N) )cout<<"NO"<<endl;
    else if((s1+s2+s3)>s-N && (s1+s2+s3)<s+N )cout<<"YES"<<endl;
    else  cout<<"NO"<<endl; 
  }
  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 <bits/stdc++.h>
using namespace std;

int main() {
	
	double x1,x2,x3,y1,y2,y3,xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		
		double o1,o2,o3;
		o1=(x2-x1)*(yp-y2)-(y2-y1)*(xp-x2);
		o2=(x3-x2)*(yp-y3)-(y3-y2)*(xp-x3);
		o3=(x1-x3)*(yp-y1)-(y1-y3)*(xp-x1);
		if((o1>0 && o2>0 && o3>0)||(o1<0 && o2<0 && o3<0)){
			printf("YES\n");
		}else{
	 		printf("NO\n");
		}
	}
}

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

using namespace std;

inline double out(double ax,double ay,double bx,double by){
	return bx * ay - by * ax;
}

int main(void){
	double x1, y1, x2, y2, x3, y3, px, py;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&px,&py) != EOF){
		if((out(px - x1,py - y1,x2 - x1,y2 - y1) > 0 && out(px - x2,py - y2,x3 - x2,y3 - y2) > 0 && out(px - x3,py - y3,x1 - x3,y1 - y3) > 0) || (out(px - x1,py - y1,x2 - x1,y2 - y1) < 0 && out(px - x2,py - y2,x3 - x2,y3 - y2) < 0 && out(px - x3,py - y3,x1 - x3,y1 - y3) < 0)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

	return 0;
}