Language: C++

#region ZIPPER
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using sc = Scanner;
using Geometry;
using gl = Geometry.GeometryLibrary;
class Program
{
    static void Main(string[] args)
    {
        Solver solver = new Solver();
        solver.Solve();
#if DEBUG
        System.Console.WriteLine("?¶?????????????????????????????????????????????????????????????");
        System.Console.ReadKey();
#endif

    }
}
/// <summary>
/// ?¨??????\????????????????????´???????????????????????????????????????
/// </summary>
public static class Scanner
{
    public static string NextString()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return tmp;
    }
    public static int NextInt()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return int.Parse(tmp);
    }
    public static long NextLong()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return long.Parse(tmp);
    }
    public static double NextDouble()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return double.Parse(tmp);
    }

    public static string[] NextStrArray()
    {
        return Console.ReadLine().Split(' ');
    }
    public static int[] NextIntArray()
    {

        string[] s = NextStrArray();
        int[] a = new int[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = int.Parse(s[i]);
        }
        return a;
    }
    public static long[] NextLongArray()
    {
        string[] s = NextStrArray();
        long[] a = new long[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = long.Parse(s[i]);
        }
        return a;
    }
    public static double[] NextDoubleArray()
    {
        string[] s = NextStrArray();
        double[] a = new double[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = double.Parse(s[i]);
        }
        return a;
    }
}
#endregion ZIPPER

public class Solver
{
#region IGNORE_ME
    public Solver()
    {
        //???????????¨?????????????????????????????????????????????
    }
#endregion IGNORE_ME

    public void Solve()
    {
        int q = sc.NextInt();
        Point[] p = new Point[4*q];
        for (int i = 0; i < 4*q; i++)
        {
            p[i] = new Point(sc.NextInt(), sc.NextInt());
        }
        for (int i = 0; i < q; i++)
        {
            int s = 4*i;
            if (gl.DoesIntersect(p[s], p[s + 1], p[s + 2], p[s + 3]))
            {
                Console.WriteLine("1");
            }
            else
                Console.WriteLine("0");
        }
#if DEBUG
        Console.WriteLine("");//local check
#endif
    }
}
namespace Geometry
{
    /// <summary>
    /// ??????x,y??§?¨??????¨???(double???)
    /// </summary>
    public struct dPoint
    {
        public double x;
        public double y;
        public dPoint(int x, int y)
        {
            this.x = (double)x; this.y = (double)y;
        }
        public dPoint(double x, double y)
        {
            this.x = x; this.y = y;
        }
        public static dPoint operator +(dPoint p1, dPoint p2)
        {
            return new dPoint(p1.x + p2.x, p1.y + p2.y);
        }
        public static dPoint operator -(dPoint p1, dPoint p2)
        {
            return new dPoint(p1.x - p2.x, p1.y - p2.y);
        }
        public static dPoint operator *(double s, dPoint p)
        {
            return new dPoint(s * p.x, s * p.y);
        }
    }
    /// <summary>
    /// ??????x,y??§?¨??????¨???(int???)
    /// </summary>
    public struct Point
    {
        public int x;
        public int y;
        public Point(int x, int y)
        {
            this.x = x; this.y = y;
        }
        public static Point operator +(Point p1, Point p2)
        {
            return new Point(p1.x + p2.x, p1.y + p2.y);
        }
        public static Point operator -(Point p1, Point p2)
        {
            return new Point(p1.x - p2.x, p1.y - p2.y);
        }
        public static Point operator *(int s, Point p)
        {
            return new Point(s * p.x, s * p.y);
        }
    }

    public static class GeometryLibrary
    {


        /// <summary>
        /// ??????
        /// </summary>
        /// <returns></returns>
        public static double Naiseki(dPoint p1, dPoint p2)
        {
            return p1.x * p2.x + p1.y * p2.y;
        }
        /// <summary>
        /// ??????
        /// </summary>
        /// <returns></returns>
        public static int Naiseki(Point p1, Point p2)
        {
            return p1.x * p2.x + p1.y * p2.y;
        }
        /// <summary>
        /// ??´???p1,p2???????????????p????°???±
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static dPoint Projection(dPoint p1, dPoint p2, dPoint p)
        {
            dPoint a = p2 - p1;
            dPoint b = p - p1;
            double t = Naiseki(a, b) / Naiseki(a, a);
            return t * a + p1 ;
        }
        /// <summary>
        /// ??´???p1p2???????????????p???????°????p1,p2???????????´?????????????§°??????p????§????
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static dPoint Refrection(dPoint p1, dPoint p2, dPoint p)
        {
            return 2 * Projection(p1, p2, p) - p;
        }

        /// <summary>
        /// p1p2??¨p3p4???2??´????????????
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="p3"></param>
        /// <param name="p4"></param>
        /// <returns></returns>
        public static bool IsParallel(Point p1, Point p2, Point p3, Point p4)
        {
            Point a = p2 - p1;
            Point b = p4 - p3;
            if (Naiseki(a, b) * Naiseki(a, b) == Naiseki(a, a) * Naiseki(b, b)) return true;
            return false;
        }
        /// <summary>
        ///  p1p2??¨p3p4???2??´???????????´
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="p3"></param>
        /// <param name="p4"></param>
        /// <returns></returns>
        public static bool IsVertical(Point p1, Point p2, Point p3, Point p4)
        {
            Point a = p2 - p1;
            Point b = p4 - p3;
            if (Naiseki(a, b) == 0) return true;
            return false;
        }
        /// <summary>
        ///  p1p2??¨p3p4???2????????????????????? ?????????http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/Intersection.htm
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="p3"></param>
        /// <param name="p4"></param>
        /// <returns></returns>
        public static bool DoesIntersect(Point p1, Point p2, Point p3, Point p4)
        {
            Point a = p1 - p2;
            Point b = p3 - p1;
            Point c = p4 - p1;
            long tc = a.x * b.y + a.y * (-b.x);
            long td = a.x * c.y + a.y * (-c.x);
            Point d = p3 - p4;
            Point e = p1 - p3;
            Point f = p2 - p3;
            long ta = d.x * e.y + d.y * (-e.x);
            long tb = d.x * f.y + d.y * (-f.x); 
            if (tc * td <= 0 && ta * tb <= 0) return true;
            return false;
        }
    }
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #region
    1 | #region ZIPPER
      |  ^~~~~~
a.cc:149:2: error: invalid preprocessing directive #endregion
  149 | #endregion ZIPPER
      |  ^~~~~~~~~
a.cc:153:2: error: invalid preprocessing directive #region
  153 | #region IGNORE_ME
      |  ^~~~~~
a.cc:158:2: error: invalid preprocessing directive #endregion
  158 | #endregion IGNORE_ME
      |  ^~~~~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Collections;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Linq;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Text;
      |       ^~~~~~
a.cc:7:12: error: 'Scanner' does not name a type
    7 | using sc = Scanner;
      |            ^~~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'Geometry'
    8 | using Geometry;
      |       ^~~~~~~~
a.cc:9:12: error: 'Geometry' does not name a type
    9 | using gl = Geometry.GeometryLibrary;
      |            ^~~~~~~~
a.cc:12:22: error: 'string' has not been declared
   12 |     static void Main(string[] args)
      |                      ^~~~~~
a.cc:12:31: error: expected ',' or '...' before 'args'
   12 |     static void Main(string[] args)
      |                               ^~~~
a.cc:22:2: error: expected ';' after class definition
   22 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main(int*)':
a.cc:14:9: error: 'Solver' was not declared in this scope
   14 |         Solver solver = new Solver();
      |         ^~~~~~
a.cc:15:9: error: 'solver' was not declared in this scope
   15 |         solver.Solve();
      |         ^~~~~~
a.cc: At global scope:
a.cc:26:1: error: expected unqualified-id before 'public'
   26 | public static class Scanner
      | ^~~~~~
a.cc:151:1: error: expected unqualified-id before 'public'
  151 | public class Solver
      | ^~~~~~
a.cc:188:5: error: expected unqualified-id before 'public'
  188 |     public struct dPoint
      |     ^~~~~~
a.cc:216:5: error: expected unqualified-id before 'public'
  216 |     public struct Point
      |     ^~~~~~
a.cc:238:5: error: expected unqualified-id before 'public'
  238 |     public static class GeometryLibrary
      |     ^~~~~~