Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct point{ double x, y; };

point sub(const point& a, const point& b){
  point ret;
  ret.x = a.x - b.x;
  ret.y = a.y - b.y;
  return ret;
}

int solve(point a, point b, point c, point p){
  point ab = sub(b, a), bp = sub(p, b);
  point bc = sub(c, b), cp = sub(p, c);
  point ca = sub(a, c), ap = sub(p, a);

  double c1 = ab.x * bp.y - ab.y * bp.x;
  double c2 = bc.x * cp.y - bc.y * cp.x;
  double c3 = ca.x * ap.y - ca.y * ap.x;

  if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) return 1;
  return 0;
}

int main(){
  double x1, x2, x3, xp, y1, y2, y3, yp;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)){
    point a, b, c, P;
    a.x = y1; a.y = x1;
    b.x = y2; b.y = x2;
    c.x = y3; c.y = x3;
    P.x = yp; P.y = xp;

    if(solve(a, b, c, P)) puts("YES");
    else puts("NO");
  }
  return 0;
}

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

using namespace std;

int main(){
  double x[3], y[3], p[2];

  while(cin >> x[0] >> y[0]){
    for(int i = 1; i < 3; i++){
      cin >> x[i] >> y[i];
    }
    cin >> p[0] >> p[1];

    // pを(0,0)として三角形の位置をづらす
    for(int i = 0; i < 3; i++){
      x[i] -= p[0];
      y[i] -= p[1];
    }

    // 上下左右の判定
    bool under = false;
    bool top = false;
    bool side[2] = {false};
    for(int i = 0; i < 3; i++){
      if(y[i] > 0){
	under = true;
      }
      if(y[i] < 0){
	top = true;
      }
      if(x[i] > 0){
	side[0] = true;
      }
      if(x[i] < 0){
	side[1] = true;
      }
    }

    if(under && top && side[0] && side[1]){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

#define X real()
#define Y imag()
#define EQ(a,b) (abs((a)-(b)) < EPS)
typedef complex<double> P;
const double EPS = 1e-10;

double dot(P a, P b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

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

int is_point_on_line(P a, P b, P c) {
	if ( EQ(abs(a-c), 0.0) || EQ(abs(b-c), 0.0) ) return 1;

	if (a.real() < b.real()) {
		if (c.real() < a.real() || b.real() < c.real()) return 0;
	} else {
		if (c.real() < b.real() || a.real() < c.real()) return 0;
	}

	if (a.imag() < b.imag()) {
		if (c.imag() < a.imag() || b.imag() < c.imag()) return 0;
	} else {
		if (c.imag() < b.imag() || a.imag() < c.imag()) return 0;
	}

	return EQ( cross(b-a, c-a), 0.0 );
}

bool is_intersected(P a1, P a2, P b1, P b2) {
	return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < -EPS ) &&
		( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < -EPS );
}

int main() {
	double latte[4], beet[4];
	while (cin >> latte[0]) {
		rep(i, 4) {
			if (i == 0) cin >> beet[0];
			else cin >> latte[i] >> beet[i];
		}

		P a[3], r;

		rep(i, 3) {
			a[i] = P(latte[i], beet[i]);
		}

		r = P(latte[3], beet[3]);

		bool f = false;
		rep(i, 3) {
			if (a[i] == r) f = true;
		}
		rep(i, 3) {
			if (is_point_on_line(a[i], a[(i + 1) % 3], r)) {
				f = true;
			}
		}
		if (f) {
			cout << "NO" << endl;
			continue;
		}

		int ans = 1;
		int cnt = 0;
		rep(_, 4) {
			rep(i, 3) {
				cnt += is_intersected(a[i], a[(i + 1) % 3], r, P(100.1 * (_ & 2 ? 1 : -1), 100.1 * (_ & 1 ? 1 : -1)));
			}
			ans *= cnt;
		}

		cout << (ans ? "YES" : "NO") << endl;
	}
}

C++: #include <stdio.h>

int main(void) {

  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) {

    double s,t;

    s=(double)((y3-y1)*(xp-x1)-(x3-x1)*(yp-y1))/(double)((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));

    t=(double)((x2-x1)*(yp-y1)-(xp-x1)*(y2-y1))/(double)((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));

    if(s+t<1) {
      printf("%lf %lf",s,t);
      printf("YES\n");

    } else {
      printf("%lf %lf",s,t);      
      printf("NO\n");

    }
       
  }
   
  return 0;

}

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

double getd(double x, double y){
	double r = atan2(y, x) * 180 / M_PI;
	return r;
}

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

C++: #include<iostream>

struct Point{
	double x, y;
};
typedef Point Vector;

double ExteriorProduct(Vector v1, Vector v2){
	return v1.x*v2.y-v2.x*v1.y;
}

int Abs(int i){
	return i>0?i:-i;
}

int main(){
	Point ps[3], p;
	while(true){
		for(int i=0;i<3;i++){
			std::cin >> ps[i].x >> ps[i].y;
		}
		if(std::cin.eof())break;

		std::cin >> p.x >> p.y;

		int count = 0;
		for(int i=0;i<3;i++){
			Vector pv, v; //点Pからのベクトルと辺のベクトル
			Point first_p = ps[i], second_p = ps[(i+1)%3];
			pv = {p.x-first_p.x, p.y-first_p.y};
			v = {first_p.x-second_p.x, first_p.y-second_p.y};
			if(ExteriorProduct(pv, v) > 0){
				count++;
			}
		}

		if(Abs(count) == 3){
			std::cout << "YES\n";
		}else{
			std::cout << "NO\n";
		}
	}
	return 0;
}