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>
using namespace std;

int main(){
	int rail[11];
	int num=0;
	while(true){
		int now;
		cin >> now;
		if(cin.eof())
			break;
		else if(now ==0){
			cout << rail[num] << endl;
			num--;
		}
		else{
			num++;
			rail[num] = now;
		}
	
	}
	return 0;

}

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

int main(){
	string str[100];
	int k = -1;
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		k++;
		for(int i = 0; i < 3; i++){
			if(y1 != y2 && x1 != x2){
				double b, c, d;
				b = (x1-x2)/(-y1+y2);
				c = (-y1*x2+y2*x1)/(-y1+y2);
				d = x3+b*y3;
				if(((c-xp)/b > yp && yp < (d-xp)/b) || ((c-xp)/b < yp && yp > (d-xp)/b)){
					str[k] = "NO";
					continue;
				}
			}
			else if(y1 == y2){
				if((y1 > yp && yp < y3) || (y1 < yp && yp > y3)){
					str[k] = "NO";
					continue;
				}
			}
			else if(x1 == x2){
				if((x1 > xp && xp < x3) || (x1 < xp && xp > x3)){
					str[k] = "NO";
					continue;
				}
			}
			str[k] = "YES";
			swap(x2,x3);
			swap(x2,x1);
			swap(y2,y3);
			swap(y2,y1);
		}
	}
	for(int i = 0; i < k+1; i++){
		cout << str[i] << endl;
	}
}

C++: #include <iostream>
using namespace std;
const int INF = 1<<29;

int main(){
	double X[3], Y[3];
	double px, py;
	while( cin >> X[0] >> Y[0] >> X[1] >> Y[1] >> X[2] >> Y[2] >> px >> py ){
		int cnt = 0;
		for( int i=0; i<3; i++ ){
			if( (X[(i+1)%3]-X[i])*(py-Y[i]) - (px-X[i])*(Y[(i+1)%3]-Y[i]) > 0 ) cnt++;
		}
		if( cnt%3 ) cout << "NO" << endl;
		else cout << "YES" << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	double x[3],y[3],xp,yp,r,xmax,xmin,ymax,ymin;
	int sum;
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		xmax=max(x[0],max(x[1],x[2]));
		ymax=max(y[0],max(y[1],y[2]));
		xmin=min(x[0],min(x[1],x[2]));
		ymin=min(y[0],min(x[1],x[2]));
		sum=0;
		if(x[0]-x[1]==0)
			;
		else{
			r=(y[0]-y[1])*(xp-x[0])/(x[0]-x[1])+y[0];
		if(yp<r&&r>=ymin&&r<=ymax)
			sum++;
		}
		if(x[0]-x[2]==0)
		;
		else{
		r=(y[0]-y[2])*(xp-x[0])/(x[0]-x[2])+y[0];
		if(yp<r&&r>=ymin&&r<=ymax)
			sum++;
		}
		if(x[2]-x[1]==0)
			;
		else{
		r=(y[2]-y[1])*(xp-x[2])/(x[2]-x[1])+y[2];
			if(yp<r&&r>=ymin&&r<=ymax)
			sum++;
		}
		if(sum==1&&xp>=xmin&&xp<=xmax)
		cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<queue>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t p,xy_t q);
{
  return (conj(p)*q).imag();
}
int main()
{
  double x[4],y[4];
  while(true){
    for( int i = 0; i < 4; ++i) cin >> x[i] >> y[i];
    if(!cin) break;
    xy_t a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]),p(x[3],y[3]);
    double S1,S2,S3;
    S1 = cross_product(a - p, b - p);
    S2 = cross_product(b - p, c - p);
    S3 = cross_product(c - p, a - p);
    bool ok = (S1 > 0 && S2 > 0 && S3 > 0) || (S1 < 0 && S2 < 0 && S3 < 0);
    cout << (ok ? "YES":"NO") << endl;
  }
}

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;

typedef struct point {
    ld x, y;
} POINT;

bool sign(POINT p1, POINT p2, POINT p3) {
    return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y) > 0;
}

bool pointInTraiangle(POINT x, POINT a, POINT b, POINT c) {
    return sign(x, a, b) && sign(x, b, c) && sign(x, c, a);
}

void solver() {
    ld x1, x2, x3, xp, y1, y2, y3, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        POINT p1,p2,p3,pp;
        p1.x=x1;p1.y=y1;
        p2.x=x2;p2.y=y2;
        p3.x=x3;p3.y=y3;
        pp.x=xp;pp.y=yp;
        if (pointInTraiangle(pp,p1,p2,p3)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	double x[4], y[4];
	bool left, right;
	double ax, ay, px, py;

	while(1){
		for(int i = 0; i < 4; i++){
			if(!(cin >> x[i] >> y[i])){
				return 0;
			}
		}

		left = false;
		right = false;
		for(int i = 0; i < 3; i++){
			ax = x[(i+1)%3]-x[i];
			ay = y[(i+1)%3]-y[i];
			px = x[3] - x[i];
			py = y[3] - y[i];
			if( ax*py-px*ay < 0){
				right = true;
				break;
			}else{
				left = true;
			}
		}

		if(left^right){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

struct TCoordinate
{
	double x;
	double y;
};

double GetCrossProduct(const TCoordinate& V1, const TCoordinate& V2)
{
	return V1.x * V2.y - V1.y * V2.x;
}

bool IsSameSide(const TCoordinate& T1, const TCoordinate& T2, const TCoordinate& L1, const TCoordinate& L2)
{
	TCoordinate VectorL1T1 = {T1.x - L1.x, T1.y - L1.y};
	TCoordinate VectorL1T2 = {T2.x - L1.x, T2.y - L1.y};
	TCoordinate VectorL1L2 = {L2.x - L1.x, L2.y - L1.y};
	return GetCrossProduct(VectorL1T1, VectorL1L2) * GetCrossProduct(VectorL1T2, VectorL1L2) > 0;
}

int main()
{
	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;
		if(IsSameSide(A3, Ap, A1, A2) && IsSameSide(A1, Ap, A2, A3) && IsSameSide(A2, Ap, A3, A1)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

double x[4],y[4];
string judge ();

int main() {
	while ( cin >> x[0] ) {
		for( int i = 0; i < 4; i++ ){
			if ( !i )
				cin >> y[i];
			else
				cin >> x[i] >> y[i];
		}
		
		cout <<  judge () << endl;
		
	}
	return 0;
}

string judge () {
	string res;
	
	for ( int i = 0; i < 3; i++ ){
		int next;
		if ( i == 2 ) 
			next = '0';
		else
			next = i + 1;
		if ( x[i] < x[next] && x[i] > x[3] || x[i] > x[next] && x[i] < x[3] )
			return "NO";
		if ( y[i] < y[next] && y[i] > y[3] || y[i] > y[next] && y[i] < y[3] )
			return "NO";
	}
	return "YES";
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>
using namespace std;
double x,y;
bool cross(double a,double b,double c,double d)
{
	return (c-a)*(y-b)-(x-a)*(d-b)>0;
}
int main()
{
	double a,b,c,d,e,f;
	for(;cin>>a>>b>>c>>d>>e>>f>>x>>y;)
	{
		int cnt=0;
		cnt+=cross(a,b,c,d);
		cnt+=cross(c,d,e,f);
		cnt+=cross(e,f,a,b);
		cout<<(cnt==0||cnt==3?"YES":"NO")<<endl;
	}
}

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

int main() {
	typedef complex<double> com;
	double x1, y1, x2, y2, x3, y3, xp, yp, s1, s2, s3;
	while ( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ) {
		s1 = ( conj( com( x1 - xp, y1 - yp ) ) * com( x2 - xp, y2 - yp ) ).imag();
		s2 = ( conj( com( x2 - xp, y2 - yp ) ) * com( x3 - xp, y3 - yp ) ).imag();
		s3 = ( conj( com( x3 - xp, y3 - yp ) ) * com( x1 - xp, y1 - yp ) ).imag();
		if ( s1 * s2 > 0 && s2 * s3 > 0 && s3 * s1 > 0 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}