https://www.acmicpc.net/problem/17386
import java.util.Scanner;
public class Main {
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;
}
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int x1=s.nextInt(), y1=s.nextInt(), x2=s.nextInt(), y2=s.nextInt();
int x3=s.nextInt(), y3=s.nextInt(), x4=s.nextInt(), y4=s.nextInt();
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) System.out.print("1");
else System.out.print("0");
}
}