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<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
using namespace std;


int main(){

  double x[4], y[4];
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){

    vector<bool> t(3, false);
    for(int i=0; i<3; i++){
      if( ( x[ i ] - x[ (i+1)%3 ] )*( y[ 3 ]-y[ (i+1)%3 ]) - ( y[ i ] - y[ (i+1)%3 ] )*( x[ 3 ] - x[ (i+1)%3 ] ) < 0 ) t[i] = true;
    }

    if( (t[0] && t[1] && t[2])||(!t[0] && !t[1] && !t[2]) ) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}














// EOF

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    float x1, x2, x3, xp, y1, y2, y3, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        auto z1 = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
        auto z2 = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);
        auto z3 = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
        auto isIn = z1 > 0 && z2 > 0 && z3 > 0;
        if (isIn) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

int main() {
    solver();
    return 0;
}

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

class Point {
public:
    double x, y;
};

double dotProduct(Point p1, Point p2) {
    return p1.x * p2.y - p1.y * p2.x;
}

int main () {
    double x[4], y[4];
    while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]) {
        bool result = true;
        for (int i = 0; i < 3; i++) {
            Point p[2];
            p[0].x = x[(i+1) % 3] - x[i];
            p[0].y = y[(i+1) % 3] - y[i];
            p[1].x = x[3] - x[i];
            p[1].y = y[3] - y[i];
            if (dotProduct(p[0], p[1]) <= 0) {
                result = false;
                break;
            }
        }
        if (result) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

template <typename T>
double angle(pair<T, T> a, pair<T, T> b) {
    double costheta = (a.first*b.first + a.second*b.second)/(sqrt(a.first*a.first+a.second*a.second)*sqrt(b.first*b.first+b.second*b.second));
    double ang = acos(costheta);
    while (ang >= M_PI) {
        ang -= M_PI;
    }
    return ang;
}

template <typename T>
double norm(pair<T, T> a) {
    return sqrt(a.first*a.first + a.second*a.second);
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    vector<string> anslist;

    double x1, y1, x2, y2, x3, y3, xp, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        pair<double, double> a, b, p;
        a.first = x2 - x1;
        a.second = y2 - y1;
        b.first = x3 - x1;
        b.second = y3 - y1;
        p.first = xp - x1;
        p.second = yp - y1;
        double theta = angle(a, b);
        double phi = angle(a, p);
        double psi = angle(b, p);
        
        if (norm(p) > norm(a) || norm(p) > norm(b)) {
            anslist.push_back("NO");
            break;
        }
        if (phi > theta || psi > theta) {
            anslist.push_back("NO");
            break;
        }
        anslist.push_back("YES");
    }

    for(auto ans : anslist) {
        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	std::vector<bool>result;
	for (double x1, y1, x2, y2, x3, y3, xp, yp; std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;)
	{
		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;
	}
	return 0;
}

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

double calcSide(double a, double b, double l, double m){
  double side;
  double x, y;
  x = fabs(l - a);
  y = fabs(m - b);
  side = sqrt(x * x + y * y);
  return side;
}

double calcArea(double AB, double AC, double BC){
  double Area;
  double s = (AB + AC + BC) / 2;
  Area = sqrt(s * (s - AB) * (s - AC) * (s - BC));
  return Area;
}

int main(){
  double ax, ay, bx, by, cx, cy, px, py;;
  double ABC, APB, APC, BPC;
  double AB, AC, BC, AP, BP, CP;
  
  while(cin >> ax >> ay >> bx >> by >> cx >> cy >> px >> py){
    
    AB = calcSide(ax, ay, bx, by);
    AC = calcSide(ax, ay, cx, cy);
    BC = calcSide(bx, by, cx, cy);

    AP = calcSide(ax, ay, px, py);
    BP = calcSide(bx, by, px, py);
    CP = calcSide(cx, cy, px, py);

    ABC = calcArea(AB, AC, BC);
    APB = calcArea(AP, AB, BP);
    APC = calcArea(AP, AC, CP);
    BPC = calcArea(BP, BC, CP);

    if(fabs(APB + APC + BPC - ABC) < 0.000000001) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x1,x2,x3,y1,y2,y3,x,y;
  double a,b,c,s,ans;
  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&x2,&x3,&y1,&y2,&y3,&x,&y)!=EOF){
    a=x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);
    b=x*(y-y1)+x1*(y1-y2)+x2*(y2-y);
    c=x*(y-y2)+x2*(y2-y3)+x3*(y3-y);
    s=x*(y-y3)+x3*(y3-y1)+x1*(y1-y);
    if(a<b && a<c && a<s || a>b && a>c && a>s){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> xy_t;
double x[4],y[4];
xy_t d[4];
double a[3]; 
double cross_product(xy_t a,xy_t b){
  return (conj(a)*b).imag();
}
int main(){
  while(1){
    for(int i=0;i<4;i++)cin>>x[i]>>y[i];
    if(!cin)break;
    for(int i=0;i<4;i++)d[i]=xy_t(x[i],y[i]);
    for(int i=0;i<3;i++){
      a[i]=cross_product(d[3]-d[i],d[3]-d[(i+1)%3]);
    }
    if(a[0]<0&&a[1]<0&&a[2]<0){
      cout<<"YES"<<endl;
    }else if(a[0]>0&&a[1]>0&&a[2]>0){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}