Language: C++

// package codecheck;

import java.util.Scanner;
import java.util.Arrays;

class Geometries {
    static double EPS = 1e-9;
    class Point implements Comparable<Point> {
        double x;
        double y;

        public Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        public int compareTo(Point o) {
            if (Math.abs(x - o.x) > EPS)
                return (int) Math.signum(x - o.x);
            else
                return (int) Math.signum(y - o.y);
        }

        Point add(Point p) {
            return new Point(x + p.x, y + p.y);
        }
     
        Point subtract(Point p) {
            return new Point(x - p.x, y - p.y);
        }
     
        Point multiply(double k) {
            return new Point(x * k, y * k);
        }
     
        Point devide(double k) {
            return new Point(x / k, y / k);
        }
    }

    class Segment {
        Point p1;
        Point p2;

        public Segment() {
            this(new Point(), new Point());
        }
     
        public Segment(Point p1, Point p2) {
            this.p1 = p1;
            this.p2 = p2;
        }
    }

    static double exteriorProduct(Point p1, Point p2) {
        return p1.x * p2.y - p1.y * p2.x;
    }

    static bool cross(Segment s1, Segment s2) {
        bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS 
        bool b2 = exteriorProduct(s2.p2.subtract(s2.p1), s1.p1) * exteriorProduct(s2.p2.subtract(s2.p1), s1.p2)  < EPS 
        return b1 && b2;
    }
}


public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
        String line;
        String[] words;
 
        int q = sc.nextInt();
 
        for (int i = 0; i < q; i++) {
            double xp0, yp0, xp1, yp1, xp2, yp2, xp3, yp3;
            xp0 = sc.nextDouble();
            yp0 = sc.nextDouble();
            xp1 = sc.nextDouble();
            yp1 = sc.nextDouble();
            xp2 = sc.nextDouble();
            yp2 = sc.nextDouble();
            xp3 = sc.nextDouble();
            yp3 = sc.nextDouble();
 
            Point p0, p1, p2, p3;
            p0 = new Point(xp0, yp0);
            p1 = new Point(xp1, yp1);
            p2 = new Point(xp2, yp2);
            p3 = new Point(xp3, yp3);

            Segment s1, s2;
            s1 = new Segment(p0, p1);
            s2 = new Segment(p2, p3);
 
            if (Geometries.cross(s1, s2)) {
                System.out.println(1);
            } else {
                System.out.println(0);
            }
        }

  }
}



Compiler output:
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Scanner;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Arrays;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:19: error: 'constexpr' needed for in-class initialization of static data member 'double Geometries::EPS' of non-integral type [-fpermissive]
    7 |     static double EPS = 1e-9;
      |                   ^~~
a.cc:8:17: error: field 'implements' has incomplete type 'Point'
    8 |     class Point implements Comparable<Point> {
      |                 ^~~~~~~~~~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:8:17: error: expected ';' at end of member declaration
    8 |     class Point implements Comparable<Point> {
      |                 ^~~~~~~~~~
      |                           ;
a.cc:8:28: error: 'Comparable' does not name a type
    8 |     class Point implements Comparable<Point> {
      |                            ^~~~~~~~~~
a.cc:42:15: error: field 'p1' has incomplete type 'Point'
   42 |         Point p1;
      |               ^~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:43:15: error: field 'p2' has incomplete type 'Point'
   43 |         Point p2;
      |               ^~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:45:15: error: expected ':' before 'Segment'
   45 |         public Segment() {
      |               ^~~~~~~~
      |               :
a.cc:49:15: error: expected ':' before 'Segment'
   49 |         public Segment(Point p1, Point p2) {
      |               ^~~~~~~~
      |               :
a.cc:53:6: error: expected ';' after class definition
   53 |     }
      |      ^
      |      ;
a.cc:64:2: error: expected ';' after class definition
   64 | }
      |  ^
      |  ;
a.cc: In constructor 'Geometries::Segment::Segment()':
a.cc:46:28: error: invalid use of incomplete type 'class Point'
   46 |             this(new Point(), new Point());
      |                            ^
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:46:41: error: invalid use of incomplete type 'class Point'
   46 |             this(new Point(), new Point());
      |                                         ^
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:46:42: error: expression cannot be used as a function
   46 |             this(new Point(), new Point());
      |                                          ^
a.cc: At global scope:
a.cc:49:30: error: 'p1' has incomplete type
   49 |         public Segment(Point p1, Point p2) {
      |                        ~~~~~~^~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:49:40: error: 'p2' has incomplete type
   49 |         public Segment(Point p1, Point p2) {
      |                                  ~~~~~~^~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc: In constructor 'Geometries::Segment::Segment(Point, Point)':
a.cc:50:18: error: request for member 'p1' in '(Geometries::Segment*)this', which is of pointer type 'Geometries::Segment*' (maybe you meant to use '->' ?)
   50 |             this.p1 = p1;
      |                  ^~
a.cc:51:18: error: request for member 'p2' in '(Geometries::Segment*)this', which is of pointer type 'Geometries::Segment*' (maybe you meant to use '->' ?)
   51 |             this.p2 = p2;
      |                  ^~
a.cc: At global scope:
a.cc:55:41: error: 'p1' has incomplete type
   55 |     static double exteriorProduct(Point p1, Point p2) {
      |                                   ~~~~~~^~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc:55:51: error: 'p2' has incomplete type
   55 |     static double exteriorProduct(Point p1, Point p2) {
      |                                             ~~~~~~^~
a.cc:8:11: note: forward declaration of 'class Point'
    8 |     class Point implements Comparable<Point> {
      |           ^~~~~
a.cc: In static member function 'static bool Geometries::cross(Segment, Segment)':
a.cc:60:38: error: '<typeprefixerror>Geometries::Segment::p2' is private within this context
   60 |         bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS
      |                                      ^~
a.cc:43:15: note: declared private here
   43 |         Point p2;
      |               ^~
a.cc:60:53: error: '<typeprefixerror>Geometries::Segment::p1' is private within this context
   60 |         bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS
      |                                                     ^~
a.cc:42:15: note: declared private here
   42 |         Point p1;
      |               ^~
a.cc:60:61: error: '<typeprefixerror>Geometries::Segment::p1' is private within this context
   60 |         bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS
      |                                                             ^~
a.cc:42:15: note: declared private here
   42 |         Point p1;
      |               ^~
a.cc:60:86: error: '<typeprefixerror>Geometries::Segment::p2' is private within this context
   60 |         bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS
      |                                                                                      ^~
a.cc:43:15: note: declared private here
   43 |         Point p2;
      |               ^~
a.cc:60:101: error: '<typeprefixerror>Geometries::Segment::p1' is private within this context
   60 |         bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS
      |                                                                                                     ^~
a.cc:42:15: note: declared private here
   42 |         Point p1;
      |               ^~
a.cc:60:109: error: '<typeprefixerror>Geometries::Segment::p2' is private within this context
   60 |         bool b1 = exteriorProduct(s1.p2.subtract(s1.p1), s2.p1) * exteriorProduct(s1.p2.subtract(s1.p1), s2.p2)  < EPS
      |                                                                                                             ^~
a.cc:43:15: note: declared private here
   43 |         Point p2;
      |               ^~
a.cc:63:5: warning: no return statement in function returning non-void [-Wreturn-type]
   63 |     }
      |     ^
a.cc: At global scope:
a.cc:67:1: error: expected unqualified-id before 'public'
   67 | public class Main {
      | ^~~~~~