//ヘッダファイル
#include<stdio.h>
#include<math.h>

//マクロ定義
#define TRUE 1
#define FALSE 0

#define POINT1 0
#define POINT2 1
#define POINT3 2
#define TRIANGLE 3
#define AREA 4

#define compile 0

//関数のプロトタイプ宣言
int func_cal(double x[], double y[], double px, double py);
double func_cal_edge(double x[], double y[], double edge[]);
double func_cal_distance(double x, double y, double px, double py);
double func_cal_area(double edge[], double distance_toP[]);
double func_cal_areaT(double edge[], int n);
void func_output(int result);

main()
{
	double x[TRIANGLE] = {0, 0, 0};
	double y[TRIANGLE] = {0, 0, 0};
	double px = 0, py = 0;
	int result = 0, i = 0;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[POINT1], &y[POINT1], &x[POINT2], &y[POINT2], &x[POINT3], &y[POINT3], &px, &py) != EOF) //入力がEOFになるまで繰り返す
	{
		result = func_cal(x, y, px, py); //resultにfunc_calの結果を代入
		func_output(result);
		for(i = 0; i < TRIANGLE; i++)
		{
			x[i] = 0;
			y[i] = 0;
		}
		px = 0;
		py = 0;
	}
	return 0;
}

int func_cal(double x[], double y[], double px, double py)
{
	int i = 0, result = 0; //iはfor文制御用の変数
	double edge[TRIANGLE] = {0, 0, 0}; //0を点1点2の辺,1を点2点3の辺,2を点3点1の辺とする
	double area[AREA] = {0, 0, 0, 0};
	double distance_toP[TRIANGLE] = {0, 0, 0}; //与えられた3点と点pの距離を格納する
	/*
	area[0〜2]:点pを頂点に含む三角形3つの面積
	area[3]:与えられた3つの点を頂点とする三角形の面積
	--------------------------------------------------
	distance_toP[0]:点1から点pの距離
	distance_toP[1]:点2から点pの距離
	distance_toP[2]:点3から点pの距離
	*/
	
	func_cal_edge(x, y, edge); //辺の長さを計算する関数

#if compile == 1
	printf("edge[0] = %lf\n", edge[0]);
	printf("edge[1] = %lf\n", edge[1]);
	printf("edge[2] = %lf\n", edge[2]);
#endif
	
	for(i = 0; i < TRIANGLE; i++)
	{
		distance_toP[i] = func_cal_distance(x[i], y[i], px, py);
	}
	for(i = 0; i < AREA; i++)
	{
		if(i < AREA - 1)
		{
			area[i] = func_cal_area(edge, distance_toP);
		}
		else
		{
			area[i] = func_cal_areaT(edge, TRIANGLE); //areaの3番目に与えられた3点を頂点とする三角形の面積を代入
			//printf("i = %d area[%d] = %lf\n", i, i, area[i]);
		}
	}
	//printf("area[%d] = %.15lf\n", TRIANGLE, area[TRIANGLE]);
	//printf("area sum = %lf\n", area[0] + area[1] + area[2]);
	if(((area[0] + area[1] + area[2]) - area[TRIANGLE]) <= 0.0000001)
	{
		result = TRUE;
		return result;
	}
	else
	{
		result = FALSE;
		return result;
	}
}

double func_cal_edge(double x[], double y[], double edge[]) //辺の長さを計算する関数
{
	edge[0] = sqrt(pow(x[POINT1] - x[POINT2], 2) + pow(y[POINT1] - y[POINT2], 2));
	edge[1] = sqrt(pow(x[POINT2] - x[POINT3], 2) + pow(y[POINT2] - y[POINT3], 2));
	edge[2] = sqrt(pow(x[POINT1] - x[POINT3], 2) + pow(y[POINT1] - y[POINT3], 2));
}

double func_cal_distance(double x, double y, double px, double py) //各点から点pへの距離を計算する関数
{
	double dis = 0;
	dis = sqrt(pow(px - x, 2) + pow(py - y, 2));
	return dis;
}

double func_cal_area(double edge[], double distance_toP[])
{
	static int si = 0, sj = 1; 
	double s = 0, result = 0;
	if((si == 2) && (sj == 3))
	{
		sj = 0;
		s = (edge[si] + distance_toP[si] + distance_toP[sj]) / 2;
		result = sqrt(s * (s - edge[si]) * (s - distance_toP[si]) * (s - distance_toP[sj]));
		si = 0;
		sj = 1;
		return result;
#if compile == 1
		printf("s = %lf\n", s);
		printf("edge[%d] = %lf distance_toP[%d] = %lf distance_toP[%d] = %lf\n", si, edge[si], si, distance_toP[si], sj, distance_toP[sj]);
		printf("area[si] = %lf\n", result);
#endif
	}
	else
	{
		s = (edge[si] + distance_toP[si] + distance_toP[sj]) / 2;
		result = sqrt(s * (s - edge[si]) * (s - distance_toP[si]) * (s - distance_toP[sj]));
#if compile == 1
		printf("s = %lf\n", s);
		printf("edge[%d] = %lf distance_toP[%d] = %lf distance_toP[%d] = %lf\n", si, edge[si], si, distance_toP[si], sj, distance_toP[sj]);
		printf("area[si] = %lf\n", result);
#endif
	}
	si++;
	sj++;
#if compile == 1
	puts("");
#endif
	return result;
}

double func_cal_areaT(double edge[], int n)
{
	double s = 0, result = 0;
	int i = 0;
	for(i = 0; i < n; i++)
	{
		s += (edge[i] / 2);
	}
	result = sqrt(s * (s - edge[0]) * (s - edge[1]) * (s - edge[2]));
	return result;
}

void func_output(int x)
{
	if(x == TRUE)
	{
		puts("YES");
	}
	else
	{
		puts("NO");
	}
}

Measured memory_bytes: 612