Language: C++

include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define EPS 1e-10
using namespace std;

int main(void){
    int n;
    cin >> n;
    rep(i,n) {
        int count = 0;
        double x[5],y[5],a,b,c,d,p,q,det,ansx;
        for(int k=0;k<5;k++) {
            cin >> x[k] >> y[k];
        }
        rep(j,3) {
            if(j != 2) {
                a = y[j]-y[j+1];  b = x[j+1]-x[j];
                p = x[j+1]*y[j]-x[j]*y[j+1];
                c = y[3]-y[4];  d = x[4]-x[3];
                q = x[4]*y[3]-x[3]*y[4];
                //係数についての行列式
                det = a*d-c*b;
                //det=0で解は存在しない(この問題については２線分は同一直線上にないから
                if(fabs(det) > EPS){
                    ansx = (d*p - b*q)/det;
                    if((x[j] - ansx)*(x[j+1] - ansx) <= EPS && (x[3] - ansx)*(x[4] - ansx) <= EPS && fabs(ansx - x[j]) > EPS && fabs(ansx - x[j+1]) > EPS ) {
                        count++;
                    }
                }
            } else {
                a = y[j]-y[0];  b = x[0]-x[j];
                p = x[0]*y[j]-x[j]*y[0];
                c = y[3]-y[4];  d = x[4]-x[3];
                q = x[4]*y[3]-x[3]*y[4];
                //係数についての行列式
                det = a*d-c*b;
                if(fabs(det) > EPS){
                    ansx = (d*p - b*q)/det;
                    if((x[j] - ansx)*(x[0] - ansx) <= EPS && (x[3] - ansx)*(x[4] - ansx) <= EPS && fabs(ansx - x[j]) > EPS && fabs(ansx - x[0]) > EPS ) {
                        count++;
                    }
                }
            }
        }
        if(count == 1) cout << "OK" << endl;
        else cout << "NG" << endl;
    }
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
In file included from /usr/include/wchar.h:53,
                 from /usr/include/c++/14/cwchar:44,
                 from /usr/include/c++/14/bits/postypes.h:40,
                 from /usr/include/c++/14/iosfwd:42,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/fstream:40,
                 from a.cc:3:
/usr/include/x86_64-linux-gnu/bits/types/mbstate_t.h:6:9: error: '__mbstate_t' does not name a type
    6 | typedef __mbstate_t mbstate_t;
      |         ^~~~~~~~~~~
/usr/include/wchar.h:104:59: error: 'size_t' has not been declared
  104 |                          const wchar_t *__restrict __src, size_t __n)
      |                                                           ^~~~~~
/usr/include/wchar.h:109:8: error: 'size_t' does not name a type
  109 | extern size_t wcslcpy (wchar_t *__restrict __dest,
      |        ^~~~~~
/usr/include/wchar.h:61:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   60 | # include <bits/types/locale_t.h>
  +++ |+#include <cstddef>
   61 | #endif
/usr/include/wchar.h:115:8: error: 'size_t' does not name a type
  115 | extern size_t wcslcat (wchar_t *__restrict __dest,
      |        ^~~~~~
/usr/include/wchar.h:115:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:126:59: error: 'size_t' has not been declared
  126 |                          const wchar_t *__restrict __src, size_t __n)
      |                                                           ^~~~~~
/usr/include/wchar.h:133:63: error: 'size_t' has not been declared
  133 | extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
      |                                                               ^~~~~~
/usr/include/wchar.h:142:25: error: 'size_t' has not been declared
  142 |                         size_t __n) __THROW;
      |                         ^~~~~~
/usr/include/wchar.h:150:27: error: 'size_t' has not been declared
  150 |                           size_t __n, locale_t __loc) __THROW;
      |                           ^~~~~~
/usr/include/wchar.h:159:8: error: 'size_t' does not name a type
  159 | extern size_t wcsxfrm (wchar_t *__restrict __s1,
      |        ^~~~~~
/usr/include/wchar.h:159:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:174:8: error: 'size_t' does not name a type
  174 | extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
      |        ^~~~~~
/usr/include/wchar.h:174:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:212:8: error: 'size_t' does not name a type
  212 | extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
      |        ^~~~~~
/usr/include/wchar.h:212:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:216:8: error: 'size_t' does not name a type
  216 | extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
      |        ^~~~~~
/usr/include/wchar.h:216:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:247:8: error: 'size_t' does not name a type
  247 | extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
      |        ^~~~~~
/usr/include/wchar.h:247:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:265:8: error: 'size_t' does not name a type
  265 | extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
      |        ^~~~~~
/usr/include/wchar.h:265:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:272:59: error: 'size_t' has not been declared
  272 | extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
      |                                                           ^~~~~~
/usr/include/wchar.h:275:38: error: 'size_t' has not been declared
  275 |                                      size_t __n)
      |                                      ^~~~~~
/usr/include/wchar.h:283:63: error: 'size_t' has not been declared
  283 | extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
      |                                                               ^~~~~~
/usr/include/wchar.h:288:58: error: 'size_t' has not been declared
  288 |                          const wchar_t *__restrict __s2, size_t __n) __THROW;
      |                                                          ^~~~~~
/usr/include/wchar.h:292:63: error: 'size_t' has not been declared
  292 | extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
      |                                                               ^~~~~~
/usr/include/wchar.h:296:53: error: 'size_t' has not been declared
  296 | extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
      |                                                     ^~~~~~
/usr/include/wchar.h:302:59: error: 'size_t' has not been declared
  302 |                           const wchar_t *__restrict __s2, size_t __n)
      |                                                           ^~~~~~
/usr/include/wchar.h:317:27: error: 'mbstate_t' does not name a type
  317 | extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
      |                           ^~~~~~~~~
/usr/include/wchar.h:321:8: error: 'size_t' does not name a type
  321 | extern size_t mbrtowc (wchar_t *__restrict __pwc,
      |        ^~~~~~
/usr/include/wchar.h:321:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:326:8: error: 'size_t' does not name a type
  326 | extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
      |        ^~~~~~
/usr/include/wchar.h:326:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:330:8: error: 'size_t' does not name a type
  330 | extern size_t __mbrlen (const char *__restrict __s, size_t __n,
      |        ^~~~~~
/usr/include/wchar.h:330:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:332:8: error: 'size_t' does not name a type
  332 | extern size_t mbrlen (const char *__restrict __s, size_t __n,
      |        ^~~~~~
/usr/include/wchar.h:332:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:362:8: error: 'size_t' does not name a type
  362 | extern size_t mbsrtowcs (wchar_t *__restrict __dst,
      |        ^~~~~~
/usr/include/wchar.h:362:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:368:8: error: 'size_t' does not name a type
  368 | extern size_t wcsrtombs (char *__restrict __dst,
      |        ^~~~~~
/usr/include/wchar.h:368:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:376:8: error: 'size_t' does not name a type
  376 | extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
      |        ^~~~~~
/usr/include/wchar.h:376:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:382:8: error: 'size_t' does not name a type
  382 | extern size_t wcsnrtombs (char *__restrict __dst,
      |        ^~~~~~
/usr/include/wchar.h:382:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/wchar.h:396:42: error: 'size_t' has not been declared
  396 | extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
      |                                          ^~~~~~
/usr/include/wchar.h:695:59: error: 'size_t' has not been declared
  695 |                          const wchar_t *__restrict __src, size_t __n)
      |                                                           ^~~~~~
/usr/include/wchar.h:718:8: error: '__FILE' does not name a type; did you mean 'EMFILE'?
  718 | extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW
      |        ^~~~~~
      |        EMFILE
/usr/include/wchar.h:725:19: error: '__FILE' was not declared in this scope; did you mean 'EMFILE'?
  725 | extern int fwide (__FILE *__fp, int __mode) __THROW;
      |                   ^~~~~~
      |                   EMFILE
/usr/include/wchar.h:725:27: error: '__fp' was not declared in this scope
  725 | extern int fwide (__FILE *__fp, int __mode) __THROW;
      |                           ^~~~
/usr/include/wchar.h:725:33: error: expected primary-expression before 'int'
  725 | extern int fwide (__FILE *__fp, int __mode) __THROW;
      |                                 ^~~
/usr/include/wchar.h:725:43: error: expression list treated as compound expression in initializer [-fpermissive]
  725 | extern int fwide (__FILE *__fp, int __mode) __THROW;
      |                                           ^
/usr/include/wchar.h:732:22: error: '__FILE' was not declared in this scope; did you mean 'EMFILE'?
  732 | extern int fwprintf (__FILE *__restrict __stream,
      |                      ^~~~~~
      |                      EMFILE
/usr/include/wchar.h:732:30: error: expected primary-expression before '__restrict'
  732 | extern int fwprintf (__FILE *__restrict __stream,
      |                              ^~~~~~~~~~
/usr/include/wchar.h:733:22: error: expected primary-expression before 'const'
  733 |                      const wchar_t *__restrict __format, ...)
      |                      ^~~~~
/usr/include/wchar.h:733:58: error: expected primary-expression before '...' token
  733 |                      const wchar_t *__restrict __format, ...)
      |