https://www.acmicpc.net/problem/17386
#include<stdio.h>
#include<math.h>
static int ccw(long v1, long w1, long v2, long w2, long v3, long w3){
return (v1*w2+v2*w3+v3*w1)-(v2*w1+v3*w2+v1*w3)<0 ? 1 : -1;
}
int main() {
int x1,y1,x2,y2,x3,y3,x4,y4;
scanf("%d %d %d %d %d %d %d %d ",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
int a1=ccw(x1,y1,x2,y2,x3,y3)*ccw(x1,y1,x2,y2,x4,y4);
int a2=ccw(x3,y3,x4,y4,x1,y1)*ccw(x3,y3,x4,y4,x2,y2);
if(a1<0 && a2<0) printf("1");
else printf("0");
}