Javinator9889

Day 11: AOC 2022 - generated from Cython

Dec 13th, 2022
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 310.94 KB | Source Code | 0 0
  1. /* Generated by Cython 0.29.32 */
  2.  
  3. /* BEGIN: Cython Metadata
  4. {
  5.     "distutils": {
  6.         "depends": [],
  7.         "language": "c++",
  8.         "name": "bfs",
  9.         "sources": [
  10.             "bfs.pyx"
  11.         ]
  12.     },
  13.     "module_name": "bfs"
  14. }
  15. END: Cython Metadata */
  16.  
  17. #ifndef PY_SSIZE_T_CLEAN
  18. #define PY_SSIZE_T_CLEAN
  19. #endif /* PY_SSIZE_T_CLEAN */
  20. #include "Python.h"
  21. #ifndef Py_PYTHON_H
  22.     #error Python headers needed to compile C extensions, please install development version of Python.
  23. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  24.     #error Cython requires Python 2.6+ or Python 3.3+.
  25. #else
  26. #define CYTHON_ABI "0_29_32"
  27. #define CYTHON_HEX_VERSION 0x001D20F0
  28. #define CYTHON_FUTURE_DIVISION 1
  29. #include <stddef.h>
  30. #ifndef offsetof
  31.   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  32. #endif
  33. #if !defined(WIN32) && !defined(MS_WINDOWS)
  34.   #ifndef __stdcall
  35.     #define __stdcall
  36.   #endif
  37.   #ifndef __cdecl
  38.     #define __cdecl
  39.   #endif
  40.   #ifndef __fastcall
  41.     #define __fastcall
  42.   #endif
  43. #endif
  44. #ifndef DL_IMPORT
  45.   #define DL_IMPORT(t) t
  46. #endif
  47. #ifndef DL_EXPORT
  48.   #define DL_EXPORT(t) t
  49. #endif
  50. #define __PYX_COMMA ,
  51. #ifndef HAVE_LONG_LONG
  52.   #if PY_VERSION_HEX >= 0x02070000
  53.     #define HAVE_LONG_LONG
  54.   #endif
  55. #endif
  56. #ifndef PY_LONG_LONG
  57.   #define PY_LONG_LONG LONG_LONG
  58. #endif
  59. #ifndef Py_HUGE_VAL
  60.   #define Py_HUGE_VAL HUGE_VAL
  61. #endif
  62. #ifdef PYPY_VERSION
  63.   #define CYTHON_COMPILING_IN_PYPY 1
  64.   #define CYTHON_COMPILING_IN_PYSTON 0
  65.   #define CYTHON_COMPILING_IN_CPYTHON 0
  66.   #define CYTHON_COMPILING_IN_NOGIL 0
  67.   #undef CYTHON_USE_TYPE_SLOTS
  68.   #define CYTHON_USE_TYPE_SLOTS 0
  69.   #undef CYTHON_USE_PYTYPE_LOOKUP
  70.   #define CYTHON_USE_PYTYPE_LOOKUP 0
  71.   #if PY_VERSION_HEX < 0x03050000
  72.     #undef CYTHON_USE_ASYNC_SLOTS
  73.     #define CYTHON_USE_ASYNC_SLOTS 0
  74.   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  75.     #define CYTHON_USE_ASYNC_SLOTS 1
  76.   #endif
  77.   #undef CYTHON_USE_PYLIST_INTERNALS
  78.   #define CYTHON_USE_PYLIST_INTERNALS 0
  79.   #undef CYTHON_USE_UNICODE_INTERNALS
  80.   #define CYTHON_USE_UNICODE_INTERNALS 0
  81.   #undef CYTHON_USE_UNICODE_WRITER
  82.   #define CYTHON_USE_UNICODE_WRITER 0
  83.   #undef CYTHON_USE_PYLONG_INTERNALS
  84.   #define CYTHON_USE_PYLONG_INTERNALS 0
  85.   #undef CYTHON_AVOID_BORROWED_REFS
  86.   #define CYTHON_AVOID_BORROWED_REFS 1
  87.   #undef CYTHON_ASSUME_SAFE_MACROS
  88.   #define CYTHON_ASSUME_SAFE_MACROS 0
  89.   #undef CYTHON_UNPACK_METHODS
  90.   #define CYTHON_UNPACK_METHODS 0
  91.   #undef CYTHON_FAST_THREAD_STATE
  92.   #define CYTHON_FAST_THREAD_STATE 0
  93.   #undef CYTHON_FAST_PYCALL
  94.   #define CYTHON_FAST_PYCALL 0
  95.   #undef CYTHON_PEP489_MULTI_PHASE_INIT
  96.   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  97.   #undef CYTHON_USE_TP_FINALIZE
  98.   #define CYTHON_USE_TP_FINALIZE 0
  99.   #undef CYTHON_USE_DICT_VERSIONS
  100.   #define CYTHON_USE_DICT_VERSIONS 0
  101.   #undef CYTHON_USE_EXC_INFO_STACK
  102.   #define CYTHON_USE_EXC_INFO_STACK 0
  103.   #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  104.     #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
  105.   #endif
  106. #elif defined(PYSTON_VERSION)
  107.   #define CYTHON_COMPILING_IN_PYPY 0
  108.   #define CYTHON_COMPILING_IN_PYSTON 1
  109.   #define CYTHON_COMPILING_IN_CPYTHON 0
  110.   #define CYTHON_COMPILING_IN_NOGIL 0
  111.   #ifndef CYTHON_USE_TYPE_SLOTS
  112.     #define CYTHON_USE_TYPE_SLOTS 1
  113.   #endif
  114.   #undef CYTHON_USE_PYTYPE_LOOKUP
  115.   #define CYTHON_USE_PYTYPE_LOOKUP 0
  116.   #undef CYTHON_USE_ASYNC_SLOTS
  117.   #define CYTHON_USE_ASYNC_SLOTS 0
  118.   #undef CYTHON_USE_PYLIST_INTERNALS
  119.   #define CYTHON_USE_PYLIST_INTERNALS 0
  120.   #ifndef CYTHON_USE_UNICODE_INTERNALS
  121.     #define CYTHON_USE_UNICODE_INTERNALS 1
  122.   #endif
  123.   #undef CYTHON_USE_UNICODE_WRITER
  124.   #define CYTHON_USE_UNICODE_WRITER 0
  125.   #undef CYTHON_USE_PYLONG_INTERNALS
  126.   #define CYTHON_USE_PYLONG_INTERNALS 0
  127.   #ifndef CYTHON_AVOID_BORROWED_REFS
  128.     #define CYTHON_AVOID_BORROWED_REFS 0
  129.   #endif
  130.   #ifndef CYTHON_ASSUME_SAFE_MACROS
  131.     #define CYTHON_ASSUME_SAFE_MACROS 1
  132.   #endif
  133.   #ifndef CYTHON_UNPACK_METHODS
  134.     #define CYTHON_UNPACK_METHODS 1
  135.   #endif
  136.   #undef CYTHON_FAST_THREAD_STATE
  137.   #define CYTHON_FAST_THREAD_STATE 0
  138.   #undef CYTHON_FAST_PYCALL
  139.   #define CYTHON_FAST_PYCALL 0
  140.   #undef CYTHON_PEP489_MULTI_PHASE_INIT
  141.   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  142.   #undef CYTHON_USE_TP_FINALIZE
  143.   #define CYTHON_USE_TP_FINALIZE 0
  144.   #undef CYTHON_USE_DICT_VERSIONS
  145.   #define CYTHON_USE_DICT_VERSIONS 0
  146.   #undef CYTHON_USE_EXC_INFO_STACK
  147.   #define CYTHON_USE_EXC_INFO_STACK 0
  148.   #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  149.     #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  150.   #endif
  151. #elif defined(PY_NOGIL)
  152.   #define CYTHON_COMPILING_IN_PYPY 0
  153.   #define CYTHON_COMPILING_IN_PYSTON 0
  154.   #define CYTHON_COMPILING_IN_CPYTHON 0
  155.   #define CYTHON_COMPILING_IN_NOGIL 1
  156.   #ifndef CYTHON_USE_TYPE_SLOTS
  157.     #define CYTHON_USE_TYPE_SLOTS 1
  158.   #endif
  159.   #undef CYTHON_USE_PYTYPE_LOOKUP
  160.   #define CYTHON_USE_PYTYPE_LOOKUP 0
  161.   #ifndef CYTHON_USE_ASYNC_SLOTS
  162.     #define CYTHON_USE_ASYNC_SLOTS 1
  163.   #endif
  164.   #undef CYTHON_USE_PYLIST_INTERNALS
  165.   #define CYTHON_USE_PYLIST_INTERNALS 0
  166.   #ifndef CYTHON_USE_UNICODE_INTERNALS
  167.     #define CYTHON_USE_UNICODE_INTERNALS 1
  168.   #endif
  169.   #undef CYTHON_USE_UNICODE_WRITER
  170.   #define CYTHON_USE_UNICODE_WRITER 0
  171.   #undef CYTHON_USE_PYLONG_INTERNALS
  172.   #define CYTHON_USE_PYLONG_INTERNALS 0
  173.   #ifndef CYTHON_AVOID_BORROWED_REFS
  174.     #define CYTHON_AVOID_BORROWED_REFS 0
  175.   #endif
  176.   #ifndef CYTHON_ASSUME_SAFE_MACROS
  177.     #define CYTHON_ASSUME_SAFE_MACROS 1
  178.   #endif
  179.   #ifndef CYTHON_UNPACK_METHODS
  180.     #define CYTHON_UNPACK_METHODS 1
  181.   #endif
  182.   #undef CYTHON_FAST_THREAD_STATE
  183.   #define CYTHON_FAST_THREAD_STATE 0
  184.   #undef CYTHON_FAST_PYCALL
  185.   #define CYTHON_FAST_PYCALL 0
  186.   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  187.     #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  188.   #endif
  189.   #ifndef CYTHON_USE_TP_FINALIZE
  190.     #define CYTHON_USE_TP_FINALIZE 1
  191.   #endif
  192.   #undef CYTHON_USE_DICT_VERSIONS
  193.   #define CYTHON_USE_DICT_VERSIONS 0
  194.   #undef CYTHON_USE_EXC_INFO_STACK
  195.   #define CYTHON_USE_EXC_INFO_STACK 0
  196. #else
  197.   #define CYTHON_COMPILING_IN_PYPY 0
  198.   #define CYTHON_COMPILING_IN_PYSTON 0
  199.   #define CYTHON_COMPILING_IN_CPYTHON 1
  200.   #define CYTHON_COMPILING_IN_NOGIL 0
  201.   #ifndef CYTHON_USE_TYPE_SLOTS
  202.     #define CYTHON_USE_TYPE_SLOTS 1
  203.   #endif
  204.   #if PY_VERSION_HEX < 0x02070000
  205.     #undef CYTHON_USE_PYTYPE_LOOKUP
  206.     #define CYTHON_USE_PYTYPE_LOOKUP 0
  207.   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  208.     #define CYTHON_USE_PYTYPE_LOOKUP 1
  209.   #endif
  210.   #if PY_MAJOR_VERSION < 3
  211.     #undef CYTHON_USE_ASYNC_SLOTS
  212.     #define CYTHON_USE_ASYNC_SLOTS 0
  213.   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  214.     #define CYTHON_USE_ASYNC_SLOTS 1
  215.   #endif
  216.   #if PY_VERSION_HEX < 0x02070000
  217.     #undef CYTHON_USE_PYLONG_INTERNALS
  218.     #define CYTHON_USE_PYLONG_INTERNALS 0
  219.   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  220.     #define CYTHON_USE_PYLONG_INTERNALS 1
  221.   #endif
  222.   #ifndef CYTHON_USE_PYLIST_INTERNALS
  223.     #define CYTHON_USE_PYLIST_INTERNALS 1
  224.   #endif
  225.   #ifndef CYTHON_USE_UNICODE_INTERNALS
  226.     #define CYTHON_USE_UNICODE_INTERNALS 1
  227.   #endif
  228.   #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
  229.     #undef CYTHON_USE_UNICODE_WRITER
  230.     #define CYTHON_USE_UNICODE_WRITER 0
  231.   #elif !defined(CYTHON_USE_UNICODE_WRITER)
  232.     #define CYTHON_USE_UNICODE_WRITER 1
  233.   #endif
  234.   #ifndef CYTHON_AVOID_BORROWED_REFS
  235.     #define CYTHON_AVOID_BORROWED_REFS 0
  236.   #endif
  237.   #ifndef CYTHON_ASSUME_SAFE_MACROS
  238.     #define CYTHON_ASSUME_SAFE_MACROS 1
  239.   #endif
  240.   #ifndef CYTHON_UNPACK_METHODS
  241.     #define CYTHON_UNPACK_METHODS 1
  242.   #endif
  243.   #if PY_VERSION_HEX >= 0x030B00A4
  244.     #undef CYTHON_FAST_THREAD_STATE
  245.     #define CYTHON_FAST_THREAD_STATE 0
  246.   #elif !defined(CYTHON_FAST_THREAD_STATE)
  247.     #define CYTHON_FAST_THREAD_STATE 1
  248.   #endif
  249.   #ifndef CYTHON_FAST_PYCALL
  250.     #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
  251.   #endif
  252.   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  253.     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  254.   #endif
  255.   #ifndef CYTHON_USE_TP_FINALIZE
  256.     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  257.   #endif
  258.   #ifndef CYTHON_USE_DICT_VERSIONS
  259.     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  260.   #endif
  261.   #if PY_VERSION_HEX >= 0x030B00A4
  262.     #undef CYTHON_USE_EXC_INFO_STACK
  263.     #define CYTHON_USE_EXC_INFO_STACK 0
  264.   #elif !defined(CYTHON_USE_EXC_INFO_STACK)
  265.     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  266.   #endif
  267.   #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  268.     #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  269.   #endif
  270. #endif
  271. #if !defined(CYTHON_FAST_PYCCALL)
  272. #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  273. #endif
  274. #if CYTHON_USE_PYLONG_INTERNALS
  275.   #if PY_MAJOR_VERSION < 3
  276.     #include "longintrepr.h"
  277.   #endif
  278.   #undef SHIFT
  279.   #undef BASE
  280.   #undef MASK
  281.   #ifdef SIZEOF_VOID_P
  282.     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  283.   #endif
  284. #endif
  285. #ifndef __has_attribute
  286.   #define __has_attribute(x) 0
  287. #endif
  288. #ifndef __has_cpp_attribute
  289.   #define __has_cpp_attribute(x) 0
  290. #endif
  291. #ifndef CYTHON_RESTRICT
  292.   #if defined(__GNUC__)
  293.     #define CYTHON_RESTRICT __restrict__
  294.   #elif defined(_MSC_VER) && _MSC_VER >= 1400
  295.     #define CYTHON_RESTRICT __restrict
  296.   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  297.     #define CYTHON_RESTRICT restrict
  298.   #else
  299.     #define CYTHON_RESTRICT
  300.   #endif
  301. #endif
  302. #ifndef CYTHON_UNUSED
  303. # if defined(__GNUC__)
  304. #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  305. #     define CYTHON_UNUSED __attribute__ ((__unused__))
  306. #   else
  307. #     define CYTHON_UNUSED
  308. #   endif
  309. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  310. #   define CYTHON_UNUSED __attribute__ ((__unused__))
  311. # else
  312. #   define CYTHON_UNUSED
  313. # endif
  314. #endif
  315. #ifndef CYTHON_MAYBE_UNUSED_VAR
  316. #  if defined(__cplusplus)
  317.      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  318. #  else
  319. #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  320. #  endif
  321. #endif
  322. #ifndef CYTHON_NCP_UNUSED
  323. # if CYTHON_COMPILING_IN_CPYTHON
  324. #  define CYTHON_NCP_UNUSED
  325. # else
  326. #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
  327. # endif
  328. #endif
  329. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  330. #ifdef _MSC_VER
  331.     #ifndef _MSC_STDINT_H_
  332.         #if _MSC_VER < 1300
  333.            typedef unsigned char     uint8_t;
  334.            typedef unsigned int      uint32_t;
  335.         #else
  336.            typedef unsigned __int8   uint8_t;
  337.            typedef unsigned __int32  uint32_t;
  338.         #endif
  339.     #endif
  340. #else
  341.    #include <stdint.h>
  342. #endif
  343. #ifndef CYTHON_FALLTHROUGH
  344.   #if defined(__cplusplus) && __cplusplus >= 201103L
  345.     #if __has_cpp_attribute(fallthrough)
  346.       #define CYTHON_FALLTHROUGH [[fallthrough]]
  347.     #elif __has_cpp_attribute(clang::fallthrough)
  348.       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  349.     #elif __has_cpp_attribute(gnu::fallthrough)
  350.       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  351.     #endif
  352.   #endif
  353.   #ifndef CYTHON_FALLTHROUGH
  354.     #if __has_attribute(fallthrough)
  355.       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  356.     #else
  357.       #define CYTHON_FALLTHROUGH
  358.     #endif
  359.   #endif
  360.   #if defined(__clang__ ) && defined(__apple_build_version__)
  361.     #if __apple_build_version__ < 7000000
  362.       #undef  CYTHON_FALLTHROUGH
  363.       #define CYTHON_FALLTHROUGH
  364.     #endif
  365.   #endif
  366. #endif
  367.  
  368. #ifndef __cplusplus
  369.   #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
  370. #endif
  371. #ifndef CYTHON_INLINE
  372.   #if defined(__clang__)
  373.     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  374.   #else
  375.     #define CYTHON_INLINE inline
  376.   #endif
  377. #endif
  378. template<typename T>
  379. void __Pyx_call_destructor(T& x) {
  380.     x.~T();
  381. }
  382. template<typename T>
  383. class __Pyx_FakeReference {
  384.   public:
  385.     __Pyx_FakeReference() : ptr(NULL) { }
  386.     __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
  387.     T *operator->() { return ptr; }
  388.     T *operator&() { return ptr; }
  389.     operator T&() { return *ptr; }
  390.     template<typename U> bool operator ==(U other) { return *ptr == other; }
  391.     template<typename U> bool operator !=(U other) { return *ptr != other; }
  392.   private:
  393.     T *ptr;
  394. };
  395.  
  396. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  397.   #define Py_OptimizeFlag 0
  398. #endif
  399. #define __PYX_BUILD_PY_SSIZE_T "n"
  400. #define CYTHON_FORMAT_SSIZE_T "z"
  401. #if PY_MAJOR_VERSION < 3
  402.   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  403.   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  404.           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  405.   #define __Pyx_DefaultClassType PyClass_Type
  406. #else
  407.   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  408.   #define __Pyx_DefaultClassType PyType_Type
  409. #if PY_VERSION_HEX >= 0x030B00A1
  410.     static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
  411.                                                     PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  412.                                                     PyObject *fv, PyObject *cell, PyObject* fn,
  413.                                                     PyObject *name, int fline, PyObject *lnos) {
  414.         PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
  415.         PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
  416.         const char *fn_cstr=NULL;
  417.         const char *name_cstr=NULL;
  418.         PyCodeObject* co=NULL;
  419.         PyObject *type, *value, *traceback;
  420.         PyErr_Fetch(&type, &value, &traceback);
  421.         if (!(kwds=PyDict_New())) goto end;
  422.         if (!(argcount=PyLong_FromLong(a))) goto end;
  423.         if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
  424.         if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
  425.         if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
  426.         if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
  427.         if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
  428.         if (!(nlocals=PyLong_FromLong(l))) goto end;
  429.         if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
  430.         if (!(stacksize=PyLong_FromLong(s))) goto end;
  431.         if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
  432.         if (!(flags=PyLong_FromLong(f))) goto end;
  433.         if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
  434.         if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
  435.         if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
  436.         if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
  437.         if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
  438.         if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
  439.         if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
  440.         if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
  441.         if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
  442.         if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
  443.         if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
  444.         if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
  445.         if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
  446.         if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
  447.         Py_XDECREF((PyObject*)co);
  448.         co = (PyCodeObject*)call_result;
  449.         call_result = NULL;
  450.         if (0) {
  451.             cleanup_code_too:
  452.             Py_XDECREF((PyObject*)co);
  453.             co = NULL;
  454.         }
  455.         end:
  456.         Py_XDECREF(kwds);
  457.         Py_XDECREF(argcount);
  458.         Py_XDECREF(posonlyargcount);
  459.         Py_XDECREF(kwonlyargcount);
  460.         Py_XDECREF(nlocals);
  461.         Py_XDECREF(stacksize);
  462.         Py_XDECREF(replace);
  463.         Py_XDECREF(call_result);
  464.         Py_XDECREF(empty);
  465.         if (type) {
  466.             PyErr_Restore(type, value, traceback);
  467.         }
  468.         return co;
  469.     }
  470. #else
  471.   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  472.           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  473. #endif
  474.   #define __Pyx_DefaultClassType PyType_Type
  475. #endif
  476. #ifndef Py_TPFLAGS_CHECKTYPES
  477.   #define Py_TPFLAGS_CHECKTYPES 0
  478. #endif
  479. #ifndef Py_TPFLAGS_HAVE_INDEX
  480.   #define Py_TPFLAGS_HAVE_INDEX 0
  481. #endif
  482. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  483.   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  484. #endif
  485. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  486.   #define Py_TPFLAGS_HAVE_FINALIZE 0
  487. #endif
  488. #ifndef METH_STACKLESS
  489.   #define METH_STACKLESS 0
  490. #endif
  491. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  492.   #ifndef METH_FASTCALL
  493.      #define METH_FASTCALL 0x80
  494.   #endif
  495.   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  496.   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  497.                                                           Py_ssize_t nargs, PyObject *kwnames);
  498. #else
  499.   #define __Pyx_PyCFunctionFast _PyCFunctionFast
  500.   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  501. #endif
  502. #if CYTHON_FAST_PYCCALL
  503. #define __Pyx_PyFastCFunction_Check(func)\
  504.     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
  505. #else
  506. #define __Pyx_PyFastCFunction_Check(func) 0
  507. #endif
  508. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  509.   #define PyObject_Malloc(s)   PyMem_Malloc(s)
  510.   #define PyObject_Free(p)     PyMem_Free(p)
  511.   #define PyObject_Realloc(p)  PyMem_Realloc(p)
  512. #endif
  513. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  514.   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  515.   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  516.   #define PyMem_RawFree(p)             PyMem_Free(p)
  517. #endif
  518. #if CYTHON_COMPILING_IN_PYSTON
  519.   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  520.   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  521. #else
  522.   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  523.   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
  524. #endif
  525. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  526.   #define __Pyx_PyThreadState_Current PyThreadState_GET()
  527. #elif PY_VERSION_HEX >= 0x03060000
  528.   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  529. #elif PY_VERSION_HEX >= 0x03000000
  530.   #define __Pyx_PyThreadState_Current PyThreadState_GET()
  531. #else
  532.   #define __Pyx_PyThreadState_Current _PyThreadState_Current
  533. #endif
  534. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  535. #include "pythread.h"
  536. #define Py_tss_NEEDS_INIT 0
  537. typedef int Py_tss_t;
  538. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  539.   *key = PyThread_create_key();
  540.   return 0;
  541. }
  542. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  543.   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  544.   *key = Py_tss_NEEDS_INIT;
  545.   return key;
  546. }
  547. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  548.   PyObject_Free(key);
  549. }
  550. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  551.   return *key != Py_tss_NEEDS_INIT;
  552. }
  553. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  554.   PyThread_delete_key(*key);
  555.   *key = Py_tss_NEEDS_INIT;
  556. }
  557. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  558.   return PyThread_set_key_value(*key, value);
  559. }
  560. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  561.   return PyThread_get_key_value(*key);
  562. }
  563. #endif
  564. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  565. #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  566. #else
  567. #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
  568. #endif
  569. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  570.   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  571.   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
  572. #else
  573.   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  574.   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
  575. #endif
  576. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  577. #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  578. #else
  579. #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
  580. #endif
  581. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  582.   #define CYTHON_PEP393_ENABLED 1
  583.   #if defined(PyUnicode_IS_READY)
  584.   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
  585.                                               0 : _PyUnicode_Ready((PyObject *)(op)))
  586.   #else
  587.   #define __Pyx_PyUnicode_READY(op)       (0)
  588.   #endif
  589.   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  590.   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  591.   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  592.   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  593.   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  594.   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  595.   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  596.   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  597.   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  598.   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  599.   #else
  600.   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  601.   #endif
  602.   #else
  603.   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  604.   #endif
  605. #else
  606.   #define CYTHON_PEP393_ENABLED 0
  607.   #define PyUnicode_1BYTE_KIND  1
  608.   #define PyUnicode_2BYTE_KIND  2
  609.   #define PyUnicode_4BYTE_KIND  4
  610.   #define __Pyx_PyUnicode_READY(op)       (0)
  611.   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  612.   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  613.   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  614.   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  615.   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  616.   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  617.   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  618.   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
  619. #endif
  620. #if CYTHON_COMPILING_IN_PYPY
  621.   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  622.   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
  623. #else
  624.   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  625.   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  626.       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  627. #endif
  628. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  629.   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  630. #endif
  631. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  632.   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
  633. #endif
  634. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  635.   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
  636. #endif
  637. #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  638. #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  639. #if PY_MAJOR_VERSION >= 3
  640.   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
  641. #else
  642.   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
  643. #endif
  644. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  645.   #define PyObject_ASCII(o)            PyObject_Repr(o)
  646. #endif
  647. #if PY_MAJOR_VERSION >= 3
  648.   #define PyBaseString_Type            PyUnicode_Type
  649.   #define PyStringObject               PyUnicodeObject
  650.   #define PyString_Type                PyUnicode_Type
  651.   #define PyString_Check               PyUnicode_Check
  652.   #define PyString_CheckExact          PyUnicode_CheckExact
  653. #ifndef PyObject_Unicode
  654.   #define PyObject_Unicode             PyObject_Str
  655. #endif
  656. #endif
  657. #if PY_MAJOR_VERSION >= 3
  658.   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  659.   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  660. #else
  661.   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  662.   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  663. #endif
  664. #ifndef PySet_CheckExact
  665.   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
  666. #endif
  667. #if PY_VERSION_HEX >= 0x030900A4
  668.   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  669.   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
  670. #else
  671.   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  672.   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
  673. #endif
  674. #if CYTHON_ASSUME_SAFE_MACROS
  675.   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
  676. #else
  677.   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
  678. #endif
  679. #if PY_MAJOR_VERSION >= 3
  680.   #define PyIntObject                  PyLongObject
  681.   #define PyInt_Type                   PyLong_Type
  682.   #define PyInt_Check(op)              PyLong_Check(op)
  683.   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  684.   #define PyInt_FromString             PyLong_FromString
  685.   #define PyInt_FromUnicode            PyLong_FromUnicode
  686.   #define PyInt_FromLong               PyLong_FromLong
  687.   #define PyInt_FromSize_t             PyLong_FromSize_t
  688.   #define PyInt_FromSsize_t            PyLong_FromSsize_t
  689.   #define PyInt_AsLong                 PyLong_AsLong
  690.   #define PyInt_AS_LONG                PyLong_AS_LONG
  691.   #define PyInt_AsSsize_t              PyLong_AsSsize_t
  692.   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  693.   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  694.   #define PyNumber_Int                 PyNumber_Long
  695. #endif
  696. #if PY_MAJOR_VERSION >= 3
  697.   #define PyBoolObject                 PyLongObject
  698. #endif
  699. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  700.   #ifndef PyUnicode_InternFromString
  701.     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  702.   #endif
  703. #endif
  704. #if PY_VERSION_HEX < 0x030200A4
  705.   typedef long Py_hash_t;
  706.   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  707.   #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
  708. #else
  709.   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  710.   #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
  711. #endif
  712. #if PY_MAJOR_VERSION >= 3
  713.   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
  714. #else
  715.   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  716. #endif
  717. #if CYTHON_USE_ASYNC_SLOTS
  718.   #if PY_VERSION_HEX >= 0x030500B1
  719.     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  720.     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  721.   #else
  722.     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  723.   #endif
  724. #else
  725.   #define __Pyx_PyType_AsAsync(obj) NULL
  726. #endif
  727. #ifndef __Pyx_PyAsyncMethodsStruct
  728.     typedef struct {
  729.         unaryfunc am_await;
  730.         unaryfunc am_aiter;
  731.         unaryfunc am_anext;
  732.     } __Pyx_PyAsyncMethodsStruct;
  733. #endif
  734.  
  735. #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  736.   #if !defined(_USE_MATH_DEFINES)
  737.     #define _USE_MATH_DEFINES
  738.   #endif
  739. #endif
  740. #include <math.h>
  741. #ifdef NAN
  742. #define __PYX_NAN() ((float) NAN)
  743. #else
  744. static CYTHON_INLINE float __PYX_NAN() {
  745.   float value;
  746.   memset(&value, 0xFF, sizeof(value));
  747.   return value;
  748. }
  749. #endif
  750. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  751. #define __Pyx_truncl trunc
  752. #else
  753. #define __Pyx_truncl truncl
  754. #endif
  755.  
  756. #define __PYX_MARK_ERR_POS(f_index, lineno) \
  757.     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
  758. #define __PYX_ERR(f_index, lineno, Ln_error) \
  759.     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
  760.  
  761. #ifndef __PYX_EXTERN_C
  762.   #ifdef __cplusplus
  763.     #define __PYX_EXTERN_C extern "C"
  764.   #else
  765.     #define __PYX_EXTERN_C extern
  766.   #endif
  767. #endif
  768.  
  769. #define __PYX_HAVE__bfs
  770. #define __PYX_HAVE_API__bfs
  771. /* Early includes */
  772. #include <string.h>
  773. #include <stdio.h>
  774. #include "numpy/arrayobject.h"
  775. #include "numpy/ndarrayobject.h"
  776. #include "numpy/ndarraytypes.h"
  777. #include "numpy/arrayscalars.h"
  778. #include "numpy/ufuncobject.h"
  779.  
  780.     /* NumPy API declarations from "numpy/__init__.pxd" */
  781.    
  782. #include "ios"
  783. #include "new"
  784. #include "stdexcept"
  785. #include "typeinfo"
  786. #include <utility>
  787.  
  788.     #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
  789.     // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
  790.     #include <type_traits>
  791.  
  792.     namespace cython_std {
  793.     template <typename T> typename std::remove_reference<T>::type&& move(T& t) noexcept { return std::move(t); }
  794.     template <typename T> typename std::remove_reference<T>::type&& move(T&& t) noexcept { return std::move(t); }
  795.     }
  796.  
  797.     #endif
  798.    
  799. #include <deque>
  800. #include <list>
  801. #ifdef _OPENMP
  802. #include <omp.h>
  803. #endif /* _OPENMP */
  804.  
  805. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  806. #define CYTHON_WITHOUT_ASSERTIONS
  807. #endif
  808.  
  809. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  810.                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  811.  
  812. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  813. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  814. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  815. #define __PYX_DEFAULT_STRING_ENCODING ""
  816. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  817. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  818. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  819. #define __Pyx_long_cast(x) ((long)x)
  820. #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
  821.     (sizeof(type) < sizeof(Py_ssize_t))  ||\
  822.     (sizeof(type) > sizeof(Py_ssize_t) &&\
  823.           likely(v < (type)PY_SSIZE_T_MAX ||\
  824.                  v == (type)PY_SSIZE_T_MAX)  &&\
  825.           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  826.                                 v == (type)PY_SSIZE_T_MIN)))  ||\
  827.     (sizeof(type) == sizeof(Py_ssize_t) &&\
  828.           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  829.                                v == (type)PY_SSIZE_T_MAX)))  )
  830. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  831.     return (size_t) i < (size_t) limit;
  832. }
  833. #if defined (__cplusplus) && __cplusplus >= 201103L
  834.     #include <cstdlib>
  835.     #define __Pyx_sst_abs(value) std::abs(value)
  836. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  837.     #define __Pyx_sst_abs(value) abs(value)
  838. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  839.     #define __Pyx_sst_abs(value) labs(value)
  840. #elif defined (_MSC_VER)
  841.     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  842. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  843.     #define __Pyx_sst_abs(value) llabs(value)
  844. #elif defined (__GNUC__)
  845.     #define __Pyx_sst_abs(value) __builtin_llabs(value)
  846. #else
  847.     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  848. #endif
  849. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  850. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  851. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  852. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  853. #define __Pyx_PyBytes_FromString        PyBytes_FromString
  854. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  855. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  856. #if PY_MAJOR_VERSION < 3
  857.     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
  858.     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  859. #else
  860.     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
  861.     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  862. #endif
  863. #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
  864. #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
  865. #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
  866. #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
  867. #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
  868. #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
  869. #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
  870. #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
  871. #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
  872. #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
  873. #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
  874. #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
  875. #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
  876. #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
  877. #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
  878. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  879. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  880.     const Py_UNICODE *u_end = u;
  881.     while (*u_end++) ;
  882.     return (size_t)(u_end - u - 1);
  883. }
  884. #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  885. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  886. #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
  887. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  888. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  889. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  890. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  891. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  892. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  893. #define __Pyx_PySequence_Tuple(obj)\
  894.     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  895. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  896. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  897. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  898. #if CYTHON_ASSUME_SAFE_MACROS
  899. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  900. #else
  901. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  902. #endif
  903. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  904. #if PY_MAJOR_VERSION >= 3
  905. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  906. #else
  907. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  908. #endif
  909. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  910. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  911. static int __Pyx_sys_getdefaultencoding_not_ascii;
  912. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  913.     PyObject* sys;
  914.     PyObject* default_encoding = NULL;
  915.     PyObject* ascii_chars_u = NULL;
  916.     PyObject* ascii_chars_b = NULL;
  917.     const char* default_encoding_c;
  918.     sys = PyImport_ImportModule("sys");
  919.     if (!sys) goto bad;
  920.     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  921.     Py_DECREF(sys);
  922.     if (!default_encoding) goto bad;
  923.     default_encoding_c = PyBytes_AsString(default_encoding);
  924.     if (!default_encoding_c) goto bad;
  925.     if (strcmp(default_encoding_c, "ascii") == 0) {
  926.         __Pyx_sys_getdefaultencoding_not_ascii = 0;
  927.     } else {
  928.         char ascii_chars[128];
  929.         int c;
  930.         for (c = 0; c < 128; c++) {
  931.             ascii_chars[c] = c;
  932.         }
  933.         __Pyx_sys_getdefaultencoding_not_ascii = 1;
  934.         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  935.         if (!ascii_chars_u) goto bad;
  936.         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  937.         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  938.             PyErr_Format(
  939.                 PyExc_ValueError,
  940.                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  941.                 default_encoding_c);
  942.             goto bad;
  943.         }
  944.         Py_DECREF(ascii_chars_u);
  945.         Py_DECREF(ascii_chars_b);
  946.     }
  947.     Py_DECREF(default_encoding);
  948.     return 0;
  949. bad:
  950.     Py_XDECREF(default_encoding);
  951.     Py_XDECREF(ascii_chars_u);
  952.     Py_XDECREF(ascii_chars_b);
  953.     return -1;
  954. }
  955. #endif
  956. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  957. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  958. #else
  959. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  960. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  961. static char* __PYX_DEFAULT_STRING_ENCODING;
  962. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  963.     PyObject* sys;
  964.     PyObject* default_encoding = NULL;
  965.     char* default_encoding_c;
  966.     sys = PyImport_ImportModule("sys");
  967.     if (!sys) goto bad;
  968.     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  969.     Py_DECREF(sys);
  970.     if (!default_encoding) goto bad;
  971.     default_encoding_c = PyBytes_AsString(default_encoding);
  972.     if (!default_encoding_c) goto bad;
  973.     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  974.     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  975.     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  976.     Py_DECREF(default_encoding);
  977.     return 0;
  978. bad:
  979.     Py_XDECREF(default_encoding);
  980.     return -1;
  981. }
  982. #endif
  983. #endif
  984.  
  985.  
  986. /* Test for GCC > 2.95 */
  987. #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  988.   #define likely(x)   __builtin_expect(!!(x), 1)
  989.   #define unlikely(x) __builtin_expect(!!(x), 0)
  990. #else /* !__GNUC__ or GCC < 2.95 */
  991.   #define likely(x)   (x)
  992.   #define unlikely(x) (x)
  993. #endif /* __GNUC__ */
  994. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  995.  
  996. static PyObject *__pyx_m = NULL;
  997. static PyObject *__pyx_d;
  998. static PyObject *__pyx_b;
  999. static PyObject *__pyx_cython_runtime = NULL;
  1000. static PyObject *__pyx_empty_tuple;
  1001. static PyObject *__pyx_empty_bytes;
  1002. static PyObject *__pyx_empty_unicode;
  1003. static int __pyx_lineno;
  1004. static int __pyx_clineno = 0;
  1005. static const char * __pyx_cfilenm= __FILE__;
  1006. static const char *__pyx_filename;
  1007.  
  1008. /* Header.proto */
  1009. #if !defined(CYTHON_CCOMPLEX)
  1010.   #if defined(__cplusplus)
  1011.     #define CYTHON_CCOMPLEX 1
  1012.   #elif defined(_Complex_I)
  1013.     #define CYTHON_CCOMPLEX 1
  1014.   #else
  1015.     #define CYTHON_CCOMPLEX 0
  1016.   #endif
  1017. #endif
  1018. #if CYTHON_CCOMPLEX
  1019.   #ifdef __cplusplus
  1020.     #include <complex>
  1021.   #else
  1022.     #include <complex.h>
  1023.   #endif
  1024. #endif
  1025. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  1026.   #undef _Complex_I
  1027.   #define _Complex_I 1.0fj
  1028. #endif
  1029.  
  1030.  
  1031. static const char *__pyx_f[] = {
  1032.   "bfs.pyx",
  1033.   "__init__.pxd",
  1034.   "stringsource",
  1035.   "type.pxd",
  1036. };
  1037.  
  1038. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":689
  1039.  * # in Cython to enable them only on the right systems.
  1040.  *
  1041.  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
  1042.  * ctypedef npy_int16      int16_t
  1043.  * ctypedef npy_int32      int32_t
  1044.  */
  1045. typedef npy_int8 __pyx_t_5numpy_int8_t;
  1046.  
  1047. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":690
  1048.  *
  1049.  * ctypedef npy_int8       int8_t
  1050.  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
  1051.  * ctypedef npy_int32      int32_t
  1052.  * ctypedef npy_int64      int64_t
  1053.  */
  1054. typedef npy_int16 __pyx_t_5numpy_int16_t;
  1055.  
  1056. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":691
  1057.  * ctypedef npy_int8       int8_t
  1058.  * ctypedef npy_int16      int16_t
  1059.  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
  1060.  * ctypedef npy_int64      int64_t
  1061.  * #ctypedef npy_int96      int96_t
  1062.  */
  1063. typedef npy_int32 __pyx_t_5numpy_int32_t;
  1064.  
  1065. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":692
  1066.  * ctypedef npy_int16      int16_t
  1067.  * ctypedef npy_int32      int32_t
  1068.  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
  1069.  * #ctypedef npy_int96      int96_t
  1070.  * #ctypedef npy_int128     int128_t
  1071.  */
  1072. typedef npy_int64 __pyx_t_5numpy_int64_t;
  1073.  
  1074. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":696
  1075.  * #ctypedef npy_int128     int128_t
  1076.  *
  1077.  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
  1078.  * ctypedef npy_uint16     uint16_t
  1079.  * ctypedef npy_uint32     uint32_t
  1080.  */
  1081. typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  1082.  
  1083. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":697
  1084.  *
  1085.  * ctypedef npy_uint8      uint8_t
  1086.  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
  1087.  * ctypedef npy_uint32     uint32_t
  1088.  * ctypedef npy_uint64     uint64_t
  1089.  */
  1090. typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  1091.  
  1092. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":698
  1093.  * ctypedef npy_uint8      uint8_t
  1094.  * ctypedef npy_uint16     uint16_t
  1095.  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
  1096.  * ctypedef npy_uint64     uint64_t
  1097.  * #ctypedef npy_uint96     uint96_t
  1098.  */
  1099. typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  1100.  
  1101. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":699
  1102.  * ctypedef npy_uint16     uint16_t
  1103.  * ctypedef npy_uint32     uint32_t
  1104.  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
  1105.  * #ctypedef npy_uint96     uint96_t
  1106.  * #ctypedef npy_uint128    uint128_t
  1107.  */
  1108. typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  1109.  
  1110. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":703
  1111.  * #ctypedef npy_uint128    uint128_t
  1112.  *
  1113.  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
  1114.  * ctypedef npy_float64    float64_t
  1115.  * #ctypedef npy_float80    float80_t
  1116.  */
  1117. typedef npy_float32 __pyx_t_5numpy_float32_t;
  1118.  
  1119. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":704
  1120.  *
  1121.  * ctypedef npy_float32    float32_t
  1122.  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
  1123.  * #ctypedef npy_float80    float80_t
  1124.  * #ctypedef npy_float128   float128_t
  1125.  */
  1126. typedef npy_float64 __pyx_t_5numpy_float64_t;
  1127.  
  1128. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":713
  1129.  * # The int types are mapped a bit surprising --
  1130.  * # numpy.int corresponds to 'l' and numpy.long to 'q'
  1131.  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
  1132.  * ctypedef npy_longlong   long_t
  1133.  * ctypedef npy_longlong   longlong_t
  1134.  */
  1135. typedef npy_long __pyx_t_5numpy_int_t;
  1136.  
  1137. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":714
  1138.  * # numpy.int corresponds to 'l' and numpy.long to 'q'
  1139.  * ctypedef npy_long       int_t
  1140.  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
  1141.  * ctypedef npy_longlong   longlong_t
  1142.  *
  1143.  */
  1144. typedef npy_longlong __pyx_t_5numpy_long_t;
  1145.  
  1146. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":715
  1147.  * ctypedef npy_long       int_t
  1148.  * ctypedef npy_longlong   long_t
  1149.  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
  1150.  *
  1151.  * ctypedef npy_ulong      uint_t
  1152.  */
  1153. typedef npy_longlong __pyx_t_5numpy_longlong_t;
  1154.  
  1155. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":717
  1156.  * ctypedef npy_longlong   longlong_t
  1157.  *
  1158.  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
  1159.  * ctypedef npy_ulonglong  ulong_t
  1160.  * ctypedef npy_ulonglong  ulonglong_t
  1161.  */
  1162. typedef npy_ulong __pyx_t_5numpy_uint_t;
  1163.  
  1164. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":718
  1165.  *
  1166.  * ctypedef npy_ulong      uint_t
  1167.  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
  1168.  * ctypedef npy_ulonglong  ulonglong_t
  1169.  *
  1170.  */
  1171. typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  1172.  
  1173. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":719
  1174.  * ctypedef npy_ulong      uint_t
  1175.  * ctypedef npy_ulonglong  ulong_t
  1176.  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
  1177.  *
  1178.  * ctypedef npy_intp       intp_t
  1179.  */
  1180. typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  1181.  
  1182. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":721
  1183.  * ctypedef npy_ulonglong  ulonglong_t
  1184.  *
  1185.  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
  1186.  * ctypedef npy_uintp      uintp_t
  1187.  *
  1188.  */
  1189. typedef npy_intp __pyx_t_5numpy_intp_t;
  1190.  
  1191. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":722
  1192.  *
  1193.  * ctypedef npy_intp       intp_t
  1194.  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
  1195.  *
  1196.  * ctypedef npy_double     float_t
  1197.  */
  1198. typedef npy_uintp __pyx_t_5numpy_uintp_t;
  1199.  
  1200. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":724
  1201.  * ctypedef npy_uintp      uintp_t
  1202.  *
  1203.  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
  1204.  * ctypedef npy_double     double_t
  1205.  * ctypedef npy_longdouble longdouble_t
  1206.  */
  1207. typedef npy_double __pyx_t_5numpy_float_t;
  1208.  
  1209. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":725
  1210.  *
  1211.  * ctypedef npy_double     float_t
  1212.  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
  1213.  * ctypedef npy_longdouble longdouble_t
  1214.  *
  1215.  */
  1216. typedef npy_double __pyx_t_5numpy_double_t;
  1217.  
  1218. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":726
  1219.  * ctypedef npy_double     float_t
  1220.  * ctypedef npy_double     double_t
  1221.  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
  1222.  *
  1223.  * ctypedef npy_cfloat      cfloat_t
  1224.  */
  1225. typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  1226.  
  1227. /* "bfs.pxd":23
  1228.  * # every type in the numpy module there's a corresponding compile-time
  1229.  * # type with a _t-suffix.
  1230.  * ctypedef np.int32_t DTYPE_t             # <<<<<<<<<<<<<<
  1231.  *
  1232.  * cpdef int bfs(np.ndarray view, pair[int, int] start, pair[int, int] end, bool is_part_2)
  1233.  */
  1234. typedef __pyx_t_5numpy_int32_t __pyx_t_3bfs_DTYPE_t;
  1235. /* Declarations.proto */
  1236. #if CYTHON_CCOMPLEX
  1237.   #ifdef __cplusplus
  1238.     typedef ::std::complex< float > __pyx_t_float_complex;
  1239.   #else
  1240.     typedef float _Complex __pyx_t_float_complex;
  1241.   #endif
  1242. #else
  1243.     typedef struct { float real, imag; } __pyx_t_float_complex;
  1244. #endif
  1245. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
  1246.  
  1247. /* Declarations.proto */
  1248. #if CYTHON_CCOMPLEX
  1249.   #ifdef __cplusplus
  1250.     typedef ::std::complex< double > __pyx_t_double_complex;
  1251.   #else
  1252.     typedef double _Complex __pyx_t_double_complex;
  1253.   #endif
  1254. #else
  1255.     typedef struct { double real, imag; } __pyx_t_double_complex;
  1256. #endif
  1257. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1258.  
  1259.  
  1260. /*--- Type declarations ---*/
  1261.  
  1262. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":728
  1263.  * ctypedef npy_longdouble longdouble_t
  1264.  *
  1265.  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
  1266.  * ctypedef npy_cdouble     cdouble_t
  1267.  * ctypedef npy_clongdouble clongdouble_t
  1268.  */
  1269. typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  1270.  
  1271. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":729
  1272.  *
  1273.  * ctypedef npy_cfloat      cfloat_t
  1274.  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
  1275.  * ctypedef npy_clongdouble clongdouble_t
  1276.  *
  1277.  */
  1278. typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  1279.  
  1280. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":730
  1281.  * ctypedef npy_cfloat      cfloat_t
  1282.  * ctypedef npy_cdouble     cdouble_t
  1283.  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
  1284.  *
  1285.  * ctypedef npy_cdouble     complex_t
  1286.  */
  1287. typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  1288.  
  1289. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":732
  1290.  * ctypedef npy_clongdouble clongdouble_t
  1291.  *
  1292.  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
  1293.  *
  1294.  * cdef inline object PyArray_MultiIterNew1(a):
  1295.  */
  1296. typedef npy_cdouble __pyx_t_5numpy_complex_t;
  1297.  
  1298. /* --- Runtime support code (head) --- */
  1299. /* Refnanny.proto */
  1300. #ifndef CYTHON_REFNANNY
  1301.   #define CYTHON_REFNANNY 0
  1302. #endif
  1303. #if CYTHON_REFNANNY
  1304.   typedef struct {
  1305.     void (*INCREF)(void*, PyObject*, int);
  1306.     void (*DECREF)(void*, PyObject*, int);
  1307.     void (*GOTREF)(void*, PyObject*, int);
  1308.     void (*GIVEREF)(void*, PyObject*, int);
  1309.     void* (*SetupContext)(const char*, int, const char*);
  1310.     void (*FinishContext)(void**);
  1311.   } __Pyx_RefNannyAPIStruct;
  1312.   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1313.   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1314.   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1315. #ifdef WITH_THREAD
  1316.   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1317.           if (acquire_gil) {\
  1318.               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1319.               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1320.               PyGILState_Release(__pyx_gilstate_save);\
  1321.           } else {\
  1322.               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1323.           }
  1324. #else
  1325.   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1326.           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  1327. #endif
  1328.   #define __Pyx_RefNannyFinishContext()\
  1329.           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1330.   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1331.   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1332.   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1333.   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1334.   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1335.   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1336.   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1337.   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1338. #else
  1339.   #define __Pyx_RefNannyDeclarations
  1340.   #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1341.   #define __Pyx_RefNannyFinishContext()
  1342.   #define __Pyx_INCREF(r) Py_INCREF(r)
  1343.   #define __Pyx_DECREF(r) Py_DECREF(r)
  1344.   #define __Pyx_GOTREF(r)
  1345.   #define __Pyx_GIVEREF(r)
  1346.   #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1347.   #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1348.   #define __Pyx_XGOTREF(r)
  1349.   #define __Pyx_XGIVEREF(r)
  1350. #endif
  1351. #define __Pyx_XDECREF_SET(r, v) do {\
  1352.         PyObject *tmp = (PyObject *) r;\
  1353.         r = v; __Pyx_XDECREF(tmp);\
  1354.     } while (0)
  1355. #define __Pyx_DECREF_SET(r, v) do {\
  1356.         PyObject *tmp = (PyObject *) r;\
  1357.         r = v; __Pyx_DECREF(tmp);\
  1358.     } while (0)
  1359. #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1360. #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1361.  
  1362. /* PyObjectGetAttrStr.proto */
  1363. #if CYTHON_USE_TYPE_SLOTS
  1364. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1365. #else
  1366. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1367. #endif
  1368.  
  1369. /* GetBuiltinName.proto */
  1370. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1371.  
  1372. /* PyDictVersioning.proto */
  1373. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1374. #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
  1375. #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
  1376. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1377.     (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1378.     (cache_var) = (value);
  1379. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1380.     static PY_UINT64_T __pyx_dict_version = 0;\
  1381.     static PyObject *__pyx_dict_cached_value = NULL;\
  1382.     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1383.         (VAR) = __pyx_dict_cached_value;\
  1384.     } else {\
  1385.         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1386.         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1387.     }\
  1388. }
  1389. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1390. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1391. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1392. #else
  1393. #define __PYX_GET_DICT_VERSION(dict)  (0)
  1394. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1395. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
  1396. #endif
  1397.  
  1398. /* GetModuleGlobalName.proto */
  1399. #if CYTHON_USE_DICT_VERSIONS
  1400. #define __Pyx_GetModuleGlobalName(var, name)  {\
  1401.     static PY_UINT64_T __pyx_dict_version = 0;\
  1402.     static PyObject *__pyx_dict_cached_value = NULL;\
  1403.     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1404.         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1405.         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1406. }
  1407. #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
  1408.     PY_UINT64_T __pyx_dict_version;\
  1409.     PyObject *__pyx_dict_cached_value;\
  1410.     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1411. }
  1412. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1413. #else
  1414. #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
  1415. #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
  1416. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1417. #endif
  1418.  
  1419. /* PyObjectCall.proto */
  1420. #if CYTHON_COMPILING_IN_CPYTHON
  1421. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1422. #else
  1423. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1424. #endif
  1425.  
  1426. /* ExtTypeTest.proto */
  1427. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1428.  
  1429. /* GetItemInt.proto */
  1430. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1431.     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1432.     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1433.     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1434.                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1435. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1436.     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1437.     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1438.     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1439. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1440.                                                               int wraparound, int boundscheck);
  1441. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1442.     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1443.     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1444.     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1445. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1446.                                                               int wraparound, int boundscheck);
  1447. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1448. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1449.                                                      int is_list, int wraparound, int boundscheck);
  1450.  
  1451. /* ObjectGetItem.proto */
  1452. #if CYTHON_USE_TYPE_SLOTS
  1453. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
  1454. #else
  1455. #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
  1456. #endif
  1457.  
  1458. /* PyIntBinop.proto */
  1459. #if !CYTHON_COMPILING_IN_PYPY
  1460. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1461. #else
  1462. #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  1463.     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  1464. #endif
  1465.  
  1466. /* PyThreadStateGet.proto */
  1467. #if CYTHON_FAST_THREAD_STATE
  1468. #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
  1469. #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
  1470. #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
  1471. #else
  1472. #define __Pyx_PyThreadState_declare
  1473. #define __Pyx_PyThreadState_assign
  1474. #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
  1475. #endif
  1476.  
  1477. /* PyErrFetchRestore.proto */
  1478. #if CYTHON_FAST_THREAD_STATE
  1479. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1480. #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1481. #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1482. #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1483. #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1484. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1485. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1486. #if CYTHON_COMPILING_IN_CPYTHON
  1487. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1488. #else
  1489. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1490. #endif
  1491. #else
  1492. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1493. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1494. #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
  1495. #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
  1496. #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
  1497. #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
  1498. #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
  1499. #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
  1500. #endif
  1501.  
  1502. /* WriteUnraisableException.proto */
  1503. static void __Pyx_WriteUnraisable(const char *name, int clineno,
  1504.                                   int lineno, const char *filename,
  1505.                                   int full_traceback, int nogil);
  1506.  
  1507. /* RaiseArgTupleInvalid.proto */
  1508. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1509.     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1510.  
  1511. /* RaiseDoubleKeywords.proto */
  1512. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1513.  
  1514. /* ParseKeywords.proto */
  1515. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1516.     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1517.     const char* function_name);
  1518.  
  1519. /* ArgTypeTest.proto */
  1520. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1521.     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1522.         __Pyx__ArgTypeTest(obj, type, name, exact))
  1523. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1524.  
  1525. /* PyIntBinop.proto */
  1526. #if !CYTHON_COMPILING_IN_PYPY
  1527. static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1528. #else
  1529. #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
  1530.     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  1531. #endif
  1532.  
  1533. /* GetTopmostException.proto */
  1534. #if CYTHON_USE_EXC_INFO_STACK
  1535. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  1536. #endif
  1537.  
  1538. /* SaveResetException.proto */
  1539. #if CYTHON_FAST_THREAD_STATE
  1540. #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1541. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1542. #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1543. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1544. #else
  1545. #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
  1546. #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
  1547. #endif
  1548.  
  1549. /* PyErrExceptionMatches.proto */
  1550. #if CYTHON_FAST_THREAD_STATE
  1551. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1552. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1553. #else
  1554. #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
  1555. #endif
  1556.  
  1557. /* GetException.proto */
  1558. #if CYTHON_FAST_THREAD_STATE
  1559. #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
  1560. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1561. #else
  1562. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1563. #endif
  1564.  
  1565. /* RaiseException.proto */
  1566. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1567.  
  1568. /* RaiseTooManyValuesToUnpack.proto */
  1569. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1570.  
  1571. /* RaiseNeedMoreValuesToUnpack.proto */
  1572. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1573.  
  1574. /* IterFinish.proto */
  1575. static CYTHON_INLINE int __Pyx_IterFinish(void);
  1576.  
  1577. /* UnpackItemEndCheck.proto */
  1578. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  1579.  
  1580. /* TypeImport.proto */
  1581. #ifndef __PYX_HAVE_RT_ImportType_proto
  1582. #define __PYX_HAVE_RT_ImportType_proto
  1583. enum __Pyx_ImportType_CheckSize {
  1584.    __Pyx_ImportType_CheckSize_Error = 0,
  1585.    __Pyx_ImportType_CheckSize_Warn = 1,
  1586.    __Pyx_ImportType_CheckSize_Ignore = 2
  1587. };
  1588. static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
  1589. #endif
  1590.  
  1591. /* Import.proto */
  1592. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1593.  
  1594. /* CLineInTraceback.proto */
  1595. #ifdef CYTHON_CLINE_IN_TRACEBACK
  1596. #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  1597. #else
  1598. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  1599. #endif
  1600.  
  1601. /* CodeObjectCache.proto */
  1602. typedef struct {
  1603.     PyCodeObject* code_object;
  1604.     int code_line;
  1605. } __Pyx_CodeObjectCacheEntry;
  1606. struct __Pyx_CodeObjectCache {
  1607.     int count;
  1608.     int max_count;
  1609.     __Pyx_CodeObjectCacheEntry* entries;
  1610. };
  1611. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1612. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1613. static PyCodeObject *__pyx_find_code_object(int code_line);
  1614. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1615.  
  1616. /* AddTraceback.proto */
  1617. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1618.                                int py_line, const char *filename);
  1619.  
  1620. /* GCCDiagnostics.proto */
  1621. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  1622. #define __Pyx_HAS_GCC_DIAGNOSTIC
  1623. #endif
  1624.  
  1625. /* RealImag.proto */
  1626. #if CYTHON_CCOMPLEX
  1627.   #ifdef __cplusplus
  1628.     #define __Pyx_CREAL(z) ((z).real())
  1629.     #define __Pyx_CIMAG(z) ((z).imag())
  1630.   #else
  1631.     #define __Pyx_CREAL(z) (__real__(z))
  1632.     #define __Pyx_CIMAG(z) (__imag__(z))
  1633.   #endif
  1634. #else
  1635.     #define __Pyx_CREAL(z) ((z).real)
  1636.     #define __Pyx_CIMAG(z) ((z).imag)
  1637. #endif
  1638. #if defined(__cplusplus) && CYTHON_CCOMPLEX\
  1639.         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
  1640.     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  1641.     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  1642. #else
  1643.     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  1644.     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  1645. #endif
  1646.  
  1647. /* Arithmetic.proto */
  1648. #if CYTHON_CCOMPLEX
  1649.     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
  1650.     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
  1651.     #define __Pyx_c_diff_float(a, b) ((a)-(b))
  1652.     #define __Pyx_c_prod_float(a, b) ((a)*(b))
  1653.     #define __Pyx_c_quot_float(a, b) ((a)/(b))
  1654.     #define __Pyx_c_neg_float(a)     (-(a))
  1655.   #ifdef __cplusplus
  1656.     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
  1657.     #define __Pyx_c_conj_float(z)    (::std::conj(z))
  1658.     #if 1
  1659.         #define __Pyx_c_abs_float(z)     (::std::abs(z))
  1660.         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
  1661.     #endif
  1662.   #else
  1663.     #define __Pyx_c_is_zero_float(z) ((z)==0)
  1664.     #define __Pyx_c_conj_float(z)    (conjf(z))
  1665.     #if 1
  1666.         #define __Pyx_c_abs_float(z)     (cabsf(z))
  1667.         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
  1668.     #endif
  1669.  #endif
  1670. #else
  1671.     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1672.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1673.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1674.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1675.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1676.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
  1677.     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
  1678.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
  1679.     #if 1
  1680.         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
  1681.         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1682.     #endif
  1683. #endif
  1684.  
  1685. /* Arithmetic.proto */
  1686. #if CYTHON_CCOMPLEX
  1687.     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
  1688.     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
  1689.     #define __Pyx_c_diff_double(a, b) ((a)-(b))
  1690.     #define __Pyx_c_prod_double(a, b) ((a)*(b))
  1691.     #define __Pyx_c_quot_double(a, b) ((a)/(b))
  1692.     #define __Pyx_c_neg_double(a)     (-(a))
  1693.   #ifdef __cplusplus
  1694.     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
  1695.     #define __Pyx_c_conj_double(z)    (::std::conj(z))
  1696.     #if 1
  1697.         #define __Pyx_c_abs_double(z)     (::std::abs(z))
  1698.         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
  1699.     #endif
  1700.   #else
  1701.     #define __Pyx_c_is_zero_double(z) ((z)==0)
  1702.     #define __Pyx_c_conj_double(z)    (conj(z))
  1703.     #if 1
  1704.         #define __Pyx_c_abs_double(z)     (cabs(z))
  1705.         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
  1706.     #endif
  1707.  #endif
  1708. #else
  1709.     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1710.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1711.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1712.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1713.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1714.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
  1715.     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
  1716.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
  1717.     #if 1
  1718.         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
  1719.         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1720.     #endif
  1721. #endif
  1722.  
  1723. /* CIntFromPy.proto */
  1724. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1725.  
  1726. /* CIntToPy.proto */
  1727. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
  1728.  
  1729. /* CIntToPy.proto */
  1730. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1731.  
  1732. /* CIntToPy.proto */
  1733. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value);
  1734.  
  1735. /* CIntToPy.proto */
  1736. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1737.  
  1738. /* CIntFromPy.proto */
  1739. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1740.  
  1741. /* FastTypeChecks.proto */
  1742. #if CYTHON_COMPILING_IN_CPYTHON
  1743. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1744. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1745. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1746. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1747. #else
  1748. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1749. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1750. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1751. #endif
  1752. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1753.  
  1754. /* CheckBinaryVersion.proto */
  1755. static int __Pyx_check_binary_version(void);
  1756.  
  1757. /* FunctionExport.proto */
  1758. static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
  1759.  
  1760. /* InitStrings.proto */
  1761. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1762.  
  1763.  
  1764. /* Module declarations from 'cython' */
  1765.  
  1766. /* Module declarations from 'cpython.buffer' */
  1767.  
  1768. /* Module declarations from 'libc.string' */
  1769.  
  1770. /* Module declarations from 'libc.stdio' */
  1771.  
  1772. /* Module declarations from '__builtin__' */
  1773.  
  1774. /* Module declarations from 'cpython.type' */
  1775. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1776.  
  1777. /* Module declarations from 'cpython' */
  1778.  
  1779. /* Module declarations from 'cpython.object' */
  1780.  
  1781. /* Module declarations from 'cpython.ref' */
  1782.  
  1783. /* Module declarations from 'cpython.mem' */
  1784.  
  1785. /* Module declarations from 'numpy' */
  1786.  
  1787. /* Module declarations from 'numpy' */
  1788. static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
  1789. static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
  1790. static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
  1791. static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
  1792. static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
  1793. static PyTypeObject *__pyx_ptype_5numpy_number = 0;
  1794. static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
  1795. static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
  1796. static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
  1797. static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
  1798. static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
  1799. static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
  1800. static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
  1801. static PyTypeObject *__pyx_ptype_5numpy_character = 0;
  1802. static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
  1803. static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/
  1804.  
  1805. /* Module declarations from 'libcpp.utility' */
  1806.  
  1807. /* Module declarations from 'libcpp.pair' */
  1808.  
  1809. /* Module declarations from 'libcpp' */
  1810.  
  1811. /* Module declarations from 'libcpp.deque' */
  1812.  
  1813. /* Module declarations from 'libcpp.list' */
  1814.  
  1815. /* Module declarations from 'bfs' */
  1816. static int __pyx_f_3bfs_bfs(PyArrayObject *, std::pair<int,int> , std::pair<int,int> , bool, int __pyx_skip_dispatch); /*proto*/
  1817. static int __pyx_f_3bfs_bfs_2(PyArrayObject *, std::pair<int,int> , int __pyx_skip_dispatch); /*proto*/
  1818. static std::pair<int,int>  __pyx_convert_pair_from_py_int__and_int(PyObject *); /*proto*/
  1819. static std::list<std::pair<int,int> >  __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(PyObject *); /*proto*/
  1820. #define __Pyx_MODULE_NAME "bfs"
  1821. extern int __pyx_module_is_main_bfs;
  1822. int __pyx_module_is_main_bfs = 0;
  1823.  
  1824. /* Implementation of 'bfs' */
  1825. static PyObject *__pyx_builtin_ImportError;
  1826. static const char __pyx_k_np[] = "np";
  1827. static const char __pyx_k_end[] = "end";
  1828. static const char __pyx_k_bool[] = "bool_";
  1829. static const char __pyx_k_main[] = "__main__";
  1830. static const char __pyx_k_name[] = "__name__";
  1831. static const char __pyx_k_test[] = "__test__";
  1832. static const char __pyx_k_view[] = "view";
  1833. static const char __pyx_k_dtype[] = "dtype";
  1834. static const char __pyx_k_numpy[] = "numpy";
  1835. static const char __pyx_k_start[] = "start";
  1836. static const char __pyx_k_zeros[] = "zeros";
  1837. static const char __pyx_k_import[] = "__import__";
  1838. static const char __pyx_k_uint32[] = "uint32";
  1839. static const char __pyx_k_is_part_2[] = "is_part_2";
  1840. static const char __pyx_k_ImportError[] = "ImportError";
  1841. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  1842. static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
  1843. static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
  1844. static PyObject *__pyx_n_s_ImportError;
  1845. static PyObject *__pyx_n_s_bool;
  1846. static PyObject *__pyx_n_s_cline_in_traceback;
  1847. static PyObject *__pyx_n_s_dtype;
  1848. static PyObject *__pyx_n_s_end;
  1849. static PyObject *__pyx_n_s_import;
  1850. static PyObject *__pyx_n_s_is_part_2;
  1851. static PyObject *__pyx_n_s_main;
  1852. static PyObject *__pyx_n_s_name;
  1853. static PyObject *__pyx_n_s_np;
  1854. static PyObject *__pyx_n_s_numpy;
  1855. static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
  1856. static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
  1857. static PyObject *__pyx_n_s_start;
  1858. static PyObject *__pyx_n_s_test;
  1859. static PyObject *__pyx_n_s_uint32;
  1860. static PyObject *__pyx_n_s_view;
  1861. static PyObject *__pyx_n_s_zeros;
  1862. static PyObject *__pyx_pf_3bfs_bfs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_view, std::pair<int,int>  __pyx_v_start, std::pair<int,int>  __pyx_v_end, bool __pyx_v_is_part_2); /* proto */
  1863. static PyObject *__pyx_pf_3bfs_2bfs_2(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_view, std::pair<int,int>  __pyx_v_start); /* proto */
  1864. static PyObject *__pyx_int_0;
  1865. static PyObject *__pyx_int_1;
  1866. static PyObject *__pyx_int_neg_1;
  1867. static PyObject *__pyx_tuple_;
  1868. static PyObject *__pyx_tuple__2;
  1869. static PyObject *__pyx_tuple__3;
  1870. static PyObject *__pyx_tuple__4;
  1871. static PyObject *__pyx_tuple__5;
  1872. static PyObject *__pyx_tuple__6;
  1873. /* Late includes */
  1874.  
  1875. /* "bfs.pyx":12
  1876.  *
  1877.  *
  1878.  * cpdef int bfs(np.ndarray view, pair[int, int] start, pair[int, int] end, bool is_part_2):             # <<<<<<<<<<<<<<
  1879.  *     cdef deque[pair[int, int]] open_list
  1880.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  1881.  */
  1882.  
  1883. static PyObject *__pyx_pw_3bfs_1bfs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1884. static int __pyx_f_3bfs_bfs(PyArrayObject *__pyx_v_view, std::pair<int,int>  __pyx_v_start, std::pair<int,int>  __pyx_v_end, bool __pyx_v_is_part_2, CYTHON_UNUSED int __pyx_skip_dispatch) {
  1885.   std::deque<std::pair<int,int> >  __pyx_v_open_list;
  1886.   PyArrayObject *__pyx_v_visited = 0;
  1887.   PyArrayObject *__pyx_v_cost = 0;
  1888.   std::list<std::pair<int,int> >  __pyx_v_positions;
  1889.   std::pair<int,int>  __pyx_v_node;
  1890.   std::pair<int,int>  __pyx_v_xy;
  1891.   __pyx_t_3bfs_DTYPE_t __pyx_v_a;
  1892.   std::pair<int,int>  __pyx_v_position;
  1893.   int __pyx_r;
  1894.   __Pyx_RefNannyDeclarations
  1895.   PyObject *__pyx_t_1 = NULL;
  1896.   PyObject *__pyx_t_2 = NULL;
  1897.   PyObject *__pyx_t_3 = NULL;
  1898.   PyObject *__pyx_t_4 = NULL;
  1899.   PyObject *__pyx_t_5 = NULL;
  1900.   std::list<std::pair<int,int> >  __pyx_t_6;
  1901.   int __pyx_t_7;
  1902.   int __pyx_t_8;
  1903.   int __pyx_t_9;
  1904.   std::list<std::pair<int,int> > ::iterator __pyx_t_10;
  1905.   std::pair<int,int>  __pyx_t_11;
  1906.   int __pyx_t_12;
  1907.   int __pyx_lineno = 0;
  1908.   const char *__pyx_filename = NULL;
  1909.   int __pyx_clineno = 0;
  1910.   __Pyx_RefNannySetupContext("bfs", 0);
  1911.  
  1912.   /* "bfs.pyx":14
  1913.  * cpdef int bfs(np.ndarray view, pair[int, int] start, pair[int, int] end, bool is_part_2):
  1914.  *     cdef deque[pair[int, int]] open_list
  1915.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)             # <<<<<<<<<<<<<<
  1916.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)
  1917.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
  1918.  */
  1919.   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  1920.   __Pyx_GOTREF(__pyx_t_1);
  1921.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  1922.   __Pyx_GOTREF(__pyx_t_2);
  1923.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1924.   __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  1925.   __Pyx_GOTREF(__pyx_t_1);
  1926.   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)
  1927.   __Pyx_GOTREF(__pyx_t_3);
  1928.   __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 14, __pyx_L1_error)
  1929.   __Pyx_GOTREF(__pyx_t_4);
  1930.   __Pyx_GIVEREF(__pyx_t_1);
  1931.   PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  1932.   __Pyx_GIVEREF(__pyx_t_3);
  1933.   PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  1934.   __pyx_t_1 = 0;
  1935.   __pyx_t_3 = 0;
  1936.   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)
  1937.   __Pyx_GOTREF(__pyx_t_3);
  1938.   __Pyx_GIVEREF(__pyx_t_4);
  1939.   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  1940.   __pyx_t_4 = 0;
  1941.   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 14, __pyx_L1_error)
  1942.   __Pyx_GOTREF(__pyx_t_4);
  1943.   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  1944.   __Pyx_GOTREF(__pyx_t_1);
  1945.   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bool); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 14, __pyx_L1_error)
  1946.   __Pyx_GOTREF(__pyx_t_5);
  1947.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1948.   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  1949.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1950.   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 14, __pyx_L1_error)
  1951.   __Pyx_GOTREF(__pyx_t_5);
  1952.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1953.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1954.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1955.   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 14, __pyx_L1_error)
  1956.   __pyx_v_visited = ((PyArrayObject *)__pyx_t_5);
  1957.   __pyx_t_5 = 0;
  1958.  
  1959.   /* "bfs.pyx":15
  1960.  *     cdef deque[pair[int, int]] open_list
  1961.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  1962.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)             # <<<<<<<<<<<<<<
  1963.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
  1964.  *     cdef pair[int, int] node
  1965.  */
  1966.   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
  1967.   __Pyx_GOTREF(__pyx_t_5);
  1968.   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
  1969.   __Pyx_GOTREF(__pyx_t_4);
  1970.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1971.   __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
  1972.   __Pyx_GOTREF(__pyx_t_5);
  1973.   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
  1974.   __Pyx_GOTREF(__pyx_t_3);
  1975.   __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  1976.   __Pyx_GOTREF(__pyx_t_2);
  1977.   __Pyx_GIVEREF(__pyx_t_5);
  1978.   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  1979.   __Pyx_GIVEREF(__pyx_t_3);
  1980.   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  1981.   __pyx_t_5 = 0;
  1982.   __pyx_t_3 = 0;
  1983.   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
  1984.   __Pyx_GOTREF(__pyx_t_3);
  1985.   __Pyx_GIVEREF(__pyx_t_2);
  1986.   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  1987.   __pyx_t_2 = 0;
  1988.   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  1989.   __Pyx_GOTREF(__pyx_t_2);
  1990.   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
  1991.   __Pyx_GOTREF(__pyx_t_5);
  1992.   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  1993.   __Pyx_GOTREF(__pyx_t_1);
  1994.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1995.   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  1996.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1997.   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  1998.   __Pyx_GOTREF(__pyx_t_1);
  1999.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2000.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2001.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2002.   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 15, __pyx_L1_error)
  2003.   __pyx_v_cost = ((PyArrayObject *)__pyx_t_1);
  2004.   __pyx_t_1 = 0;
  2005.  
  2006.   /* "bfs.pyx":16
  2007.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  2008.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)
  2009.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]             # <<<<<<<<<<<<<<
  2010.  *     cdef pair[int, int] node
  2011.  *     cdef pair[int, int] xy
  2012.  */
  2013.   __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  2014.   __Pyx_GOTREF(__pyx_t_1);
  2015.   __Pyx_INCREF(__pyx_tuple_);
  2016.   __Pyx_GIVEREF(__pyx_tuple_);
  2017.   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_tuple_);
  2018.   __Pyx_INCREF(__pyx_tuple__2);
  2019.   __Pyx_GIVEREF(__pyx_tuple__2);
  2020.   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_tuple__2);
  2021.   __Pyx_INCREF(__pyx_tuple__3);
  2022.   __Pyx_GIVEREF(__pyx_tuple__3);
  2023.   PyList_SET_ITEM(__pyx_t_1, 2, __pyx_tuple__3);
  2024.   __Pyx_INCREF(__pyx_tuple__4);
  2025.   __Pyx_GIVEREF(__pyx_tuple__4);
  2026.   PyList_SET_ITEM(__pyx_t_1, 3, __pyx_tuple__4);
  2027.   __pyx_t_6 = __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L1_error)
  2028.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2029.   __pyx_v_positions = __pyx_t_6;
  2030.  
  2031.   /* "bfs.pyx":19
  2032.  *     cdef pair[int, int] node
  2033.  *     cdef pair[int, int] xy
  2034.  *     cdef DTYPE_t a = ord("a")             # <<<<<<<<<<<<<<
  2035.  *
  2036.  *     open_list.push_back(start)
  2037.  */
  2038.   __pyx_v_a = 97;
  2039.  
  2040.   /* "bfs.pyx":21
  2041.  *     cdef DTYPE_t a = ord("a")
  2042.  *
  2043.  *     open_list.push_back(start)             # <<<<<<<<<<<<<<
  2044.  *     visited[start.first, start.second] = True
  2045.  *
  2046.  */
  2047.   __pyx_v_open_list.push_back(__pyx_v_start);
  2048.  
  2049.   /* "bfs.pyx":22
  2050.  *
  2051.  *     open_list.push_back(start)
  2052.  *     visited[start.first, start.second] = True             # <<<<<<<<<<<<<<
  2053.  *
  2054.  *     while open_list.size() > 0:
  2055.  */
  2056.   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  2057.   __Pyx_GOTREF(__pyx_t_1);
  2058.   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_start.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
  2059.   __Pyx_GOTREF(__pyx_t_2);
  2060.   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
  2061.   __Pyx_GOTREF(__pyx_t_3);
  2062.   __Pyx_GIVEREF(__pyx_t_1);
  2063.   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2064.   __Pyx_GIVEREF(__pyx_t_2);
  2065.   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  2066.   __pyx_t_1 = 0;
  2067.   __pyx_t_2 = 0;
  2068.   if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_visited), __pyx_t_3, Py_True) < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
  2069.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2070.  
  2071.   /* "bfs.pyx":24
  2072.  *     visited[start.first, start.second] = True
  2073.  *
  2074.  *     while open_list.size() > 0:             # <<<<<<<<<<<<<<
  2075.  *         node = open_list.front()
  2076.  *         if (is_part_2 and view[node.first, node.second] == a) or node == end:
  2077.  */
  2078.   while (1) {
  2079.     __pyx_t_7 = ((__pyx_v_open_list.size() > 0) != 0);
  2080.     if (!__pyx_t_7) break;
  2081.  
  2082.     /* "bfs.pyx":25
  2083.  *
  2084.  *     while open_list.size() > 0:
  2085.  *         node = open_list.front()             # <<<<<<<<<<<<<<
  2086.  *         if (is_part_2 and view[node.first, node.second] == a) or node == end:
  2087.  *             return cost[node.first, node.second]
  2088.  */
  2089.     __pyx_v_node = __pyx_v_open_list.front();
  2090.  
  2091.     /* "bfs.pyx":26
  2092.  *     while open_list.size() > 0:
  2093.  *         node = open_list.front()
  2094.  *         if (is_part_2 and view[node.first, node.second] == a) or node == end:             # <<<<<<<<<<<<<<
  2095.  *             return cost[node.first, node.second]
  2096.  *
  2097.  */
  2098.     __pyx_t_8 = (__pyx_v_is_part_2 != 0);
  2099.     if (!__pyx_t_8) {
  2100.       goto __pyx_L7_next_or;
  2101.     } else {
  2102.     }
  2103.     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
  2104.     __Pyx_GOTREF(__pyx_t_3);
  2105.     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
  2106.     __Pyx_GOTREF(__pyx_t_2);
  2107.     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  2108.     __Pyx_GOTREF(__pyx_t_1);
  2109.     __Pyx_GIVEREF(__pyx_t_3);
  2110.     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2111.     __Pyx_GIVEREF(__pyx_t_2);
  2112.     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  2113.     __pyx_t_3 = 0;
  2114.     __pyx_t_2 = 0;
  2115.     __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
  2116.     __Pyx_GOTREF(__pyx_t_2);
  2117.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2118.     __pyx_t_1 = __Pyx_PyInt_From_npy_int32(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  2119.     __Pyx_GOTREF(__pyx_t_1);
  2120.     __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
  2121.     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2122.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2123.     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 26, __pyx_L1_error)
  2124.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2125.     if (!__pyx_t_8) {
  2126.     } else {
  2127.       __pyx_t_7 = __pyx_t_8;
  2128.       goto __pyx_L6_bool_binop_done;
  2129.     }
  2130.     __pyx_L7_next_or:;
  2131.     __pyx_t_8 = ((__pyx_v_node == __pyx_v_end) != 0);
  2132.     __pyx_t_7 = __pyx_t_8;
  2133.     __pyx_L6_bool_binop_done:;
  2134.     if (__pyx_t_7) {
  2135.  
  2136.       /* "bfs.pyx":27
  2137.  *         node = open_list.front()
  2138.  *         if (is_part_2 and view[node.first, node.second] == a) or node == end:
  2139.  *             return cost[node.first, node.second]             # <<<<<<<<<<<<<<
  2140.  *
  2141.  *         for position in positions:
  2142.  */
  2143.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
  2144.       __Pyx_GOTREF(__pyx_t_3);
  2145.       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  2146.       __Pyx_GOTREF(__pyx_t_1);
  2147.       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
  2148.       __Pyx_GOTREF(__pyx_t_2);
  2149.       __Pyx_GIVEREF(__pyx_t_3);
  2150.       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  2151.       __Pyx_GIVEREF(__pyx_t_1);
  2152.       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  2153.       __pyx_t_3 = 0;
  2154.       __pyx_t_1 = 0;
  2155.       __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_cost), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  2156.       __Pyx_GOTREF(__pyx_t_1);
  2157.       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2158.       __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error)
  2159.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2160.       __pyx_r = __pyx_t_9;
  2161.       goto __pyx_L0;
  2162.  
  2163.       /* "bfs.pyx":26
  2164.  *     while open_list.size() > 0:
  2165.  *         node = open_list.front()
  2166.  *         if (is_part_2 and view[node.first, node.second] == a) or node == end:             # <<<<<<<<<<<<<<
  2167.  *             return cost[node.first, node.second]
  2168.  *
  2169.  */
  2170.     }
  2171.  
  2172.     /* "bfs.pyx":29
  2173.  *             return cost[node.first, node.second]
  2174.  *
  2175.  *         for position in positions:             # <<<<<<<<<<<<<<
  2176.  *             xy = (node.first + position.first, node.second + position.second)
  2177.  *             if (
  2178.  */
  2179.     __pyx_t_10 = __pyx_v_positions.begin();
  2180.     for (;;) {
  2181.       if (!(__pyx_t_10 != __pyx_v_positions.end())) break;
  2182.       __pyx_t_11 = *__pyx_t_10;
  2183.       ++__pyx_t_10;
  2184.       __pyx_v_position = __pyx_t_11;
  2185.  
  2186.       /* "bfs.pyx":30
  2187.  *
  2188.  *         for position in positions:
  2189.  *             xy = (node.first + position.first, node.second + position.second)             # <<<<<<<<<<<<<<
  2190.  *             if (
  2191.  *                 xy.first >= 0
  2192.  */
  2193.       __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_node.first + __pyx_v_position.first)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
  2194.       __Pyx_GOTREF(__pyx_t_1);
  2195.       __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_node.second + __pyx_v_position.second)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  2196.       __Pyx_GOTREF(__pyx_t_2);
  2197.       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
  2198.       __Pyx_GOTREF(__pyx_t_3);
  2199.       __Pyx_GIVEREF(__pyx_t_1);
  2200.       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2201.       __Pyx_GIVEREF(__pyx_t_2);
  2202.       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  2203.       __pyx_t_1 = 0;
  2204.       __pyx_t_2 = 0;
  2205.       __pyx_t_11 = __pyx_convert_pair_from_py_int__and_int(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L1_error)
  2206.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2207.       __pyx_v_xy = __pyx_t_11;
  2208.  
  2209.       /* "bfs.pyx":32
  2210.  *             xy = (node.first + position.first, node.second + position.second)
  2211.  *             if (
  2212.  *                 xy.first >= 0             # <<<<<<<<<<<<<<
  2213.  *                 and xy.second >= 0
  2214.  *                 and xy.first < view.shape[0]
  2215.  */
  2216.       __pyx_t_8 = ((__pyx_v_xy.first >= 0) != 0);
  2217.       if (__pyx_t_8) {
  2218.       } else {
  2219.         __pyx_t_7 = __pyx_t_8;
  2220.         goto __pyx_L12_bool_binop_done;
  2221.       }
  2222.  
  2223.       /* "bfs.pyx":33
  2224.  *             if (
  2225.  *                 xy.first >= 0
  2226.  *                 and xy.second >= 0             # <<<<<<<<<<<<<<
  2227.  *                 and xy.first < view.shape[0]
  2228.  *                 and xy.second < view.shape[1]
  2229.  */
  2230.       __pyx_t_8 = ((__pyx_v_xy.second >= 0) != 0);
  2231.       if (__pyx_t_8) {
  2232.       } else {
  2233.         __pyx_t_7 = __pyx_t_8;
  2234.         goto __pyx_L12_bool_binop_done;
  2235.       }
  2236.  
  2237.       /* "bfs.pyx":34
  2238.  *                 xy.first >= 0
  2239.  *                 and xy.second >= 0
  2240.  *                 and xy.first < view.shape[0]             # <<<<<<<<<<<<<<
  2241.  *                 and xy.second < view.shape[1]
  2242.  *                 and (
  2243.  */
  2244.       __pyx_t_8 = ((__pyx_v_xy.first < (__pyx_v_view->dimensions[0])) != 0);
  2245.       if (__pyx_t_8) {
  2246.       } else {
  2247.         __pyx_t_7 = __pyx_t_8;
  2248.         goto __pyx_L12_bool_binop_done;
  2249.       }
  2250.  
  2251.       /* "bfs.pyx":35
  2252.  *                 and xy.second >= 0
  2253.  *                 and xy.first < view.shape[0]
  2254.  *                 and xy.second < view.shape[1]             # <<<<<<<<<<<<<<
  2255.  *                 and (
  2256.  *                     view[xy.first, xy.second] == view[node.first, node.second] + 1
  2257.  */
  2258.       __pyx_t_8 = ((__pyx_v_xy.second < (__pyx_v_view->dimensions[1])) != 0);
  2259.       if (__pyx_t_8) {
  2260.       } else {
  2261.         __pyx_t_7 = __pyx_t_8;
  2262.         goto __pyx_L12_bool_binop_done;
  2263.       }
  2264.  
  2265.       /* "bfs.pyx":37
  2266.  *                 and xy.second < view.shape[1]
  2267.  *                 and (
  2268.  *                     view[xy.first, xy.second] == view[node.first, node.second] + 1             # <<<<<<<<<<<<<<
  2269.  *                     or view[xy.first, xy.second] <= view[node.first, node.second]
  2270.  *                 )
  2271.  */
  2272.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  2273.       __Pyx_GOTREF(__pyx_t_3);
  2274.       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  2275.       __Pyx_GOTREF(__pyx_t_2);
  2276.       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  2277.       __Pyx_GOTREF(__pyx_t_1);
  2278.       __Pyx_GIVEREF(__pyx_t_3);
  2279.       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2280.       __Pyx_GIVEREF(__pyx_t_2);
  2281.       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  2282.       __pyx_t_3 = 0;
  2283.       __pyx_t_2 = 0;
  2284.       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  2285.       __Pyx_GOTREF(__pyx_t_2);
  2286.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2287.       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  2288.       __Pyx_GOTREF(__pyx_t_1);
  2289.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  2290.       __Pyx_GOTREF(__pyx_t_3);
  2291.       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error)
  2292.       __Pyx_GOTREF(__pyx_t_4);
  2293.       __Pyx_GIVEREF(__pyx_t_1);
  2294.       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  2295.       __Pyx_GIVEREF(__pyx_t_3);
  2296.       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  2297.       __pyx_t_1 = 0;
  2298.       __pyx_t_3 = 0;
  2299.       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  2300.       __Pyx_GOTREF(__pyx_t_3);
  2301.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2302.       __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error)
  2303.       __Pyx_GOTREF(__pyx_t_4);
  2304.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2305.       __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  2306.       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2307.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2308.       __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
  2309.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2310.       if (!__pyx_t_8) {
  2311.       } else {
  2312.         goto __pyx_L17_next_and;
  2313.       }
  2314.  
  2315.       /* "bfs.pyx":38
  2316.  *                 and (
  2317.  *                     view[xy.first, xy.second] == view[node.first, node.second] + 1
  2318.  *                     or view[xy.first, xy.second] <= view[node.first, node.second]             # <<<<<<<<<<<<<<
  2319.  *                 )
  2320.  *                 and not visited[xy.first, xy.second]
  2321.  */
  2322.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  2323.       __Pyx_GOTREF(__pyx_t_3);
  2324.       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
  2325.       __Pyx_GOTREF(__pyx_t_4);
  2326.       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  2327.       __Pyx_GOTREF(__pyx_t_2);
  2328.       __Pyx_GIVEREF(__pyx_t_3);
  2329.       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  2330.       __Pyx_GIVEREF(__pyx_t_4);
  2331.       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  2332.       __pyx_t_3 = 0;
  2333.       __pyx_t_4 = 0;
  2334.       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
  2335.       __Pyx_GOTREF(__pyx_t_4);
  2336.       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2337.       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  2338.       __Pyx_GOTREF(__pyx_t_2);
  2339.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  2340.       __Pyx_GOTREF(__pyx_t_3);
  2341.       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
  2342.       __Pyx_GOTREF(__pyx_t_1);
  2343.       __Pyx_GIVEREF(__pyx_t_2);
  2344.       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  2345.       __Pyx_GIVEREF(__pyx_t_3);
  2346.       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  2347.       __pyx_t_2 = 0;
  2348.       __pyx_t_3 = 0;
  2349.       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  2350.       __Pyx_GOTREF(__pyx_t_3);
  2351.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2352.       __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
  2353.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2354.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2355.       __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
  2356.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2357.       if (__pyx_t_8) {
  2358.       } else {
  2359.         __pyx_t_7 = __pyx_t_8;
  2360.         goto __pyx_L12_bool_binop_done;
  2361.       }
  2362.       __pyx_L17_next_and:;
  2363.  
  2364.       /* "bfs.pyx":40
  2365.  *                     or view[xy.first, xy.second] <= view[node.first, node.second]
  2366.  *                 )
  2367.  *                 and not visited[xy.first, xy.second]             # <<<<<<<<<<<<<<
  2368.  *             ):
  2369.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1
  2370.  */
  2371.       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
  2372.       __Pyx_GOTREF(__pyx_t_1);
  2373.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
  2374.       __Pyx_GOTREF(__pyx_t_3);
  2375.       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)
  2376.       __Pyx_GOTREF(__pyx_t_4);
  2377.       __Pyx_GIVEREF(__pyx_t_1);
  2378.       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  2379.       __Pyx_GIVEREF(__pyx_t_3);
  2380.       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  2381.       __pyx_t_1 = 0;
  2382.       __pyx_t_3 = 0;
  2383.       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_visited), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
  2384.       __Pyx_GOTREF(__pyx_t_3);
  2385.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2386.       __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 40, __pyx_L1_error)
  2387.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2388.       __pyx_t_12 = ((!__pyx_t_8) != 0);
  2389.       __pyx_t_7 = __pyx_t_12;
  2390.       __pyx_L12_bool_binop_done:;
  2391.  
  2392.       /* "bfs.pyx":31
  2393.  *         for position in positions:
  2394.  *             xy = (node.first + position.first, node.second + position.second)
  2395.  *             if (             # <<<<<<<<<<<<<<
  2396.  *                 xy.first >= 0
  2397.  *                 and xy.second >= 0
  2398.  */
  2399.       if (__pyx_t_7) {
  2400.  
  2401.         /* "bfs.pyx":42
  2402.  *                 and not visited[xy.first, xy.second]
  2403.  *             ):
  2404.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1             # <<<<<<<<<<<<<<
  2405.  *                 open_list.push_back(xy)
  2406.  *                 visited[xy.first, xy.second] = True
  2407.  */
  2408.         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
  2409.         __Pyx_GOTREF(__pyx_t_3);
  2410.         __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
  2411.         __Pyx_GOTREF(__pyx_t_4);
  2412.         __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
  2413.         __Pyx_GOTREF(__pyx_t_1);
  2414.         __Pyx_GIVEREF(__pyx_t_3);
  2415.         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2416.         __Pyx_GIVEREF(__pyx_t_4);
  2417.         PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  2418.         __pyx_t_3 = 0;
  2419.         __pyx_t_4 = 0;
  2420.         __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_cost), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
  2421.         __Pyx_GOTREF(__pyx_t_4);
  2422.         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2423.         __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
  2424.         __Pyx_GOTREF(__pyx_t_1);
  2425.         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2426.         __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
  2427.         __Pyx_GOTREF(__pyx_t_4);
  2428.         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
  2429.         __Pyx_GOTREF(__pyx_t_3);
  2430.         __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
  2431.         __Pyx_GOTREF(__pyx_t_2);
  2432.         __Pyx_GIVEREF(__pyx_t_4);
  2433.         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  2434.         __Pyx_GIVEREF(__pyx_t_3);
  2435.         PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  2436.         __pyx_t_4 = 0;
  2437.         __pyx_t_3 = 0;
  2438.         if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_cost), __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 42, __pyx_L1_error)
  2439.         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2440.         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2441.  
  2442.         /* "bfs.pyx":43
  2443.  *             ):
  2444.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1
  2445.  *                 open_list.push_back(xy)             # <<<<<<<<<<<<<<
  2446.  *                 visited[xy.first, xy.second] = True
  2447.  *
  2448.  */
  2449.         __pyx_v_open_list.push_back(__pyx_v_xy);
  2450.  
  2451.         /* "bfs.pyx":44
  2452.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1
  2453.  *                 open_list.push_back(xy)
  2454.  *                 visited[xy.first, xy.second] = True             # <<<<<<<<<<<<<<
  2455.  *
  2456.  *         open_list.pop_front()
  2457.  */
  2458.         __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
  2459.         __Pyx_GOTREF(__pyx_t_1);
  2460.         __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
  2461.         __Pyx_GOTREF(__pyx_t_2);
  2462.         __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
  2463.         __Pyx_GOTREF(__pyx_t_3);
  2464.         __Pyx_GIVEREF(__pyx_t_1);
  2465.         PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2466.         __Pyx_GIVEREF(__pyx_t_2);
  2467.         PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  2468.         __pyx_t_1 = 0;
  2469.         __pyx_t_2 = 0;
  2470.         if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_visited), __pyx_t_3, Py_True) < 0)) __PYX_ERR(0, 44, __pyx_L1_error)
  2471.         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2472.  
  2473.         /* "bfs.pyx":31
  2474.  *         for position in positions:
  2475.  *             xy = (node.first + position.first, node.second + position.second)
  2476.  *             if (             # <<<<<<<<<<<<<<
  2477.  *                 xy.first >= 0
  2478.  *                 and xy.second >= 0
  2479.  */
  2480.       }
  2481.  
  2482.       /* "bfs.pyx":29
  2483.  *             return cost[node.first, node.second]
  2484.  *
  2485.  *         for position in positions:             # <<<<<<<<<<<<<<
  2486.  *             xy = (node.first + position.first, node.second + position.second)
  2487.  *             if (
  2488.  */
  2489.     }
  2490.  
  2491.     /* "bfs.pyx":46
  2492.  *                 visited[xy.first, xy.second] = True
  2493.  *
  2494.  *         open_list.pop_front()             # <<<<<<<<<<<<<<
  2495.  *
  2496.  *     return -1
  2497.  */
  2498.     __pyx_v_open_list.pop_front();
  2499.   }
  2500.  
  2501.   /* "bfs.pyx":48
  2502.  *         open_list.pop_front()
  2503.  *
  2504.  *     return -1             # <<<<<<<<<<<<<<
  2505.  *
  2506.  *
  2507.  */
  2508.   __pyx_r = -1;
  2509.   goto __pyx_L0;
  2510.  
  2511.   /* "bfs.pyx":12
  2512.  *
  2513.  *
  2514.  * cpdef int bfs(np.ndarray view, pair[int, int] start, pair[int, int] end, bool is_part_2):             # <<<<<<<<<<<<<<
  2515.  *     cdef deque[pair[int, int]] open_list
  2516.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  2517.  */
  2518.  
  2519.   /* function exit code */
  2520.   __pyx_L1_error:;
  2521.   __Pyx_XDECREF(__pyx_t_1);
  2522.   __Pyx_XDECREF(__pyx_t_2);
  2523.   __Pyx_XDECREF(__pyx_t_3);
  2524.   __Pyx_XDECREF(__pyx_t_4);
  2525.   __Pyx_XDECREF(__pyx_t_5);
  2526.   __Pyx_WriteUnraisable("bfs.bfs", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  2527.   __pyx_r = 0;
  2528.   __pyx_L0:;
  2529.   __Pyx_XDECREF((PyObject *)__pyx_v_visited);
  2530.   __Pyx_XDECREF((PyObject *)__pyx_v_cost);
  2531.   __Pyx_RefNannyFinishContext();
  2532.   return __pyx_r;
  2533. }
  2534.  
  2535. /* Python wrapper */
  2536. static PyObject *__pyx_pw_3bfs_1bfs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2537. static PyObject *__pyx_pw_3bfs_1bfs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2538.   PyArrayObject *__pyx_v_view = 0;
  2539.   std::pair<int,int>  __pyx_v_start;
  2540.   std::pair<int,int>  __pyx_v_end;
  2541.   bool __pyx_v_is_part_2;
  2542.   int __pyx_lineno = 0;
  2543.   const char *__pyx_filename = NULL;
  2544.   int __pyx_clineno = 0;
  2545.   PyObject *__pyx_r = 0;
  2546.   __Pyx_RefNannyDeclarations
  2547.   __Pyx_RefNannySetupContext("bfs (wrapper)", 0);
  2548.   {
  2549.     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_view,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_is_part_2,0};
  2550.     PyObject* values[4] = {0,0,0,0};
  2551.     if (unlikely(__pyx_kwds)) {
  2552.       Py_ssize_t kw_args;
  2553.       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2554.       switch (pos_args) {
  2555.         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2556.         CYTHON_FALLTHROUGH;
  2557.         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2558.         CYTHON_FALLTHROUGH;
  2559.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2560.         CYTHON_FALLTHROUGH;
  2561.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2562.         CYTHON_FALLTHROUGH;
  2563.         case  0: break;
  2564.         default: goto __pyx_L5_argtuple_error;
  2565.       }
  2566.       kw_args = PyDict_Size(__pyx_kwds);
  2567.       switch (pos_args) {
  2568.         case  0:
  2569.         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_view)) != 0)) kw_args--;
  2570.         else goto __pyx_L5_argtuple_error;
  2571.         CYTHON_FALLTHROUGH;
  2572.         case  1:
  2573.         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
  2574.         else {
  2575.           __Pyx_RaiseArgtupleInvalid("bfs", 1, 4, 4, 1); __PYX_ERR(0, 12, __pyx_L3_error)
  2576.         }
  2577.         CYTHON_FALLTHROUGH;
  2578.         case  2:
  2579.         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
  2580.         else {
  2581.           __Pyx_RaiseArgtupleInvalid("bfs", 1, 4, 4, 2); __PYX_ERR(0, 12, __pyx_L3_error)
  2582.         }
  2583.         CYTHON_FALLTHROUGH;
  2584.         case  3:
  2585.         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_is_part_2)) != 0)) kw_args--;
  2586.         else {
  2587.           __Pyx_RaiseArgtupleInvalid("bfs", 1, 4, 4, 3); __PYX_ERR(0, 12, __pyx_L3_error)
  2588.         }
  2589.       }
  2590.       if (unlikely(kw_args > 0)) {
  2591.         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bfs") < 0)) __PYX_ERR(0, 12, __pyx_L3_error)
  2592.       }
  2593.     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
  2594.       goto __pyx_L5_argtuple_error;
  2595.     } else {
  2596.       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2597.       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2598.       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2599.       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2600.     }
  2601.     __pyx_v_view = ((PyArrayObject *)values[0]);
  2602.     __pyx_v_start = __pyx_convert_pair_from_py_int__and_int(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
  2603.     __pyx_v_end = __pyx_convert_pair_from_py_int__and_int(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
  2604.     __pyx_v_is_part_2 = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_is_part_2 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
  2605.   }
  2606.   goto __pyx_L4_argument_unpacking_done;
  2607.   __pyx_L5_argtuple_error:;
  2608.   __Pyx_RaiseArgtupleInvalid("bfs", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 12, __pyx_L3_error)
  2609.   __pyx_L3_error:;
  2610.   __Pyx_AddTraceback("bfs.bfs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2611.   __Pyx_RefNannyFinishContext();
  2612.   return NULL;
  2613.   __pyx_L4_argument_unpacking_done:;
  2614.   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_view), __pyx_ptype_5numpy_ndarray, 1, "view", 0))) __PYX_ERR(0, 12, __pyx_L1_error)
  2615.   __pyx_r = __pyx_pf_3bfs_bfs(__pyx_self, __pyx_v_view, __pyx_v_start, __pyx_v_end, __pyx_v_is_part_2);
  2616.  
  2617.   /* function exit code */
  2618.   goto __pyx_L0;
  2619.   __pyx_L1_error:;
  2620.   __pyx_r = NULL;
  2621.   __pyx_L0:;
  2622.   __Pyx_RefNannyFinishContext();
  2623.   return __pyx_r;
  2624. }
  2625.  
  2626. static PyObject *__pyx_pf_3bfs_bfs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_view, std::pair<int,int>  __pyx_v_start, std::pair<int,int>  __pyx_v_end, bool __pyx_v_is_part_2) {
  2627.   PyObject *__pyx_r = NULL;
  2628.   __Pyx_RefNannyDeclarations
  2629.   PyObject *__pyx_t_1 = NULL;
  2630.   int __pyx_lineno = 0;
  2631.   const char *__pyx_filename = NULL;
  2632.   int __pyx_clineno = 0;
  2633.   __Pyx_RefNannySetupContext("bfs", 0);
  2634.   __Pyx_XDECREF(__pyx_r);
  2635.   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3bfs_bfs(__pyx_v_view, __pyx_v_start, __pyx_v_end, __pyx_v_is_part_2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  2636.   __Pyx_GOTREF(__pyx_t_1);
  2637.   __pyx_r = __pyx_t_1;
  2638.   __pyx_t_1 = 0;
  2639.   goto __pyx_L0;
  2640.  
  2641.   /* function exit code */
  2642.   __pyx_L1_error:;
  2643.   __Pyx_XDECREF(__pyx_t_1);
  2644.   __Pyx_AddTraceback("bfs.bfs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2645.   __pyx_r = NULL;
  2646.   __pyx_L0:;
  2647.   __Pyx_XGIVEREF(__pyx_r);
  2648.   __Pyx_RefNannyFinishContext();
  2649.   return __pyx_r;
  2650. }
  2651.  
  2652. /* "bfs.pyx":51
  2653.  *
  2654.  *
  2655.  * cpdef int bfs_2(np.ndarray view, pair[int, int] start):             # <<<<<<<<<<<<<<
  2656.  *     cdef deque[pair[int, int]] open_list
  2657.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  2658.  */
  2659.  
  2660. static PyObject *__pyx_pw_3bfs_3bfs_2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2661. static int __pyx_f_3bfs_bfs_2(PyArrayObject *__pyx_v_view, std::pair<int,int>  __pyx_v_start, CYTHON_UNUSED int __pyx_skip_dispatch) {
  2662.   std::deque<std::pair<int,int> >  __pyx_v_open_list;
  2663.   PyArrayObject *__pyx_v_visited = 0;
  2664.   PyArrayObject *__pyx_v_cost = 0;
  2665.   std::list<std::pair<int,int> >  __pyx_v_positions;
  2666.   std::pair<int,int>  __pyx_v_node;
  2667.   std::pair<int,int>  __pyx_v_xy;
  2668.   __pyx_t_3bfs_DTYPE_t __pyx_v_end;
  2669.   std::pair<int,int>  __pyx_v_position;
  2670.   int __pyx_r;
  2671.   __Pyx_RefNannyDeclarations
  2672.   PyObject *__pyx_t_1 = NULL;
  2673.   PyObject *__pyx_t_2 = NULL;
  2674.   PyObject *__pyx_t_3 = NULL;
  2675.   PyObject *__pyx_t_4 = NULL;
  2676.   PyObject *__pyx_t_5 = NULL;
  2677.   std::list<std::pair<int,int> >  __pyx_t_6;
  2678.   int __pyx_t_7;
  2679.   int __pyx_t_8;
  2680.   std::list<std::pair<int,int> > ::iterator __pyx_t_9;
  2681.   std::pair<int,int>  __pyx_t_10;
  2682.   int __pyx_t_11;
  2683.   int __pyx_t_12;
  2684.   int __pyx_lineno = 0;
  2685.   const char *__pyx_filename = NULL;
  2686.   int __pyx_clineno = 0;
  2687.   __Pyx_RefNannySetupContext("bfs_2", 0);
  2688.  
  2689.   /* "bfs.pyx":53
  2690.  * cpdef int bfs_2(np.ndarray view, pair[int, int] start):
  2691.  *     cdef deque[pair[int, int]] open_list
  2692.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)             # <<<<<<<<<<<<<<
  2693.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)
  2694.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
  2695.  */
  2696.   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
  2697.   __Pyx_GOTREF(__pyx_t_1);
  2698.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
  2699.   __Pyx_GOTREF(__pyx_t_2);
  2700.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2701.   __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
  2702.   __Pyx_GOTREF(__pyx_t_1);
  2703.   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
  2704.   __Pyx_GOTREF(__pyx_t_3);
  2705.   __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
  2706.   __Pyx_GOTREF(__pyx_t_4);
  2707.   __Pyx_GIVEREF(__pyx_t_1);
  2708.   PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  2709.   __Pyx_GIVEREF(__pyx_t_3);
  2710.   PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  2711.   __pyx_t_1 = 0;
  2712.   __pyx_t_3 = 0;
  2713.   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
  2714.   __Pyx_GOTREF(__pyx_t_3);
  2715.   __Pyx_GIVEREF(__pyx_t_4);
  2716.   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2717.   __pyx_t_4 = 0;
  2718.   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
  2719.   __Pyx_GOTREF(__pyx_t_4);
  2720.   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
  2721.   __Pyx_GOTREF(__pyx_t_1);
  2722.   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bool); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error)
  2723.   __Pyx_GOTREF(__pyx_t_5);
  2724.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2725.   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
  2726.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2727.   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error)
  2728.   __Pyx_GOTREF(__pyx_t_5);
  2729.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2730.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2731.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2732.   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 53, __pyx_L1_error)
  2733.   __pyx_v_visited = ((PyArrayObject *)__pyx_t_5);
  2734.   __pyx_t_5 = 0;
  2735.  
  2736.   /* "bfs.pyx":54
  2737.  *     cdef deque[pair[int, int]] open_list
  2738.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  2739.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)             # <<<<<<<<<<<<<<
  2740.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
  2741.  *     cdef pair[int, int] node
  2742.  */
  2743.   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
  2744.   __Pyx_GOTREF(__pyx_t_5);
  2745.   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
  2746.   __Pyx_GOTREF(__pyx_t_4);
  2747.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2748.   __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
  2749.   __Pyx_GOTREF(__pyx_t_5);
  2750.   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_view->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  2751.   __Pyx_GOTREF(__pyx_t_3);
  2752.   __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  2753.   __Pyx_GOTREF(__pyx_t_2);
  2754.   __Pyx_GIVEREF(__pyx_t_5);
  2755.   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  2756.   __Pyx_GIVEREF(__pyx_t_3);
  2757.   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  2758.   __pyx_t_5 = 0;
  2759.   __pyx_t_3 = 0;
  2760.   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  2761.   __Pyx_GOTREF(__pyx_t_3);
  2762.   __Pyx_GIVEREF(__pyx_t_2);
  2763.   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2764.   __pyx_t_2 = 0;
  2765.   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  2766.   __Pyx_GOTREF(__pyx_t_2);
  2767.   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
  2768.   __Pyx_GOTREF(__pyx_t_5);
  2769.   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
  2770.   __Pyx_GOTREF(__pyx_t_1);
  2771.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2772.   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  2773.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2774.   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
  2775.   __Pyx_GOTREF(__pyx_t_1);
  2776.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2777.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2778.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2779.   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 54, __pyx_L1_error)
  2780.   __pyx_v_cost = ((PyArrayObject *)__pyx_t_1);
  2781.   __pyx_t_1 = 0;
  2782.  
  2783.   /* "bfs.pyx":55
  2784.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  2785.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)
  2786.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]             # <<<<<<<<<<<<<<
  2787.  *     cdef pair[int, int] node
  2788.  *     cdef pair[int, int] xy
  2789.  */
  2790.   __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
  2791.   __Pyx_GOTREF(__pyx_t_1);
  2792.   __Pyx_INCREF(__pyx_tuple_);
  2793.   __Pyx_GIVEREF(__pyx_tuple_);
  2794.   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_tuple_);
  2795.   __Pyx_INCREF(__pyx_tuple__2);
  2796.   __Pyx_GIVEREF(__pyx_tuple__2);
  2797.   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_tuple__2);
  2798.   __Pyx_INCREF(__pyx_tuple__3);
  2799.   __Pyx_GIVEREF(__pyx_tuple__3);
  2800.   PyList_SET_ITEM(__pyx_t_1, 2, __pyx_tuple__3);
  2801.   __Pyx_INCREF(__pyx_tuple__4);
  2802.   __Pyx_GIVEREF(__pyx_tuple__4);
  2803.   PyList_SET_ITEM(__pyx_t_1, 3, __pyx_tuple__4);
  2804.   __pyx_t_6 = __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
  2805.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2806.   __pyx_v_positions = __pyx_t_6;
  2807.  
  2808.   /* "bfs.pyx":58
  2809.  *     cdef pair[int, int] node
  2810.  *     cdef pair[int, int] xy
  2811.  *     cdef DTYPE_t end = ord("a")             # <<<<<<<<<<<<<<
  2812.  *
  2813.  *     open_list.push_back(start)
  2814.  */
  2815.   __pyx_v_end = 97;
  2816.  
  2817.   /* "bfs.pyx":60
  2818.  *     cdef DTYPE_t end = ord("a")
  2819.  *
  2820.  *     open_list.push_back(start)             # <<<<<<<<<<<<<<
  2821.  *     visited[start.first, start.second] = True
  2822.  *
  2823.  */
  2824.   __pyx_v_open_list.push_back(__pyx_v_start);
  2825.  
  2826.   /* "bfs.pyx":61
  2827.  *
  2828.  *     open_list.push_back(start)
  2829.  *     visited[start.first, start.second] = True             # <<<<<<<<<<<<<<
  2830.  *
  2831.  *     while open_list.size() > 0:
  2832.  */
  2833.   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  2834.   __Pyx_GOTREF(__pyx_t_1);
  2835.   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_start.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
  2836.   __Pyx_GOTREF(__pyx_t_2);
  2837.   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error)
  2838.   __Pyx_GOTREF(__pyx_t_3);
  2839.   __Pyx_GIVEREF(__pyx_t_1);
  2840.   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2841.   __Pyx_GIVEREF(__pyx_t_2);
  2842.   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  2843.   __pyx_t_1 = 0;
  2844.   __pyx_t_2 = 0;
  2845.   if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_visited), __pyx_t_3, Py_True) < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
  2846.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2847.  
  2848.   /* "bfs.pyx":63
  2849.  *     visited[start.first, start.second] = True
  2850.  *
  2851.  *     while open_list.size() > 0:             # <<<<<<<<<<<<<<
  2852.  *         node = open_list.front()
  2853.  *         if view[node.first, node.second] == end:
  2854.  */
  2855.   while (1) {
  2856.     __pyx_t_7 = ((__pyx_v_open_list.size() > 0) != 0);
  2857.     if (!__pyx_t_7) break;
  2858.  
  2859.     /* "bfs.pyx":64
  2860.  *
  2861.  *     while open_list.size() > 0:
  2862.  *         node = open_list.front()             # <<<<<<<<<<<<<<
  2863.  *         if view[node.first, node.second] == end:
  2864.  *             return cost[node.first, node.second]
  2865.  */
  2866.     __pyx_v_node = __pyx_v_open_list.front();
  2867.  
  2868.     /* "bfs.pyx":65
  2869.  *     while open_list.size() > 0:
  2870.  *         node = open_list.front()
  2871.  *         if view[node.first, node.second] == end:             # <<<<<<<<<<<<<<
  2872.  *             return cost[node.first, node.second]
  2873.  *
  2874.  */
  2875.     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
  2876.     __Pyx_GOTREF(__pyx_t_3);
  2877.     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)
  2878.     __Pyx_GOTREF(__pyx_t_2);
  2879.     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
  2880.     __Pyx_GOTREF(__pyx_t_1);
  2881.     __Pyx_GIVEREF(__pyx_t_3);
  2882.     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2883.     __Pyx_GIVEREF(__pyx_t_2);
  2884.     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  2885.     __pyx_t_3 = 0;
  2886.     __pyx_t_2 = 0;
  2887.     __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)
  2888.     __Pyx_GOTREF(__pyx_t_2);
  2889.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2890.     __pyx_t_1 = __Pyx_PyInt_From_npy_int32(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
  2891.     __Pyx_GOTREF(__pyx_t_1);
  2892.     __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
  2893.     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2894.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2895.     __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 65, __pyx_L1_error)
  2896.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2897.     if (__pyx_t_7) {
  2898.  
  2899.       /* "bfs.pyx":66
  2900.  *         node = open_list.front()
  2901.  *         if view[node.first, node.second] == end:
  2902.  *             return cost[node.first, node.second]             # <<<<<<<<<<<<<<
  2903.  *
  2904.  *         for position in positions:
  2905.  */
  2906.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  2907.       __Pyx_GOTREF(__pyx_t_3);
  2908.       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  2909.       __Pyx_GOTREF(__pyx_t_1);
  2910.       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
  2911.       __Pyx_GOTREF(__pyx_t_2);
  2912.       __Pyx_GIVEREF(__pyx_t_3);
  2913.       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  2914.       __Pyx_GIVEREF(__pyx_t_1);
  2915.       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  2916.       __pyx_t_3 = 0;
  2917.       __pyx_t_1 = 0;
  2918.       __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_cost), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  2919.       __Pyx_GOTREF(__pyx_t_1);
  2920.       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2921.       __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error)
  2922.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2923.       __pyx_r = __pyx_t_8;
  2924.       goto __pyx_L0;
  2925.  
  2926.       /* "bfs.pyx":65
  2927.  *     while open_list.size() > 0:
  2928.  *         node = open_list.front()
  2929.  *         if view[node.first, node.second] == end:             # <<<<<<<<<<<<<<
  2930.  *             return cost[node.first, node.second]
  2931.  *
  2932.  */
  2933.     }
  2934.  
  2935.     /* "bfs.pyx":68
  2936.  *             return cost[node.first, node.second]
  2937.  *
  2938.  *         for position in positions:             # <<<<<<<<<<<<<<
  2939.  *             xy = (node.first + position.first, node.second + position.second)
  2940.  *             if (
  2941.  */
  2942.     __pyx_t_9 = __pyx_v_positions.begin();
  2943.     for (;;) {
  2944.       if (!(__pyx_t_9 != __pyx_v_positions.end())) break;
  2945.       __pyx_t_10 = *__pyx_t_9;
  2946.       ++__pyx_t_9;
  2947.       __pyx_v_position = __pyx_t_10;
  2948.  
  2949.       /* "bfs.pyx":69
  2950.  *
  2951.  *         for position in positions:
  2952.  *             xy = (node.first + position.first, node.second + position.second)             # <<<<<<<<<<<<<<
  2953.  *             if (
  2954.  *                 xy.first >= 0
  2955.  */
  2956.       __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_node.first + __pyx_v_position.first)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  2957.       __Pyx_GOTREF(__pyx_t_1);
  2958.       __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_node.second + __pyx_v_position.second)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
  2959.       __Pyx_GOTREF(__pyx_t_2);
  2960.       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
  2961.       __Pyx_GOTREF(__pyx_t_3);
  2962.       __Pyx_GIVEREF(__pyx_t_1);
  2963.       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2964.       __Pyx_GIVEREF(__pyx_t_2);
  2965.       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  2966.       __pyx_t_1 = 0;
  2967.       __pyx_t_2 = 0;
  2968.       __pyx_t_10 = __pyx_convert_pair_from_py_int__and_int(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
  2969.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2970.       __pyx_v_xy = __pyx_t_10;
  2971.  
  2972.       /* "bfs.pyx":71
  2973.  *             xy = (node.first + position.first, node.second + position.second)
  2974.  *             if (
  2975.  *                 xy.first >= 0             # <<<<<<<<<<<<<<
  2976.  *                 and xy.second >= 0
  2977.  *                 and xy.first < view.shape[0]
  2978.  */
  2979.       __pyx_t_11 = ((__pyx_v_xy.first >= 0) != 0);
  2980.       if (__pyx_t_11) {
  2981.       } else {
  2982.         __pyx_t_7 = __pyx_t_11;
  2983.         goto __pyx_L9_bool_binop_done;
  2984.       }
  2985.  
  2986.       /* "bfs.pyx":72
  2987.  *             if (
  2988.  *                 xy.first >= 0
  2989.  *                 and xy.second >= 0             # <<<<<<<<<<<<<<
  2990.  *                 and xy.first < view.shape[0]
  2991.  *                 and xy.second < view.shape[1]
  2992.  */
  2993.       __pyx_t_11 = ((__pyx_v_xy.second >= 0) != 0);
  2994.       if (__pyx_t_11) {
  2995.       } else {
  2996.         __pyx_t_7 = __pyx_t_11;
  2997.         goto __pyx_L9_bool_binop_done;
  2998.       }
  2999.  
  3000.       /* "bfs.pyx":73
  3001.  *                 xy.first >= 0
  3002.  *                 and xy.second >= 0
  3003.  *                 and xy.first < view.shape[0]             # <<<<<<<<<<<<<<
  3004.  *                 and xy.second < view.shape[1]
  3005.  *                 and (
  3006.  */
  3007.       __pyx_t_11 = ((__pyx_v_xy.first < (__pyx_v_view->dimensions[0])) != 0);
  3008.       if (__pyx_t_11) {
  3009.       } else {
  3010.         __pyx_t_7 = __pyx_t_11;
  3011.         goto __pyx_L9_bool_binop_done;
  3012.       }
  3013.  
  3014.       /* "bfs.pyx":74
  3015.  *                 and xy.second >= 0
  3016.  *                 and xy.first < view.shape[0]
  3017.  *                 and xy.second < view.shape[1]             # <<<<<<<<<<<<<<
  3018.  *                 and (
  3019.  *                     view[xy.first, xy.second] == view[node.first, node.second] - 1
  3020.  */
  3021.       __pyx_t_11 = ((__pyx_v_xy.second < (__pyx_v_view->dimensions[1])) != 0);
  3022.       if (__pyx_t_11) {
  3023.       } else {
  3024.         __pyx_t_7 = __pyx_t_11;
  3025.         goto __pyx_L9_bool_binop_done;
  3026.       }
  3027.  
  3028.       /* "bfs.pyx":76
  3029.  *                 and xy.second < view.shape[1]
  3030.  *                 and (
  3031.  *                     view[xy.first, xy.second] == view[node.first, node.second] - 1             # <<<<<<<<<<<<<<
  3032.  *                     or view[xy.first, xy.second] >= view[node.first, node.second]
  3033.  *                 )
  3034.  */
  3035.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  3036.       __Pyx_GOTREF(__pyx_t_3);
  3037.       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  3038.       __Pyx_GOTREF(__pyx_t_2);
  3039.       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3040.       __Pyx_GOTREF(__pyx_t_1);
  3041.       __Pyx_GIVEREF(__pyx_t_3);
  3042.       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  3043.       __Pyx_GIVEREF(__pyx_t_2);
  3044.       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  3045.       __pyx_t_3 = 0;
  3046.       __pyx_t_2 = 0;
  3047.       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  3048.       __Pyx_GOTREF(__pyx_t_2);
  3049.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3050.       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3051.       __Pyx_GOTREF(__pyx_t_1);
  3052.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  3053.       __Pyx_GOTREF(__pyx_t_3);
  3054.       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
  3055.       __Pyx_GOTREF(__pyx_t_4);
  3056.       __Pyx_GIVEREF(__pyx_t_1);
  3057.       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  3058.       __Pyx_GIVEREF(__pyx_t_3);
  3059.       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  3060.       __pyx_t_1 = 0;
  3061.       __pyx_t_3 = 0;
  3062.       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  3063.       __Pyx_GOTREF(__pyx_t_3);
  3064.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3065.       __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
  3066.       __Pyx_GOTREF(__pyx_t_4);
  3067.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3068.       __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  3069.       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3070.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3071.       __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 76, __pyx_L1_error)
  3072.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3073.       if (!__pyx_t_11) {
  3074.       } else {
  3075.         goto __pyx_L14_next_and;
  3076.       }
  3077.  
  3078.       /* "bfs.pyx":77
  3079.  *                 and (
  3080.  *                     view[xy.first, xy.second] == view[node.first, node.second] - 1
  3081.  *                     or view[xy.first, xy.second] >= view[node.first, node.second]             # <<<<<<<<<<<<<<
  3082.  *                 )
  3083.  *                 and not visited[xy.first, xy.second]
  3084.  */
  3085.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
  3086.       __Pyx_GOTREF(__pyx_t_3);
  3087.       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error)
  3088.       __Pyx_GOTREF(__pyx_t_4);
  3089.       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  3090.       __Pyx_GOTREF(__pyx_t_2);
  3091.       __Pyx_GIVEREF(__pyx_t_3);
  3092.       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  3093.       __Pyx_GIVEREF(__pyx_t_4);
  3094.       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  3095.       __pyx_t_3 = 0;
  3096.       __pyx_t_4 = 0;
  3097.       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error)
  3098.       __Pyx_GOTREF(__pyx_t_4);
  3099.       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3100.       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  3101.       __Pyx_GOTREF(__pyx_t_2);
  3102.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
  3103.       __Pyx_GOTREF(__pyx_t_3);
  3104.       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  3105.       __Pyx_GOTREF(__pyx_t_1);
  3106.       __Pyx_GIVEREF(__pyx_t_2);
  3107.       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  3108.       __Pyx_GIVEREF(__pyx_t_3);
  3109.       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  3110.       __pyx_t_2 = 0;
  3111.       __pyx_t_3 = 0;
  3112.       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_view), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
  3113.       __Pyx_GOTREF(__pyx_t_3);
  3114.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3115.       __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  3116.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3117.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3118.       __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 77, __pyx_L1_error)
  3119.       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3120.       if (__pyx_t_11) {
  3121.       } else {
  3122.         __pyx_t_7 = __pyx_t_11;
  3123.         goto __pyx_L9_bool_binop_done;
  3124.       }
  3125.       __pyx_L14_next_and:;
  3126.  
  3127.       /* "bfs.pyx":79
  3128.  *                     or view[xy.first, xy.second] >= view[node.first, node.second]
  3129.  *                 )
  3130.  *                 and not visited[xy.first, xy.second]             # <<<<<<<<<<<<<<
  3131.  *             ):
  3132.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1
  3133.  */
  3134.       __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
  3135.       __Pyx_GOTREF(__pyx_t_1);
  3136.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
  3137.       __Pyx_GOTREF(__pyx_t_3);
  3138.       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
  3139.       __Pyx_GOTREF(__pyx_t_4);
  3140.       __Pyx_GIVEREF(__pyx_t_1);
  3141.       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  3142.       __Pyx_GIVEREF(__pyx_t_3);
  3143.       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  3144.       __pyx_t_1 = 0;
  3145.       __pyx_t_3 = 0;
  3146.       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_visited), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
  3147.       __Pyx_GOTREF(__pyx_t_3);
  3148.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3149.       __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 79, __pyx_L1_error)
  3150.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3151.       __pyx_t_12 = ((!__pyx_t_11) != 0);
  3152.       __pyx_t_7 = __pyx_t_12;
  3153.       __pyx_L9_bool_binop_done:;
  3154.  
  3155.       /* "bfs.pyx":70
  3156.  *         for position in positions:
  3157.  *             xy = (node.first + position.first, node.second + position.second)
  3158.  *             if (             # <<<<<<<<<<<<<<
  3159.  *                 xy.first >= 0
  3160.  *                 and xy.second >= 0
  3161.  */
  3162.       if (__pyx_t_7) {
  3163.  
  3164.         /* "bfs.pyx":81
  3165.  *                 and not visited[xy.first, xy.second]
  3166.  *             ):
  3167.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1             # <<<<<<<<<<<<<<
  3168.  *                 open_list.push_back(xy)
  3169.  *                 visited[xy.first, xy.second] = True
  3170.  */
  3171.         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_node.first); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
  3172.         __Pyx_GOTREF(__pyx_t_3);
  3173.         __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_node.second); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
  3174.         __Pyx_GOTREF(__pyx_t_4);
  3175.         __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  3176.         __Pyx_GOTREF(__pyx_t_1);
  3177.         __Pyx_GIVEREF(__pyx_t_3);
  3178.         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  3179.         __Pyx_GIVEREF(__pyx_t_4);
  3180.         PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  3181.         __pyx_t_3 = 0;
  3182.         __pyx_t_4 = 0;
  3183.         __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_cost), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
  3184.         __Pyx_GOTREF(__pyx_t_4);
  3185.         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3186.         __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  3187.         __Pyx_GOTREF(__pyx_t_1);
  3188.         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3189.         __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
  3190.         __Pyx_GOTREF(__pyx_t_4);
  3191.         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
  3192.         __Pyx_GOTREF(__pyx_t_3);
  3193.         __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  3194.         __Pyx_GOTREF(__pyx_t_2);
  3195.         __Pyx_GIVEREF(__pyx_t_4);
  3196.         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  3197.         __Pyx_GIVEREF(__pyx_t_3);
  3198.         PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  3199.         __pyx_t_4 = 0;
  3200.         __pyx_t_3 = 0;
  3201.         if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_cost), __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
  3202.         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3203.         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3204.  
  3205.         /* "bfs.pyx":82
  3206.  *             ):
  3207.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1
  3208.  *                 open_list.push_back(xy)             # <<<<<<<<<<<<<<
  3209.  *                 visited[xy.first, xy.second] = True
  3210.  *
  3211.  */
  3212.         __pyx_v_open_list.push_back(__pyx_v_xy);
  3213.  
  3214.         /* "bfs.pyx":83
  3215.  *                 cost[xy.first, xy.second] = cost[node.first, node.second] + 1
  3216.  *                 open_list.push_back(xy)
  3217.  *                 visited[xy.first, xy.second] = True             # <<<<<<<<<<<<<<
  3218.  *
  3219.  *         open_list.pop_front()
  3220.  */
  3221.         __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_xy.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  3222.         __Pyx_GOTREF(__pyx_t_1);
  3223.         __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_xy.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
  3224.         __Pyx_GOTREF(__pyx_t_2);
  3225.         __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error)
  3226.         __Pyx_GOTREF(__pyx_t_3);
  3227.         __Pyx_GIVEREF(__pyx_t_1);
  3228.         PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  3229.         __Pyx_GIVEREF(__pyx_t_2);
  3230.         PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  3231.         __pyx_t_1 = 0;
  3232.         __pyx_t_2 = 0;
  3233.         if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_visited), __pyx_t_3, Py_True) < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
  3234.         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3235.  
  3236.         /* "bfs.pyx":70
  3237.  *         for position in positions:
  3238.  *             xy = (node.first + position.first, node.second + position.second)
  3239.  *             if (             # <<<<<<<<<<<<<<
  3240.  *                 xy.first >= 0
  3241.  *                 and xy.second >= 0
  3242.  */
  3243.       }
  3244.  
  3245.       /* "bfs.pyx":68
  3246.  *             return cost[node.first, node.second]
  3247.  *
  3248.  *         for position in positions:             # <<<<<<<<<<<<<<
  3249.  *             xy = (node.first + position.first, node.second + position.second)
  3250.  *             if (
  3251.  */
  3252.     }
  3253.  
  3254.     /* "bfs.pyx":85
  3255.  *                 visited[xy.first, xy.second] = True
  3256.  *
  3257.  *         open_list.pop_front()             # <<<<<<<<<<<<<<
  3258.  *
  3259.  *     return -1
  3260.  */
  3261.     __pyx_v_open_list.pop_front();
  3262.   }
  3263.  
  3264.   /* "bfs.pyx":87
  3265.  *         open_list.pop_front()
  3266.  *
  3267.  *     return -1             # <<<<<<<<<<<<<<
  3268.  */
  3269.   __pyx_r = -1;
  3270.   goto __pyx_L0;
  3271.  
  3272.   /* "bfs.pyx":51
  3273.  *
  3274.  *
  3275.  * cpdef int bfs_2(np.ndarray view, pair[int, int] start):             # <<<<<<<<<<<<<<
  3276.  *     cdef deque[pair[int, int]] open_list
  3277.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  3278.  */
  3279.  
  3280.   /* function exit code */
  3281.   __pyx_L1_error:;
  3282.   __Pyx_XDECREF(__pyx_t_1);
  3283.   __Pyx_XDECREF(__pyx_t_2);
  3284.   __Pyx_XDECREF(__pyx_t_3);
  3285.   __Pyx_XDECREF(__pyx_t_4);
  3286.   __Pyx_XDECREF(__pyx_t_5);
  3287.   __Pyx_WriteUnraisable("bfs.bfs_2", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  3288.   __pyx_r = 0;
  3289.   __pyx_L0:;
  3290.   __Pyx_XDECREF((PyObject *)__pyx_v_visited);
  3291.   __Pyx_XDECREF((PyObject *)__pyx_v_cost);
  3292.   __Pyx_RefNannyFinishContext();
  3293.   return __pyx_r;
  3294. }
  3295.  
  3296. /* Python wrapper */
  3297. static PyObject *__pyx_pw_3bfs_3bfs_2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3298. static PyObject *__pyx_pw_3bfs_3bfs_2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3299.   PyArrayObject *__pyx_v_view = 0;
  3300.   std::pair<int,int>  __pyx_v_start;
  3301.   int __pyx_lineno = 0;
  3302.   const char *__pyx_filename = NULL;
  3303.   int __pyx_clineno = 0;
  3304.   PyObject *__pyx_r = 0;
  3305.   __Pyx_RefNannyDeclarations
  3306.   __Pyx_RefNannySetupContext("bfs_2 (wrapper)", 0);
  3307.   {
  3308.     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_view,&__pyx_n_s_start,0};
  3309.     PyObject* values[2] = {0,0};
  3310.     if (unlikely(__pyx_kwds)) {
  3311.       Py_ssize_t kw_args;
  3312.       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3313.       switch (pos_args) {
  3314.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3315.         CYTHON_FALLTHROUGH;
  3316.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3317.         CYTHON_FALLTHROUGH;
  3318.         case  0: break;
  3319.         default: goto __pyx_L5_argtuple_error;
  3320.       }
  3321.       kw_args = PyDict_Size(__pyx_kwds);
  3322.       switch (pos_args) {
  3323.         case  0:
  3324.         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_view)) != 0)) kw_args--;
  3325.         else goto __pyx_L5_argtuple_error;
  3326.         CYTHON_FALLTHROUGH;
  3327.         case  1:
  3328.         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
  3329.         else {
  3330.           __Pyx_RaiseArgtupleInvalid("bfs_2", 1, 2, 2, 1); __PYX_ERR(0, 51, __pyx_L3_error)
  3331.         }
  3332.       }
  3333.       if (unlikely(kw_args > 0)) {
  3334.         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bfs_2") < 0)) __PYX_ERR(0, 51, __pyx_L3_error)
  3335.       }
  3336.     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  3337.       goto __pyx_L5_argtuple_error;
  3338.     } else {
  3339.       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3340.       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3341.     }
  3342.     __pyx_v_view = ((PyArrayObject *)values[0]);
  3343.     __pyx_v_start = __pyx_convert_pair_from_py_int__and_int(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error)
  3344.   }
  3345.   goto __pyx_L4_argument_unpacking_done;
  3346.   __pyx_L5_argtuple_error:;
  3347.   __Pyx_RaiseArgtupleInvalid("bfs_2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 51, __pyx_L3_error)
  3348.   __pyx_L3_error:;
  3349.   __Pyx_AddTraceback("bfs.bfs_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3350.   __Pyx_RefNannyFinishContext();
  3351.   return NULL;
  3352.   __pyx_L4_argument_unpacking_done:;
  3353.   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_view), __pyx_ptype_5numpy_ndarray, 1, "view", 0))) __PYX_ERR(0, 51, __pyx_L1_error)
  3354.   __pyx_r = __pyx_pf_3bfs_2bfs_2(__pyx_self, __pyx_v_view, __pyx_v_start);
  3355.  
  3356.   /* function exit code */
  3357.   goto __pyx_L0;
  3358.   __pyx_L1_error:;
  3359.   __pyx_r = NULL;
  3360.   __pyx_L0:;
  3361.   __Pyx_RefNannyFinishContext();
  3362.   return __pyx_r;
  3363. }
  3364.  
  3365. static PyObject *__pyx_pf_3bfs_2bfs_2(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_view, std::pair<int,int>  __pyx_v_start) {
  3366.   PyObject *__pyx_r = NULL;
  3367.   __Pyx_RefNannyDeclarations
  3368.   PyObject *__pyx_t_1 = NULL;
  3369.   int __pyx_lineno = 0;
  3370.   const char *__pyx_filename = NULL;
  3371.   int __pyx_clineno = 0;
  3372.   __Pyx_RefNannySetupContext("bfs_2", 0);
  3373.   __Pyx_XDECREF(__pyx_r);
  3374.   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_3bfs_bfs_2(__pyx_v_view, __pyx_v_start, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  3375.   __Pyx_GOTREF(__pyx_t_1);
  3376.   __pyx_r = __pyx_t_1;
  3377.   __pyx_t_1 = 0;
  3378.   goto __pyx_L0;
  3379.  
  3380.   /* function exit code */
  3381.   __pyx_L1_error:;
  3382.   __Pyx_XDECREF(__pyx_t_1);
  3383.   __Pyx_AddTraceback("bfs.bfs_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3384.   __pyx_r = NULL;
  3385.   __pyx_L0:;
  3386.   __Pyx_XGIVEREF(__pyx_r);
  3387.   __Pyx_RefNannyFinishContext();
  3388.   return __pyx_r;
  3389. }
  3390.  
  3391. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":734
  3392.  * ctypedef npy_cdouble     complex_t
  3393.  *
  3394.  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
  3395.  *     return PyArray_MultiIterNew(1, <void*>a)
  3396.  *
  3397.  */
  3398.  
  3399. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  3400.   PyObject *__pyx_r = NULL;
  3401.   __Pyx_RefNannyDeclarations
  3402.   PyObject *__pyx_t_1 = NULL;
  3403.   int __pyx_lineno = 0;
  3404.   const char *__pyx_filename = NULL;
  3405.   int __pyx_clineno = 0;
  3406.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  3407.  
  3408.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":735
  3409.  *
  3410.  * cdef inline object PyArray_MultiIterNew1(a):
  3411.  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
  3412.  *
  3413.  * cdef inline object PyArray_MultiIterNew2(a, b):
  3414.  */
  3415.   __Pyx_XDECREF(__pyx_r);
  3416.   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error)
  3417.   __Pyx_GOTREF(__pyx_t_1);
  3418.   __pyx_r = __pyx_t_1;
  3419.   __pyx_t_1 = 0;
  3420.   goto __pyx_L0;
  3421.  
  3422.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":734
  3423.  * ctypedef npy_cdouble     complex_t
  3424.  *
  3425.  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
  3426.  *     return PyArray_MultiIterNew(1, <void*>a)
  3427.  *
  3428.  */
  3429.  
  3430.   /* function exit code */
  3431.   __pyx_L1_error:;
  3432.   __Pyx_XDECREF(__pyx_t_1);
  3433.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3434.   __pyx_r = 0;
  3435.   __pyx_L0:;
  3436.   __Pyx_XGIVEREF(__pyx_r);
  3437.   __Pyx_RefNannyFinishContext();
  3438.   return __pyx_r;
  3439. }
  3440.  
  3441. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":737
  3442.  *     return PyArray_MultiIterNew(1, <void*>a)
  3443.  *
  3444.  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
  3445.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3446.  *
  3447.  */
  3448.  
  3449. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  3450.   PyObject *__pyx_r = NULL;
  3451.   __Pyx_RefNannyDeclarations
  3452.   PyObject *__pyx_t_1 = NULL;
  3453.   int __pyx_lineno = 0;
  3454.   const char *__pyx_filename = NULL;
  3455.   int __pyx_clineno = 0;
  3456.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  3457.  
  3458.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":738
  3459.  *
  3460.  * cdef inline object PyArray_MultiIterNew2(a, b):
  3461.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
  3462.  *
  3463.  * cdef inline object PyArray_MultiIterNew3(a, b, c):
  3464.  */
  3465.   __Pyx_XDECREF(__pyx_r);
  3466.   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
  3467.   __Pyx_GOTREF(__pyx_t_1);
  3468.   __pyx_r = __pyx_t_1;
  3469.   __pyx_t_1 = 0;
  3470.   goto __pyx_L0;
  3471.  
  3472.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":737
  3473.  *     return PyArray_MultiIterNew(1, <void*>a)
  3474.  *
  3475.  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
  3476.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3477.  *
  3478.  */
  3479.  
  3480.   /* function exit code */
  3481.   __pyx_L1_error:;
  3482.   __Pyx_XDECREF(__pyx_t_1);
  3483.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3484.   __pyx_r = 0;
  3485.   __pyx_L0:;
  3486.   __Pyx_XGIVEREF(__pyx_r);
  3487.   __Pyx_RefNannyFinishContext();
  3488.   return __pyx_r;
  3489. }
  3490.  
  3491. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":740
  3492.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3493.  *
  3494.  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
  3495.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3496.  *
  3497.  */
  3498.  
  3499. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  3500.   PyObject *__pyx_r = NULL;
  3501.   __Pyx_RefNannyDeclarations
  3502.   PyObject *__pyx_t_1 = NULL;
  3503.   int __pyx_lineno = 0;
  3504.   const char *__pyx_filename = NULL;
  3505.   int __pyx_clineno = 0;
  3506.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  3507.  
  3508.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":741
  3509.  *
  3510.  * cdef inline object PyArray_MultiIterNew3(a, b, c):
  3511.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
  3512.  *
  3513.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  3514.  */
  3515.   __Pyx_XDECREF(__pyx_r);
  3516.   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error)
  3517.   __Pyx_GOTREF(__pyx_t_1);
  3518.   __pyx_r = __pyx_t_1;
  3519.   __pyx_t_1 = 0;
  3520.   goto __pyx_L0;
  3521.  
  3522.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":740
  3523.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3524.  *
  3525.  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
  3526.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3527.  *
  3528.  */
  3529.  
  3530.   /* function exit code */
  3531.   __pyx_L1_error:;
  3532.   __Pyx_XDECREF(__pyx_t_1);
  3533.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3534.   __pyx_r = 0;
  3535.   __pyx_L0:;
  3536.   __Pyx_XGIVEREF(__pyx_r);
  3537.   __Pyx_RefNannyFinishContext();
  3538.   return __pyx_r;
  3539. }
  3540.  
  3541. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":743
  3542.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3543.  *
  3544.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
  3545.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3546.  *
  3547.  */
  3548.  
  3549. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  3550.   PyObject *__pyx_r = NULL;
  3551.   __Pyx_RefNannyDeclarations
  3552.   PyObject *__pyx_t_1 = NULL;
  3553.   int __pyx_lineno = 0;
  3554.   const char *__pyx_filename = NULL;
  3555.   int __pyx_clineno = 0;
  3556.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  3557.  
  3558.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":744
  3559.  *
  3560.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  3561.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
  3562.  *
  3563.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  3564.  */
  3565.   __Pyx_XDECREF(__pyx_r);
  3566.   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 744, __pyx_L1_error)
  3567.   __Pyx_GOTREF(__pyx_t_1);
  3568.   __pyx_r = __pyx_t_1;
  3569.   __pyx_t_1 = 0;
  3570.   goto __pyx_L0;
  3571.  
  3572.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":743
  3573.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3574.  *
  3575.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
  3576.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3577.  *
  3578.  */
  3579.  
  3580.   /* function exit code */
  3581.   __pyx_L1_error:;
  3582.   __Pyx_XDECREF(__pyx_t_1);
  3583.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3584.   __pyx_r = 0;
  3585.   __pyx_L0:;
  3586.   __Pyx_XGIVEREF(__pyx_r);
  3587.   __Pyx_RefNannyFinishContext();
  3588.   return __pyx_r;
  3589. }
  3590.  
  3591. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":746
  3592.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3593.  *
  3594.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
  3595.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3596.  *
  3597.  */
  3598.  
  3599. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  3600.   PyObject *__pyx_r = NULL;
  3601.   __Pyx_RefNannyDeclarations
  3602.   PyObject *__pyx_t_1 = NULL;
  3603.   int __pyx_lineno = 0;
  3604.   const char *__pyx_filename = NULL;
  3605.   int __pyx_clineno = 0;
  3606.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  3607.  
  3608.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":747
  3609.  *
  3610.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  3611.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
  3612.  *
  3613.  * cdef inline tuple PyDataType_SHAPE(dtype d):
  3614.  */
  3615.   __Pyx_XDECREF(__pyx_r);
  3616.   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 747, __pyx_L1_error)
  3617.   __Pyx_GOTREF(__pyx_t_1);
  3618.   __pyx_r = __pyx_t_1;
  3619.   __pyx_t_1 = 0;
  3620.   goto __pyx_L0;
  3621.  
  3622.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":746
  3623.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3624.  *
  3625.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
  3626.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3627.  *
  3628.  */
  3629.  
  3630.   /* function exit code */
  3631.   __pyx_L1_error:;
  3632.   __Pyx_XDECREF(__pyx_t_1);
  3633.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3634.   __pyx_r = 0;
  3635.   __pyx_L0:;
  3636.   __Pyx_XGIVEREF(__pyx_r);
  3637.   __Pyx_RefNannyFinishContext();
  3638.   return __pyx_r;
  3639. }
  3640.  
  3641. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":749
  3642.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3643.  *
  3644.  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
  3645.  *     if PyDataType_HASSUBARRAY(d):
  3646.  *         return <tuple>d.subarray.shape
  3647.  */
  3648.  
  3649. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  3650.   PyObject *__pyx_r = NULL;
  3651.   __Pyx_RefNannyDeclarations
  3652.   int __pyx_t_1;
  3653.   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
  3654.  
  3655.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":750
  3656.  *
  3657.  * cdef inline tuple PyDataType_SHAPE(dtype d):
  3658.  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
  3659.  *         return <tuple>d.subarray.shape
  3660.  *     else:
  3661.  */
  3662.   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  3663.   if (__pyx_t_1) {
  3664.  
  3665.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":751
  3666.  * cdef inline tuple PyDataType_SHAPE(dtype d):
  3667.  *     if PyDataType_HASSUBARRAY(d):
  3668.  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
  3669.  *     else:
  3670.  *         return ()
  3671.  */
  3672.     __Pyx_XDECREF(__pyx_r);
  3673.     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
  3674.     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
  3675.     goto __pyx_L0;
  3676.  
  3677.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":750
  3678.  *
  3679.  * cdef inline tuple PyDataType_SHAPE(dtype d):
  3680.  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
  3681.  *         return <tuple>d.subarray.shape
  3682.  *     else:
  3683.  */
  3684.   }
  3685.  
  3686.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":753
  3687.  *         return <tuple>d.subarray.shape
  3688.  *     else:
  3689.  *         return ()             # <<<<<<<<<<<<<<
  3690.  *
  3691.  *
  3692.  */
  3693.   /*else*/ {
  3694.     __Pyx_XDECREF(__pyx_r);
  3695.     __Pyx_INCREF(__pyx_empty_tuple);
  3696.     __pyx_r = __pyx_empty_tuple;
  3697.     goto __pyx_L0;
  3698.   }
  3699.  
  3700.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":749
  3701.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3702.  *
  3703.  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
  3704.  *     if PyDataType_HASSUBARRAY(d):
  3705.  *         return <tuple>d.subarray.shape
  3706.  */
  3707.  
  3708.   /* function exit code */
  3709.   __pyx_L0:;
  3710.   __Pyx_XGIVEREF(__pyx_r);
  3711.   __Pyx_RefNannyFinishContext();
  3712.   return __pyx_r;
  3713. }
  3714.  
  3715. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":928
  3716.  *     int _import_umath() except -1
  3717.  *
  3718.  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
  3719.  *     Py_INCREF(base) # important to do this before stealing the reference below!
  3720.  *     PyArray_SetBaseObject(arr, base)
  3721.  */
  3722.  
  3723. static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  3724.   __Pyx_RefNannyDeclarations
  3725.   __Pyx_RefNannySetupContext("set_array_base", 0);
  3726.  
  3727.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":929
  3728.  *
  3729.  * cdef inline void set_array_base(ndarray arr, object base):
  3730.  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
  3731.  *     PyArray_SetBaseObject(arr, base)
  3732.  *
  3733.  */
  3734.   Py_INCREF(__pyx_v_base);
  3735.  
  3736.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":930
  3737.  * cdef inline void set_array_base(ndarray arr, object base):
  3738.  *     Py_INCREF(base) # important to do this before stealing the reference below!
  3739.  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
  3740.  *
  3741.  * cdef inline object get_array_base(ndarray arr):
  3742.  */
  3743.   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
  3744.  
  3745.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":928
  3746.  *     int _import_umath() except -1
  3747.  *
  3748.  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
  3749.  *     Py_INCREF(base) # important to do this before stealing the reference below!
  3750.  *     PyArray_SetBaseObject(arr, base)
  3751.  */
  3752.  
  3753.   /* function exit code */
  3754.   __Pyx_RefNannyFinishContext();
  3755. }
  3756.  
  3757. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":932
  3758.  *     PyArray_SetBaseObject(arr, base)
  3759.  *
  3760.  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
  3761.  *     base = PyArray_BASE(arr)
  3762.  *     if base is NULL:
  3763.  */
  3764.  
  3765. static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  3766.   PyObject *__pyx_v_base;
  3767.   PyObject *__pyx_r = NULL;
  3768.   __Pyx_RefNannyDeclarations
  3769.   int __pyx_t_1;
  3770.   __Pyx_RefNannySetupContext("get_array_base", 0);
  3771.  
  3772.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":933
  3773.  *
  3774.  * cdef inline object get_array_base(ndarray arr):
  3775.  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
  3776.  *     if base is NULL:
  3777.  *         return None
  3778.  */
  3779.   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
  3780.  
  3781.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":934
  3782.  * cdef inline object get_array_base(ndarray arr):
  3783.  *     base = PyArray_BASE(arr)
  3784.  *     if base is NULL:             # <<<<<<<<<<<<<<
  3785.  *         return None
  3786.  *     return <object>base
  3787.  */
  3788.   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  3789.   if (__pyx_t_1) {
  3790.  
  3791.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":935
  3792.  *     base = PyArray_BASE(arr)
  3793.  *     if base is NULL:
  3794.  *         return None             # <<<<<<<<<<<<<<
  3795.  *     return <object>base
  3796.  *
  3797.  */
  3798.     __Pyx_XDECREF(__pyx_r);
  3799.     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3800.     goto __pyx_L0;
  3801.  
  3802.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":934
  3803.  * cdef inline object get_array_base(ndarray arr):
  3804.  *     base = PyArray_BASE(arr)
  3805.  *     if base is NULL:             # <<<<<<<<<<<<<<
  3806.  *         return None
  3807.  *     return <object>base
  3808.  */
  3809.   }
  3810.  
  3811.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":936
  3812.  *     if base is NULL:
  3813.  *         return None
  3814.  *     return <object>base             # <<<<<<<<<<<<<<
  3815.  *
  3816.  * # Versions of the import_* functions which are more suitable for
  3817.  */
  3818.   __Pyx_XDECREF(__pyx_r);
  3819.   __Pyx_INCREF(((PyObject *)__pyx_v_base));
  3820.   __pyx_r = ((PyObject *)__pyx_v_base);
  3821.   goto __pyx_L0;
  3822.  
  3823.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":932
  3824.  *     PyArray_SetBaseObject(arr, base)
  3825.  *
  3826.  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
  3827.  *     base = PyArray_BASE(arr)
  3828.  *     if base is NULL:
  3829.  */
  3830.  
  3831.   /* function exit code */
  3832.   __pyx_L0:;
  3833.   __Pyx_XGIVEREF(__pyx_r);
  3834.   __Pyx_RefNannyFinishContext();
  3835.   return __pyx_r;
  3836. }
  3837.  
  3838. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":940
  3839.  * # Versions of the import_* functions which are more suitable for
  3840.  * # Cython code.
  3841.  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
  3842.  *     try:
  3843.  *         __pyx_import_array()
  3844.  */
  3845.  
  3846. static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  3847.   int __pyx_r;
  3848.   __Pyx_RefNannyDeclarations
  3849.   PyObject *__pyx_t_1 = NULL;
  3850.   PyObject *__pyx_t_2 = NULL;
  3851.   PyObject *__pyx_t_3 = NULL;
  3852.   int __pyx_t_4;
  3853.   PyObject *__pyx_t_5 = NULL;
  3854.   PyObject *__pyx_t_6 = NULL;
  3855.   PyObject *__pyx_t_7 = NULL;
  3856.   PyObject *__pyx_t_8 = NULL;
  3857.   int __pyx_lineno = 0;
  3858.   const char *__pyx_filename = NULL;
  3859.   int __pyx_clineno = 0;
  3860.   __Pyx_RefNannySetupContext("import_array", 0);
  3861.  
  3862.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":941
  3863.  * # Cython code.
  3864.  * cdef inline int import_array() except -1:
  3865.  *     try:             # <<<<<<<<<<<<<<
  3866.  *         __pyx_import_array()
  3867.  *     except Exception:
  3868.  */
  3869.   {
  3870.     __Pyx_PyThreadState_declare
  3871.     __Pyx_PyThreadState_assign
  3872.     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  3873.     __Pyx_XGOTREF(__pyx_t_1);
  3874.     __Pyx_XGOTREF(__pyx_t_2);
  3875.     __Pyx_XGOTREF(__pyx_t_3);
  3876.     /*try:*/ {
  3877.  
  3878.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":942
  3879.  * cdef inline int import_array() except -1:
  3880.  *     try:
  3881.  *         __pyx_import_array()             # <<<<<<<<<<<<<<
  3882.  *     except Exception:
  3883.  *         raise ImportError("numpy.core.multiarray failed to import")
  3884.  */
  3885.       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error)
  3886.  
  3887.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":941
  3888.  * # Cython code.
  3889.  * cdef inline int import_array() except -1:
  3890.  *     try:             # <<<<<<<<<<<<<<
  3891.  *         __pyx_import_array()
  3892.  *     except Exception:
  3893.  */
  3894.     }
  3895.     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  3896.     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3897.     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3898.     goto __pyx_L8_try_end;
  3899.     __pyx_L3_error:;
  3900.  
  3901.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":943
  3902.  *     try:
  3903.  *         __pyx_import_array()
  3904.  *     except Exception:             # <<<<<<<<<<<<<<
  3905.  *         raise ImportError("numpy.core.multiarray failed to import")
  3906.  *
  3907.  */
  3908.     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  3909.     if (__pyx_t_4) {
  3910.       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3911.       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error)
  3912.       __Pyx_GOTREF(__pyx_t_5);
  3913.       __Pyx_GOTREF(__pyx_t_6);
  3914.       __Pyx_GOTREF(__pyx_t_7);
  3915.  
  3916.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":944
  3917.  *         __pyx_import_array()
  3918.  *     except Exception:
  3919.  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
  3920.  *
  3921.  * cdef inline int import_umath() except -1:
  3922.  */
  3923.       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error)
  3924.       __Pyx_GOTREF(__pyx_t_8);
  3925.       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  3926.       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3927.       __PYX_ERR(1, 944, __pyx_L5_except_error)
  3928.     }
  3929.     goto __pyx_L5_except_error;
  3930.     __pyx_L5_except_error:;
  3931.  
  3932.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":941
  3933.  * # Cython code.
  3934.  * cdef inline int import_array() except -1:
  3935.  *     try:             # <<<<<<<<<<<<<<
  3936.  *         __pyx_import_array()
  3937.  *     except Exception:
  3938.  */
  3939.     __Pyx_XGIVEREF(__pyx_t_1);
  3940.     __Pyx_XGIVEREF(__pyx_t_2);
  3941.     __Pyx_XGIVEREF(__pyx_t_3);
  3942.     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3943.     goto __pyx_L1_error;
  3944.     __pyx_L8_try_end:;
  3945.   }
  3946.  
  3947.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":940
  3948.  * # Versions of the import_* functions which are more suitable for
  3949.  * # Cython code.
  3950.  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
  3951.  *     try:
  3952.  *         __pyx_import_array()
  3953.  */
  3954.  
  3955.   /* function exit code */
  3956.   __pyx_r = 0;
  3957.   goto __pyx_L0;
  3958.   __pyx_L1_error:;
  3959.   __Pyx_XDECREF(__pyx_t_5);
  3960.   __Pyx_XDECREF(__pyx_t_6);
  3961.   __Pyx_XDECREF(__pyx_t_7);
  3962.   __Pyx_XDECREF(__pyx_t_8);
  3963.   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3964.   __pyx_r = -1;
  3965.   __pyx_L0:;
  3966.   __Pyx_RefNannyFinishContext();
  3967.   return __pyx_r;
  3968. }
  3969.  
  3970. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":946
  3971.  *         raise ImportError("numpy.core.multiarray failed to import")
  3972.  *
  3973.  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
  3974.  *     try:
  3975.  *         _import_umath()
  3976.  */
  3977.  
  3978. static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  3979.   int __pyx_r;
  3980.   __Pyx_RefNannyDeclarations
  3981.   PyObject *__pyx_t_1 = NULL;
  3982.   PyObject *__pyx_t_2 = NULL;
  3983.   PyObject *__pyx_t_3 = NULL;
  3984.   int __pyx_t_4;
  3985.   PyObject *__pyx_t_5 = NULL;
  3986.   PyObject *__pyx_t_6 = NULL;
  3987.   PyObject *__pyx_t_7 = NULL;
  3988.   PyObject *__pyx_t_8 = NULL;
  3989.   int __pyx_lineno = 0;
  3990.   const char *__pyx_filename = NULL;
  3991.   int __pyx_clineno = 0;
  3992.   __Pyx_RefNannySetupContext("import_umath", 0);
  3993.  
  3994.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":947
  3995.  *
  3996.  * cdef inline int import_umath() except -1:
  3997.  *     try:             # <<<<<<<<<<<<<<
  3998.  *         _import_umath()
  3999.  *     except Exception:
  4000.  */
  4001.   {
  4002.     __Pyx_PyThreadState_declare
  4003.     __Pyx_PyThreadState_assign
  4004.     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4005.     __Pyx_XGOTREF(__pyx_t_1);
  4006.     __Pyx_XGOTREF(__pyx_t_2);
  4007.     __Pyx_XGOTREF(__pyx_t_3);
  4008.     /*try:*/ {
  4009.  
  4010.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":948
  4011.  * cdef inline int import_umath() except -1:
  4012.  *     try:
  4013.  *         _import_umath()             # <<<<<<<<<<<<<<
  4014.  *     except Exception:
  4015.  *         raise ImportError("numpy.core.umath failed to import")
  4016.  */
  4017.       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error)
  4018.  
  4019.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":947
  4020.  *
  4021.  * cdef inline int import_umath() except -1:
  4022.  *     try:             # <<<<<<<<<<<<<<
  4023.  *         _import_umath()
  4024.  *     except Exception:
  4025.  */
  4026.     }
  4027.     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4028.     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4029.     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4030.     goto __pyx_L8_try_end;
  4031.     __pyx_L3_error:;
  4032.  
  4033.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":949
  4034.  *     try:
  4035.  *         _import_umath()
  4036.  *     except Exception:             # <<<<<<<<<<<<<<
  4037.  *         raise ImportError("numpy.core.umath failed to import")
  4038.  *
  4039.  */
  4040.     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  4041.     if (__pyx_t_4) {
  4042.       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4043.       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error)
  4044.       __Pyx_GOTREF(__pyx_t_5);
  4045.       __Pyx_GOTREF(__pyx_t_6);
  4046.       __Pyx_GOTREF(__pyx_t_7);
  4047.  
  4048.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":950
  4049.  *         _import_umath()
  4050.  *     except Exception:
  4051.  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
  4052.  *
  4053.  * cdef inline int import_ufunc() except -1:
  4054.  */
  4055.       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error)
  4056.       __Pyx_GOTREF(__pyx_t_8);
  4057.       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  4058.       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4059.       __PYX_ERR(1, 950, __pyx_L5_except_error)
  4060.     }
  4061.     goto __pyx_L5_except_error;
  4062.     __pyx_L5_except_error:;
  4063.  
  4064.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":947
  4065.  *
  4066.  * cdef inline int import_umath() except -1:
  4067.  *     try:             # <<<<<<<<<<<<<<
  4068.  *         _import_umath()
  4069.  *     except Exception:
  4070.  */
  4071.     __Pyx_XGIVEREF(__pyx_t_1);
  4072.     __Pyx_XGIVEREF(__pyx_t_2);
  4073.     __Pyx_XGIVEREF(__pyx_t_3);
  4074.     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4075.     goto __pyx_L1_error;
  4076.     __pyx_L8_try_end:;
  4077.   }
  4078.  
  4079.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":946
  4080.  *         raise ImportError("numpy.core.multiarray failed to import")
  4081.  *
  4082.  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
  4083.  *     try:
  4084.  *         _import_umath()
  4085.  */
  4086.  
  4087.   /* function exit code */
  4088.   __pyx_r = 0;
  4089.   goto __pyx_L0;
  4090.   __pyx_L1_error:;
  4091.   __Pyx_XDECREF(__pyx_t_5);
  4092.   __Pyx_XDECREF(__pyx_t_6);
  4093.   __Pyx_XDECREF(__pyx_t_7);
  4094.   __Pyx_XDECREF(__pyx_t_8);
  4095.   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4096.   __pyx_r = -1;
  4097.   __pyx_L0:;
  4098.   __Pyx_RefNannyFinishContext();
  4099.   return __pyx_r;
  4100. }
  4101.  
  4102. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":952
  4103.  *         raise ImportError("numpy.core.umath failed to import")
  4104.  *
  4105.  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
  4106.  *     try:
  4107.  *         _import_umath()
  4108.  */
  4109.  
  4110. static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  4111.   int __pyx_r;
  4112.   __Pyx_RefNannyDeclarations
  4113.   PyObject *__pyx_t_1 = NULL;
  4114.   PyObject *__pyx_t_2 = NULL;
  4115.   PyObject *__pyx_t_3 = NULL;
  4116.   int __pyx_t_4;
  4117.   PyObject *__pyx_t_5 = NULL;
  4118.   PyObject *__pyx_t_6 = NULL;
  4119.   PyObject *__pyx_t_7 = NULL;
  4120.   PyObject *__pyx_t_8 = NULL;
  4121.   int __pyx_lineno = 0;
  4122.   const char *__pyx_filename = NULL;
  4123.   int __pyx_clineno = 0;
  4124.   __Pyx_RefNannySetupContext("import_ufunc", 0);
  4125.  
  4126.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":953
  4127.  *
  4128.  * cdef inline int import_ufunc() except -1:
  4129.  *     try:             # <<<<<<<<<<<<<<
  4130.  *         _import_umath()
  4131.  *     except Exception:
  4132.  */
  4133.   {
  4134.     __Pyx_PyThreadState_declare
  4135.     __Pyx_PyThreadState_assign
  4136.     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4137.     __Pyx_XGOTREF(__pyx_t_1);
  4138.     __Pyx_XGOTREF(__pyx_t_2);
  4139.     __Pyx_XGOTREF(__pyx_t_3);
  4140.     /*try:*/ {
  4141.  
  4142.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":954
  4143.  * cdef inline int import_ufunc() except -1:
  4144.  *     try:
  4145.  *         _import_umath()             # <<<<<<<<<<<<<<
  4146.  *     except Exception:
  4147.  *         raise ImportError("numpy.core.umath failed to import")
  4148.  */
  4149.       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error)
  4150.  
  4151.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":953
  4152.  *
  4153.  * cdef inline int import_ufunc() except -1:
  4154.  *     try:             # <<<<<<<<<<<<<<
  4155.  *         _import_umath()
  4156.  *     except Exception:
  4157.  */
  4158.     }
  4159.     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4160.     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4161.     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4162.     goto __pyx_L8_try_end;
  4163.     __pyx_L3_error:;
  4164.  
  4165.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":955
  4166.  *     try:
  4167.  *         _import_umath()
  4168.  *     except Exception:             # <<<<<<<<<<<<<<
  4169.  *         raise ImportError("numpy.core.umath failed to import")
  4170.  *
  4171.  */
  4172.     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  4173.     if (__pyx_t_4) {
  4174.       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4175.       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error)
  4176.       __Pyx_GOTREF(__pyx_t_5);
  4177.       __Pyx_GOTREF(__pyx_t_6);
  4178.       __Pyx_GOTREF(__pyx_t_7);
  4179.  
  4180.       /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":956
  4181.  *         _import_umath()
  4182.  *     except Exception:
  4183.  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
  4184.  *
  4185.  * cdef extern from *:
  4186.  */
  4187.       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error)
  4188.       __Pyx_GOTREF(__pyx_t_8);
  4189.       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  4190.       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4191.       __PYX_ERR(1, 956, __pyx_L5_except_error)
  4192.     }
  4193.     goto __pyx_L5_except_error;
  4194.     __pyx_L5_except_error:;
  4195.  
  4196.     /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":953
  4197.  *
  4198.  * cdef inline int import_ufunc() except -1:
  4199.  *     try:             # <<<<<<<<<<<<<<
  4200.  *         _import_umath()
  4201.  *     except Exception:
  4202.  */
  4203.     __Pyx_XGIVEREF(__pyx_t_1);
  4204.     __Pyx_XGIVEREF(__pyx_t_2);
  4205.     __Pyx_XGIVEREF(__pyx_t_3);
  4206.     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4207.     goto __pyx_L1_error;
  4208.     __pyx_L8_try_end:;
  4209.   }
  4210.  
  4211.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":952
  4212.  *         raise ImportError("numpy.core.umath failed to import")
  4213.  *
  4214.  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
  4215.  *     try:
  4216.  *         _import_umath()
  4217.  */
  4218.  
  4219.   /* function exit code */
  4220.   __pyx_r = 0;
  4221.   goto __pyx_L0;
  4222.   __pyx_L1_error:;
  4223.   __Pyx_XDECREF(__pyx_t_5);
  4224.   __Pyx_XDECREF(__pyx_t_6);
  4225.   __Pyx_XDECREF(__pyx_t_7);
  4226.   __Pyx_XDECREF(__pyx_t_8);
  4227.   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4228.   __pyx_r = -1;
  4229.   __pyx_L0:;
  4230.   __Pyx_RefNannyFinishContext();
  4231.   return __pyx_r;
  4232. }
  4233.  
  4234. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":966
  4235.  *
  4236.  *
  4237.  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
  4238.  *     """
  4239.  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
  4240.  */
  4241.  
  4242. static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
  4243.   int __pyx_r;
  4244.   __Pyx_RefNannyDeclarations
  4245.   __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
  4246.  
  4247.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":978
  4248.  *     bool
  4249.  *     """
  4250.  *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
  4251.  *
  4252.  *
  4253.  */
  4254.   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
  4255.   goto __pyx_L0;
  4256.  
  4257.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":966
  4258.  *
  4259.  *
  4260.  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
  4261.  *     """
  4262.  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
  4263.  */
  4264.  
  4265.   /* function exit code */
  4266.   __pyx_L0:;
  4267.   __Pyx_RefNannyFinishContext();
  4268.   return __pyx_r;
  4269. }
  4270.  
  4271. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":981
  4272.  *
  4273.  *
  4274.  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
  4275.  *     """
  4276.  *     Cython equivalent of `isinstance(obj, np.datetime64)`
  4277.  */
  4278.  
  4279. static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
  4280.   int __pyx_r;
  4281.   __Pyx_RefNannyDeclarations
  4282.   __Pyx_RefNannySetupContext("is_datetime64_object", 0);
  4283.  
  4284.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":993
  4285.  *     bool
  4286.  *     """
  4287.  *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
  4288.  *
  4289.  *
  4290.  */
  4291.   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
  4292.   goto __pyx_L0;
  4293.  
  4294.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":981
  4295.  *
  4296.  *
  4297.  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
  4298.  *     """
  4299.  *     Cython equivalent of `isinstance(obj, np.datetime64)`
  4300.  */
  4301.  
  4302.   /* function exit code */
  4303.   __pyx_L0:;
  4304.   __Pyx_RefNannyFinishContext();
  4305.   return __pyx_r;
  4306. }
  4307.  
  4308. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":996
  4309.  *
  4310.  *
  4311.  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
  4312.  *     """
  4313.  *     returns the int64 value underlying scalar numpy datetime64 object
  4314.  */
  4315.  
  4316. static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
  4317.   npy_datetime __pyx_r;
  4318.  
  4319.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1003
  4320.  *     also needed.  That can be found using `get_datetime64_unit`.
  4321.  *     """
  4322.  *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
  4323.  *
  4324.  *
  4325.  */
  4326.   __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
  4327.   goto __pyx_L0;
  4328.  
  4329.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":996
  4330.  *
  4331.  *
  4332.  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
  4333.  *     """
  4334.  *     returns the int64 value underlying scalar numpy datetime64 object
  4335.  */
  4336.  
  4337.   /* function exit code */
  4338.   __pyx_L0:;
  4339.   return __pyx_r;
  4340. }
  4341.  
  4342. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1006
  4343.  *
  4344.  *
  4345.  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
  4346.  *     """
  4347.  *     returns the int64 value underlying scalar numpy timedelta64 object
  4348.  */
  4349.  
  4350. static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
  4351.   npy_timedelta __pyx_r;
  4352.  
  4353.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1010
  4354.  *     returns the int64 value underlying scalar numpy timedelta64 object
  4355.  *     """
  4356.  *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
  4357.  *
  4358.  *
  4359.  */
  4360.   __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
  4361.   goto __pyx_L0;
  4362.  
  4363.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1006
  4364.  *
  4365.  *
  4366.  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
  4367.  *     """
  4368.  *     returns the int64 value underlying scalar numpy timedelta64 object
  4369.  */
  4370.  
  4371.   /* function exit code */
  4372.   __pyx_L0:;
  4373.   return __pyx_r;
  4374. }
  4375.  
  4376. /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1013
  4377.  *
  4378.  *
  4379.  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
  4380.  *     """
  4381.  *     returns the unit part of the dtype for a numpy datetime64 object.
  4382.  */
  4383.  
  4384. static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
  4385.   NPY_DATETIMEUNIT __pyx_r;
  4386.  
  4387.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1017
  4388.  *     returns the unit part of the dtype for a numpy datetime64 object.
  4389.  *     """
  4390.  *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
  4391.  */
  4392.   __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
  4393.   goto __pyx_L0;
  4394.  
  4395.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":1013
  4396.  *
  4397.  *
  4398.  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
  4399.  *     """
  4400.  *     returns the unit part of the dtype for a numpy datetime64 object.
  4401.  */
  4402.  
  4403.   /* function exit code */
  4404.   __pyx_L0:;
  4405.   return __pyx_r;
  4406. }
  4407.  
  4408. /* "pair.from_py":145
  4409.  *
  4410.  * @cname("__pyx_convert_pair_from_py_int__and_int")
  4411.  * cdef pair[X,Y] __pyx_convert_pair_from_py_int__and_int(object o) except *:             # <<<<<<<<<<<<<<
  4412.  *     x, y = o
  4413.  *     return pair[X,Y](<X>x, <Y>y)
  4414.  */
  4415.  
  4416. static std::pair<int,int>  __pyx_convert_pair_from_py_int__and_int(PyObject *__pyx_v_o) {
  4417.   PyObject *__pyx_v_x = NULL;
  4418.   PyObject *__pyx_v_y = NULL;
  4419.   std::pair<int,int>  __pyx_r;
  4420.   __Pyx_RefNannyDeclarations
  4421.   PyObject *__pyx_t_1 = NULL;
  4422.   PyObject *__pyx_t_2 = NULL;
  4423.   PyObject *__pyx_t_3 = NULL;
  4424.   PyObject *(*__pyx_t_4)(PyObject *);
  4425.   int __pyx_t_5;
  4426.   int __pyx_t_6;
  4427.   int __pyx_lineno = 0;
  4428.   const char *__pyx_filename = NULL;
  4429.   int __pyx_clineno = 0;
  4430.   __Pyx_RefNannySetupContext("__pyx_convert_pair_from_py_int__and_int", 0);
  4431.  
  4432.   /* "pair.from_py":146
  4433.  * @cname("__pyx_convert_pair_from_py_int__and_int")
  4434.  * cdef pair[X,Y] __pyx_convert_pair_from_py_int__and_int(object o) except *:
  4435.  *     x, y = o             # <<<<<<<<<<<<<<
  4436.  *     return pair[X,Y](<X>x, <Y>y)
  4437.  *
  4438.  */
  4439.   if ((likely(PyTuple_CheckExact(__pyx_v_o))) || (PyList_CheckExact(__pyx_v_o))) {
  4440.     PyObject* sequence = __pyx_v_o;
  4441.     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4442.     if (unlikely(size != 2)) {
  4443.       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4444.       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4445.       __PYX_ERR(2, 146, __pyx_L1_error)
  4446.     }
  4447.     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4448.     if (likely(PyTuple_CheckExact(sequence))) {
  4449.       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  4450.       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  4451.     } else {
  4452.       __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
  4453.       __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
  4454.     }
  4455.     __Pyx_INCREF(__pyx_t_1);
  4456.     __Pyx_INCREF(__pyx_t_2);
  4457.     #else
  4458.     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 146, __pyx_L1_error)
  4459.     __Pyx_GOTREF(__pyx_t_1);
  4460.     __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 146, __pyx_L1_error)
  4461.     __Pyx_GOTREF(__pyx_t_2);
  4462.     #endif
  4463.   } else {
  4464.     Py_ssize_t index = -1;
  4465.     __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 146, __pyx_L1_error)
  4466.     __Pyx_GOTREF(__pyx_t_3);
  4467.     __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
  4468.     index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  4469.     __Pyx_GOTREF(__pyx_t_1);
  4470.     index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  4471.     __Pyx_GOTREF(__pyx_t_2);
  4472.     if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(2, 146, __pyx_L1_error)
  4473.     __pyx_t_4 = NULL;
  4474.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4475.     goto __pyx_L4_unpacking_done;
  4476.     __pyx_L3_unpacking_failed:;
  4477.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4478.     __pyx_t_4 = NULL;
  4479.     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4480.     __PYX_ERR(2, 146, __pyx_L1_error)
  4481.     __pyx_L4_unpacking_done:;
  4482.   }
  4483.   __pyx_v_x = __pyx_t_1;
  4484.   __pyx_t_1 = 0;
  4485.   __pyx_v_y = __pyx_t_2;
  4486.   __pyx_t_2 = 0;
  4487.  
  4488.   /* "pair.from_py":147
  4489.  * cdef pair[X,Y] __pyx_convert_pair_from_py_int__and_int(object o) except *:
  4490.  *     x, y = o
  4491.  *     return pair[X,Y](<X>x, <Y>y)             # <<<<<<<<<<<<<<
  4492.  *
  4493.  *
  4494.  */
  4495.   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_x); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 147, __pyx_L1_error)
  4496.   __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_y); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 147, __pyx_L1_error)
  4497.   __pyx_r = std::pair<int,int> (((int)__pyx_t_5), ((int)__pyx_t_6));
  4498.   goto __pyx_L0;
  4499.  
  4500.   /* "pair.from_py":145
  4501.  *
  4502.  * @cname("__pyx_convert_pair_from_py_int__and_int")
  4503.  * cdef pair[X,Y] __pyx_convert_pair_from_py_int__and_int(object o) except *:             # <<<<<<<<<<<<<<
  4504.  *     x, y = o
  4505.  *     return pair[X,Y](<X>x, <Y>y)
  4506.  */
  4507.  
  4508.   /* function exit code */
  4509.   __pyx_L1_error:;
  4510.   __Pyx_XDECREF(__pyx_t_1);
  4511.   __Pyx_XDECREF(__pyx_t_2);
  4512.   __Pyx_XDECREF(__pyx_t_3);
  4513.   __Pyx_AddTraceback("pair.from_py.__pyx_convert_pair_from_py_int__and_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4514.   __Pyx_pretend_to_initialize(&__pyx_r);
  4515.   __pyx_L0:;
  4516.   __Pyx_XDECREF(__pyx_v_x);
  4517.   __Pyx_XDECREF(__pyx_v_y);
  4518.   __Pyx_RefNannyFinishContext();
  4519.   return __pyx_r;
  4520. }
  4521.  
  4522. /* "list.from_py":71
  4523.  *
  4524.  * @cname("__pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___")
  4525.  * cdef cpp_list[X] __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(object o) except *:             # <<<<<<<<<<<<<<
  4526.  *     cdef cpp_list[X] l
  4527.  *     for item in o:
  4528.  */
  4529.  
  4530. static std::list<std::pair<int,int> >  __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(PyObject *__pyx_v_o) {
  4531.   std::list<std::pair<int,int> >  __pyx_v_l;
  4532.   PyObject *__pyx_v_item = NULL;
  4533.   std::list<std::pair<int,int> >  __pyx_r;
  4534.   __Pyx_RefNannyDeclarations
  4535.   PyObject *__pyx_t_1 = NULL;
  4536.   Py_ssize_t __pyx_t_2;
  4537.   PyObject *(*__pyx_t_3)(PyObject *);
  4538.   PyObject *__pyx_t_4 = NULL;
  4539.   std::pair<int,int>  __pyx_t_5;
  4540.   int __pyx_lineno = 0;
  4541.   const char *__pyx_filename = NULL;
  4542.   int __pyx_clineno = 0;
  4543.   __Pyx_RefNannySetupContext("__pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___", 0);
  4544.  
  4545.   /* "list.from_py":73
  4546.  * cdef cpp_list[X] __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(object o) except *:
  4547.  *     cdef cpp_list[X] l
  4548.  *     for item in o:             # <<<<<<<<<<<<<<
  4549.  *         l.push_back(<X>item)
  4550.  *     return l
  4551.  */
  4552.   if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
  4553.     __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  4554.     __pyx_t_3 = NULL;
  4555.   } else {
  4556.     __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 73, __pyx_L1_error)
  4557.     __Pyx_GOTREF(__pyx_t_1);
  4558.     __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 73, __pyx_L1_error)
  4559.   }
  4560.   for (;;) {
  4561.     if (likely(!__pyx_t_3)) {
  4562.       if (likely(PyList_CheckExact(__pyx_t_1))) {
  4563.         if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
  4564.         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4565.         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 73, __pyx_L1_error)
  4566.         #else
  4567.         __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 73, __pyx_L1_error)
  4568.         __Pyx_GOTREF(__pyx_t_4);
  4569.         #endif
  4570.       } else {
  4571.         if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  4572.         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4573.         __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 73, __pyx_L1_error)
  4574.         #else
  4575.         __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 73, __pyx_L1_error)
  4576.         __Pyx_GOTREF(__pyx_t_4);
  4577.         #endif
  4578.       }
  4579.     } else {
  4580.       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  4581.       if (unlikely(!__pyx_t_4)) {
  4582.         PyObject* exc_type = PyErr_Occurred();
  4583.         if (exc_type) {
  4584.           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  4585.           else __PYX_ERR(2, 73, __pyx_L1_error)
  4586.         }
  4587.         break;
  4588.       }
  4589.       __Pyx_GOTREF(__pyx_t_4);
  4590.     }
  4591.     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
  4592.     __pyx_t_4 = 0;
  4593.  
  4594.     /* "list.from_py":74
  4595.  *     cdef cpp_list[X] l
  4596.  *     for item in o:
  4597.  *         l.push_back(<X>item)             # <<<<<<<<<<<<<<
  4598.  *     return l
  4599.  *
  4600.  */
  4601.     __pyx_t_5 = __pyx_convert_pair_from_py_int__and_int(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 74, __pyx_L1_error)
  4602.     __pyx_v_l.push_back(((std::pair<int,int> )__pyx_t_5));
  4603.  
  4604.     /* "list.from_py":73
  4605.  * cdef cpp_list[X] __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(object o) except *:
  4606.  *     cdef cpp_list[X] l
  4607.  *     for item in o:             # <<<<<<<<<<<<<<
  4608.  *         l.push_back(<X>item)
  4609.  *     return l
  4610.  */
  4611.   }
  4612.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4613.  
  4614.   /* "list.from_py":75
  4615.  *     for item in o:
  4616.  *         l.push_back(<X>item)
  4617.  *     return l             # <<<<<<<<<<<<<<
  4618.  *
  4619.  *
  4620.  */
  4621.   __pyx_r = __pyx_v_l;
  4622.   goto __pyx_L0;
  4623.  
  4624.   /* "list.from_py":71
  4625.  *
  4626.  * @cname("__pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___")
  4627.  * cdef cpp_list[X] __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(object o) except *:             # <<<<<<<<<<<<<<
  4628.  *     cdef cpp_list[X] l
  4629.  *     for item in o:
  4630.  */
  4631.  
  4632.   /* function exit code */
  4633.   __pyx_L1_error:;
  4634.   __Pyx_XDECREF(__pyx_t_1);
  4635.   __Pyx_XDECREF(__pyx_t_4);
  4636.   __Pyx_AddTraceback("list.from_py.__pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4637.   __Pyx_pretend_to_initialize(&__pyx_r);
  4638.   __pyx_L0:;
  4639.   __Pyx_XDECREF(__pyx_v_item);
  4640.   __Pyx_RefNannyFinishContext();
  4641.   return __pyx_r;
  4642. }
  4643.  
  4644. static PyMethodDef __pyx_methods[] = {
  4645.   {"bfs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3bfs_1bfs, METH_VARARGS|METH_KEYWORDS, 0},
  4646.   {"bfs_2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3bfs_3bfs_2, METH_VARARGS|METH_KEYWORDS, 0},
  4647.   {0, 0, 0, 0}
  4648. };
  4649.  
  4650. #if PY_MAJOR_VERSION >= 3
  4651. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4652. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  4653. static int __pyx_pymod_exec_bfs(PyObject* module); /*proto*/
  4654. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  4655.   {Py_mod_create, (void*)__pyx_pymod_create},
  4656.   {Py_mod_exec, (void*)__pyx_pymod_exec_bfs},
  4657.   {0, NULL}
  4658. };
  4659. #endif
  4660.  
  4661. static struct PyModuleDef __pyx_moduledef = {
  4662.     PyModuleDef_HEAD_INIT,
  4663.     "bfs",
  4664.     0, /* m_doc */
  4665.   #if CYTHON_PEP489_MULTI_PHASE_INIT
  4666.     0, /* m_size */
  4667.   #else
  4668.     -1, /* m_size */
  4669.   #endif
  4670.     __pyx_methods /* m_methods */,
  4671.   #if CYTHON_PEP489_MULTI_PHASE_INIT
  4672.     __pyx_moduledef_slots, /* m_slots */
  4673.   #else
  4674.     NULL, /* m_reload */
  4675.   #endif
  4676.     NULL, /* m_traverse */
  4677.     NULL, /* m_clear */
  4678.     NULL /* m_free */
  4679. };
  4680. #endif
  4681. #ifndef CYTHON_SMALL_CODE
  4682. #if defined(__clang__)
  4683.     #define CYTHON_SMALL_CODE
  4684. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  4685.     #define CYTHON_SMALL_CODE __attribute__((cold))
  4686. #else
  4687.     #define CYTHON_SMALL_CODE
  4688. #endif
  4689. #endif
  4690.  
  4691. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  4692.   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  4693.   {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1},
  4694.   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  4695.   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  4696.   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  4697.   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  4698.   {&__pyx_n_s_is_part_2, __pyx_k_is_part_2, sizeof(__pyx_k_is_part_2), 0, 0, 1, 1},
  4699.   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  4700.   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  4701.   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  4702.   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  4703.   {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
  4704.   {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
  4705.   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  4706.   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  4707.   {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
  4708.   {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1},
  4709.   {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  4710.   {0, 0, 0, 0, 0, 0, 0}
  4711. };
  4712. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  4713.   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error)
  4714.   return 0;
  4715.   __pyx_L1_error:;
  4716.   return -1;
  4717. }
  4718.  
  4719. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  4720.   __Pyx_RefNannyDeclarations
  4721.   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  4722.  
  4723.   /* "bfs.pyx":16
  4724.  *     cdef np.ndarray visited = np.zeros([view.shape[0], view.shape[1]], dtype=np.bool_)
  4725.  *     cdef np.ndarray cost = np.zeros([view.shape[0], view.shape[1]], dtype=np.uint32)
  4726.  *     cdef list[pair[int, int]] positions = [(0, 1), (0, -1), (1, 0), (-1, 0)]             # <<<<<<<<<<<<<<
  4727.  *     cdef pair[int, int] node
  4728.  *     cdef pair[int, int] xy
  4729.  */
  4730.   __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 16, __pyx_L1_error)
  4731.   __Pyx_GOTREF(__pyx_tuple_);
  4732.   __Pyx_GIVEREF(__pyx_tuple_);
  4733.   __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 16, __pyx_L1_error)
  4734.   __Pyx_GOTREF(__pyx_tuple__2);
  4735.   __Pyx_GIVEREF(__pyx_tuple__2);
  4736.   __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 16, __pyx_L1_error)
  4737.   __Pyx_GOTREF(__pyx_tuple__3);
  4738.   __Pyx_GIVEREF(__pyx_tuple__3);
  4739.   __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 16, __pyx_L1_error)
  4740.   __Pyx_GOTREF(__pyx_tuple__4);
  4741.   __Pyx_GIVEREF(__pyx_tuple__4);
  4742.  
  4743.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":944
  4744.  *         __pyx_import_array()
  4745.  *     except Exception:
  4746.  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
  4747.  *
  4748.  * cdef inline int import_umath() except -1:
  4749.  */
  4750.   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 944, __pyx_L1_error)
  4751.   __Pyx_GOTREF(__pyx_tuple__5);
  4752.   __Pyx_GIVEREF(__pyx_tuple__5);
  4753.  
  4754.   /* "../.venv/lib64/python3.11/site-packages/numpy/__init__.pxd":950
  4755.  *         _import_umath()
  4756.  *     except Exception:
  4757.  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
  4758.  *
  4759.  * cdef inline int import_ufunc() except -1:
  4760.  */
  4761.   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 950, __pyx_L1_error)
  4762.   __Pyx_GOTREF(__pyx_tuple__6);
  4763.   __Pyx_GIVEREF(__pyx_tuple__6);
  4764.   __Pyx_RefNannyFinishContext();
  4765.   return 0;
  4766.   __pyx_L1_error:;
  4767.   __Pyx_RefNannyFinishContext();
  4768.   return -1;
  4769. }
  4770.  
  4771. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  4772.   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  4773.   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  4774.   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  4775.   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  4776.   return 0;
  4777.   __pyx_L1_error:;
  4778.   return -1;
  4779. }
  4780.  
  4781. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  4782. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  4783. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  4784. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  4785. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  4786. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  4787. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  4788.  
  4789. static int __Pyx_modinit_global_init_code(void) {
  4790.   __Pyx_RefNannyDeclarations
  4791.   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  4792.   /*--- Global init code ---*/
  4793.   __Pyx_RefNannyFinishContext();
  4794.   return 0;
  4795. }
  4796.  
  4797. static int __Pyx_modinit_variable_export_code(void) {
  4798.   __Pyx_RefNannyDeclarations
  4799.   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  4800.   /*--- Variable export code ---*/
  4801.   __Pyx_RefNannyFinishContext();
  4802.   return 0;
  4803. }
  4804.  
  4805. static int __Pyx_modinit_function_export_code(void) {
  4806.   __Pyx_RefNannyDeclarations
  4807.   int __pyx_lineno = 0;
  4808.   const char *__pyx_filename = NULL;
  4809.   int __pyx_clineno = 0;
  4810.   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  4811.   /*--- Function export code ---*/
  4812.   if (__Pyx_ExportFunction("bfs", (void (*)(void))__pyx_f_3bfs_bfs, "int (PyArrayObject *, std::pair<int,int> , std::pair<int,int> , bool, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4813.   if (__Pyx_ExportFunction("bfs_2", (void (*)(void))__pyx_f_3bfs_bfs_2, "int (PyArrayObject *, std::pair<int,int> , int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4814.   __Pyx_RefNannyFinishContext();
  4815.   return 0;
  4816.   __pyx_L1_error:;
  4817.   __Pyx_RefNannyFinishContext();
  4818.   return -1;
  4819. }
  4820.  
  4821. static int __Pyx_modinit_type_init_code(void) {
  4822.   __Pyx_RefNannyDeclarations
  4823.   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  4824.   /*--- Type init code ---*/
  4825.   __Pyx_RefNannyFinishContext();
  4826.   return 0;
  4827. }
  4828.  
  4829. static int __Pyx_modinit_type_import_code(void) {
  4830.   __Pyx_RefNannyDeclarations
  4831.   PyObject *__pyx_t_1 = NULL;
  4832.   int __pyx_lineno = 0;
  4833.   const char *__pyx_filename = NULL;
  4834.   int __pyx_clineno = 0;
  4835.   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  4836.   /*--- Type import code ---*/
  4837.   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  4838.   __Pyx_GOTREF(__pyx_t_1);
  4839.   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  4840.   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  4841.   sizeof(PyTypeObject),
  4842.   #else
  4843.   sizeof(PyHeapTypeObject),
  4844.   #endif
  4845.   __Pyx_ImportType_CheckSize_Warn);
  4846.    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  4847.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4848.   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error)
  4849.   __Pyx_GOTREF(__pyx_t_1);
  4850.   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
  4851.    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error)
  4852.   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
  4853.    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error)
  4854.   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
  4855.    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error)
  4856.   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
  4857.    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error)
  4858.   __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4859.    if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error)
  4860.   __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4861.    if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error)
  4862.   __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4863.    if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error)
  4864.   __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4865.    if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error)
  4866.   __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4867.    if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error)
  4868.   __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4869.    if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error)
  4870.   __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4871.    if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error)
  4872.   __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4873.    if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error)
  4874.   __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4875.    if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error)
  4876.   __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
  4877.    if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error)
  4878.   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
  4879.    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error)
  4880.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4881.   __Pyx_RefNannyFinishContext();
  4882.   return 0;
  4883.   __pyx_L1_error:;
  4884.   __Pyx_XDECREF(__pyx_t_1);
  4885.   __Pyx_RefNannyFinishContext();
  4886.   return -1;
  4887. }
  4888.  
  4889. static int __Pyx_modinit_variable_import_code(void) {
  4890.   __Pyx_RefNannyDeclarations
  4891.   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  4892.   /*--- Variable import code ---*/
  4893.   __Pyx_RefNannyFinishContext();
  4894.   return 0;
  4895. }
  4896.  
  4897. static int __Pyx_modinit_function_import_code(void) {
  4898.   __Pyx_RefNannyDeclarations
  4899.   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  4900.   /*--- Function import code ---*/
  4901.   __Pyx_RefNannyFinishContext();
  4902.   return 0;
  4903. }
  4904.  
  4905.  
  4906. #ifndef CYTHON_NO_PYINIT_EXPORT
  4907. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  4908. #elif PY_MAJOR_VERSION < 3
  4909. #ifdef __cplusplus
  4910. #define __Pyx_PyMODINIT_FUNC extern "C" void
  4911. #else
  4912. #define __Pyx_PyMODINIT_FUNC void
  4913. #endif
  4914. #else
  4915. #ifdef __cplusplus
  4916. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  4917. #else
  4918. #define __Pyx_PyMODINIT_FUNC PyObject *
  4919. #endif
  4920. #endif
  4921.  
  4922.  
  4923. #if PY_MAJOR_VERSION < 3
  4924. __Pyx_PyMODINIT_FUNC initbfs(void) CYTHON_SMALL_CODE; /*proto*/
  4925. __Pyx_PyMODINIT_FUNC initbfs(void)
  4926. #else
  4927. __Pyx_PyMODINIT_FUNC PyInit_bfs(void) CYTHON_SMALL_CODE; /*proto*/
  4928. __Pyx_PyMODINIT_FUNC PyInit_bfs(void)
  4929. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4930. {
  4931.   return PyModuleDef_Init(&__pyx_moduledef);
  4932. }
  4933. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  4934.     #if PY_VERSION_HEX >= 0x030700A1
  4935.     static PY_INT64_T main_interpreter_id = -1;
  4936.     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  4937.     if (main_interpreter_id == -1) {
  4938.         main_interpreter_id = current_id;
  4939.         return (unlikely(current_id == -1)) ? -1 : 0;
  4940.     } else if (unlikely(main_interpreter_id != current_id))
  4941.     #else
  4942.     static PyInterpreterState *main_interpreter = NULL;
  4943.     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  4944.     if (!main_interpreter) {
  4945.         main_interpreter = current_interpreter;
  4946.     } else if (unlikely(main_interpreter != current_interpreter))
  4947.     #endif
  4948.     {
  4949.         PyErr_SetString(
  4950.             PyExc_ImportError,
  4951.             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  4952.         return -1;
  4953.     }
  4954.     return 0;
  4955. }
  4956. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
  4957.     PyObject *value = PyObject_GetAttrString(spec, from_name);
  4958.     int result = 0;
  4959.     if (likely(value)) {
  4960.         if (allow_none || value != Py_None) {
  4961.             result = PyDict_SetItemString(moddict, to_name, value);
  4962.         }
  4963.         Py_DECREF(value);
  4964.     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  4965.         PyErr_Clear();
  4966.     } else {
  4967.         result = -1;
  4968.     }
  4969.     return result;
  4970. }
  4971. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  4972.     PyObject *module = NULL, *moddict, *modname;
  4973.     if (__Pyx_check_single_interpreter())
  4974.         return NULL;
  4975.     if (__pyx_m)
  4976.         return __Pyx_NewRef(__pyx_m);
  4977.     modname = PyObject_GetAttrString(spec, "name");
  4978.     if (unlikely(!modname)) goto bad;
  4979.     module = PyModule_NewObject(modname);
  4980.     Py_DECREF(modname);
  4981.     if (unlikely(!module)) goto bad;
  4982.     moddict = PyModule_GetDict(module);
  4983.     if (unlikely(!moddict)) goto bad;
  4984.     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  4985.     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  4986.     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  4987.     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  4988.     return module;
  4989. bad:
  4990.     Py_XDECREF(module);
  4991.     return NULL;
  4992. }
  4993.  
  4994.  
  4995. static CYTHON_SMALL_CODE int __pyx_pymod_exec_bfs(PyObject *__pyx_pyinit_module)
  4996. #endif
  4997. #endif
  4998. {
  4999.   PyObject *__pyx_t_1 = NULL;
  5000.   int __pyx_lineno = 0;
  5001.   const char *__pyx_filename = NULL;
  5002.   int __pyx_clineno = 0;
  5003.   __Pyx_RefNannyDeclarations
  5004.   #if CYTHON_PEP489_MULTI_PHASE_INIT
  5005.   if (__pyx_m) {
  5006.     if (__pyx_m == __pyx_pyinit_module) return 0;
  5007.     PyErr_SetString(PyExc_RuntimeError, "Module 'bfs' has already been imported. Re-initialisation is not supported.");
  5008.     return -1;
  5009.   }
  5010.   #elif PY_MAJOR_VERSION >= 3
  5011.   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  5012.   #endif
  5013.   #if CYTHON_REFNANNY
  5014. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  5015. if (!__Pyx_RefNanny) {
  5016.   PyErr_Clear();
  5017.   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  5018.   if (!__Pyx_RefNanny)
  5019.       Py_FatalError("failed to import 'refnanny' module");
  5020. }
  5021. #endif
  5022.   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_bfs(void)", 0);
  5023.   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5024.   #ifdef __Pxy_PyFrame_Initialize_Offsets
  5025.   __Pxy_PyFrame_Initialize_Offsets();
  5026.   #endif
  5027.   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  5028.   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  5029.   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  5030.   #ifdef __Pyx_CyFunction_USED
  5031.   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5032.   #endif
  5033.   #ifdef __Pyx_FusedFunction_USED
  5034.   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5035.   #endif
  5036.   #ifdef __Pyx_Coroutine_USED
  5037.   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5038.   #endif
  5039.   #ifdef __Pyx_Generator_USED
  5040.   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5041.   #endif
  5042.   #ifdef __Pyx_AsyncGen_USED
  5043.   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5044.   #endif
  5045.   #ifdef __Pyx_StopAsyncIteration_USED
  5046.   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5047.   #endif
  5048.   /*--- Library function declarations ---*/
  5049.   /*--- Threads initialization code ---*/
  5050.   #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  5051.   PyEval_InitThreads();
  5052.   #endif
  5053.   /*--- Module creation code ---*/
  5054.   #if CYTHON_PEP489_MULTI_PHASE_INIT
  5055.   __pyx_m = __pyx_pyinit_module;
  5056.   Py_INCREF(__pyx_m);
  5057.   #else
  5058.   #if PY_MAJOR_VERSION < 3
  5059.   __pyx_m = Py_InitModule4("bfs", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  5060.   #else
  5061.   __pyx_m = PyModule_Create(&__pyx_moduledef);
  5062.   #endif
  5063.   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  5064.   #endif
  5065.   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  5066.   Py_INCREF(__pyx_d);
  5067.   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  5068.   Py_INCREF(__pyx_b);
  5069.   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  5070.   Py_INCREF(__pyx_cython_runtime);
  5071.   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  5072.   /*--- Initialize various global constants etc. ---*/
  5073.   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5074.   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  5075.   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5076.   #endif
  5077.   if (__pyx_module_is_main_bfs) {
  5078.     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5079.   }
  5080.   #if PY_MAJOR_VERSION >= 3
  5081.   {
  5082.     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  5083.     if (!PyDict_GetItemString(modules, "bfs")) {
  5084.       if (unlikely(PyDict_SetItemString(modules, "bfs", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  5085.     }
  5086.   }
  5087.   #endif
  5088.   /*--- Builtin init code ---*/
  5089.   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5090.   /*--- Constants init code ---*/
  5091.   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5092.   /*--- Global type/function init code ---*/
  5093.   (void)__Pyx_modinit_global_init_code();
  5094.   (void)__Pyx_modinit_variable_export_code();
  5095.   if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  5096.   (void)__Pyx_modinit_type_init_code();
  5097.   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  5098.   (void)__Pyx_modinit_variable_import_code();
  5099.   (void)__Pyx_modinit_function_import_code();
  5100.   /*--- Execution code ---*/
  5101.   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  5102.   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5103.   #endif
  5104.  
  5105.   /* "bfs.pyx":3
  5106.  * # distutils: language=c++
  5107.  * import cython
  5108.  * import numpy as np             # <<<<<<<<<<<<<<
  5109.  * cimport numpy as np
  5110.  *
  5111.  */
  5112.   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  5113.   __Pyx_GOTREF(__pyx_t_1);
  5114.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  5115.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5116.  
  5117.   /* "bfs.pyx":1
  5118.  * # distutils: language=c++             # <<<<<<<<<<<<<<
  5119.  * import cython
  5120.  * import numpy as np
  5121.  */
  5122.   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  5123.   __Pyx_GOTREF(__pyx_t_1);
  5124.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5125.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5126.  
  5127.   /* "list.from_py":71
  5128.  *
  5129.  * @cname("__pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___")
  5130.  * cdef cpp_list[X] __pyx_convert_list_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(object o) except *:             # <<<<<<<<<<<<<<
  5131.  *     cdef cpp_list[X] l
  5132.  *     for item in o:
  5133.  */
  5134.  
  5135.   /*--- Wrapped vars code ---*/
  5136.  
  5137.   goto __pyx_L0;
  5138.   __pyx_L1_error:;
  5139.   __Pyx_XDECREF(__pyx_t_1);
  5140.   if (__pyx_m) {
  5141.     if (__pyx_d) {
  5142.       __Pyx_AddTraceback("init bfs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5143.     }
  5144.     Py_CLEAR(__pyx_m);
  5145.   } else if (!PyErr_Occurred()) {
  5146.     PyErr_SetString(PyExc_ImportError, "init bfs");
  5147.   }
  5148.   __pyx_L0:;
  5149.   __Pyx_RefNannyFinishContext();
  5150.   #if CYTHON_PEP489_MULTI_PHASE_INIT
  5151.   return (__pyx_m != NULL) ? 0 : -1;
  5152.   #elif PY_MAJOR_VERSION >= 3
  5153.   return __pyx_m;
  5154.   #else
  5155.   return;
  5156.   #endif
  5157. }
  5158.  
  5159. /* --- Runtime support code --- */
  5160. /* Refnanny */
  5161. #if CYTHON_REFNANNY
  5162. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  5163.     PyObject *m = NULL, *p = NULL;
  5164.     void *r = NULL;
  5165.     m = PyImport_ImportModule(modname);
  5166.     if (!m) goto end;
  5167.     p = PyObject_GetAttrString(m, "RefNannyAPI");
  5168.     if (!p) goto end;
  5169.     r = PyLong_AsVoidPtr(p);
  5170. end:
  5171.     Py_XDECREF(p);
  5172.     Py_XDECREF(m);
  5173.     return (__Pyx_RefNannyAPIStruct *)r;
  5174. }
  5175. #endif
  5176.  
  5177. /* PyObjectGetAttrStr */
  5178. #if CYTHON_USE_TYPE_SLOTS
  5179. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  5180.     PyTypeObject* tp = Py_TYPE(obj);
  5181.     if (likely(tp->tp_getattro))
  5182.         return tp->tp_getattro(obj, attr_name);
  5183. #if PY_MAJOR_VERSION < 3
  5184.     if (likely(tp->tp_getattr))
  5185.         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  5186. #endif
  5187.     return PyObject_GetAttr(obj, attr_name);
  5188. }
  5189. #endif
  5190.  
  5191. /* GetBuiltinName */
  5192. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  5193.     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  5194.     if (unlikely(!result)) {
  5195.         PyErr_Format(PyExc_NameError,
  5196. #if PY_MAJOR_VERSION >= 3
  5197.             "name '%U' is not defined", name);
  5198. #else
  5199.             "name '%.200s' is not defined", PyString_AS_STRING(name));
  5200. #endif
  5201.     }
  5202.     return result;
  5203. }
  5204.  
  5205. /* PyDictVersioning */
  5206. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  5207. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  5208.     PyObject *dict = Py_TYPE(obj)->tp_dict;
  5209.     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  5210. }
  5211. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  5212.     PyObject **dictptr = NULL;
  5213.     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  5214.     if (offset) {
  5215. #if CYTHON_COMPILING_IN_CPYTHON
  5216.         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  5217. #else
  5218.         dictptr = _PyObject_GetDictPtr(obj);
  5219. #endif
  5220.     }
  5221.     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  5222. }
  5223. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  5224.     PyObject *dict = Py_TYPE(obj)->tp_dict;
  5225.     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  5226.         return 0;
  5227.     return obj_dict_version == __Pyx_get_object_dict_version(obj);
  5228. }
  5229. #endif
  5230.  
  5231. /* GetModuleGlobalName */
  5232. #if CYTHON_USE_DICT_VERSIONS
  5233. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  5234. #else
  5235. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  5236. #endif
  5237. {
  5238.     PyObject *result;
  5239. #if !CYTHON_AVOID_BORROWED_REFS
  5240. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  5241.     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  5242.     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  5243.     if (likely(result)) {
  5244.         return __Pyx_NewRef(result);
  5245.     } else if (unlikely(PyErr_Occurred())) {
  5246.         return NULL;
  5247.     }
  5248. #else
  5249.     result = PyDict_GetItem(__pyx_d, name);
  5250.     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  5251.     if (likely(result)) {
  5252.         return __Pyx_NewRef(result);
  5253.     }
  5254. #endif
  5255. #else
  5256.     result = PyObject_GetItem(__pyx_d, name);
  5257.     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  5258.     if (likely(result)) {
  5259.         return __Pyx_NewRef(result);
  5260.     }
  5261.     PyErr_Clear();
  5262. #endif
  5263.     return __Pyx_GetBuiltinName(name);
  5264. }
  5265.  
  5266. /* PyObjectCall */
  5267. #if CYTHON_COMPILING_IN_CPYTHON
  5268. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  5269.     PyObject *result;
  5270.     ternaryfunc call = Py_TYPE(func)->tp_call;
  5271.     if (unlikely(!call))
  5272.         return PyObject_Call(func, arg, kw);
  5273.     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  5274.         return NULL;
  5275.     result = (*call)(func, arg, kw);
  5276.     Py_LeaveRecursiveCall();
  5277.     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  5278.         PyErr_SetString(
  5279.             PyExc_SystemError,
  5280.             "NULL result without error in PyObject_Call");
  5281.     }
  5282.     return result;
  5283. }
  5284. #endif
  5285.  
  5286. /* ExtTypeTest */
  5287. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  5288.     if (unlikely(!type)) {
  5289.         PyErr_SetString(PyExc_SystemError, "Missing type object");
  5290.         return 0;
  5291.     }
  5292.     if (likely(__Pyx_TypeCheck(obj, type)))
  5293.         return 1;
  5294.     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  5295.                  Py_TYPE(obj)->tp_name, type->tp_name);
  5296.     return 0;
  5297. }
  5298.  
  5299. /* GetItemInt */
  5300. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  5301.     PyObject *r;
  5302.     if (!j) return NULL;
  5303.     r = PyObject_GetItem(o, j);
  5304.     Py_DECREF(j);
  5305.     return r;
  5306. }
  5307. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  5308.                                                               CYTHON_NCP_UNUSED int wraparound,
  5309.                                                               CYTHON_NCP_UNUSED int boundscheck) {
  5310. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5311.     Py_ssize_t wrapped_i = i;
  5312.     if (wraparound & unlikely(i < 0)) {
  5313.         wrapped_i += PyList_GET_SIZE(o);
  5314.     }
  5315.     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  5316.         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  5317.         Py_INCREF(r);
  5318.         return r;
  5319.     }
  5320.     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  5321. #else
  5322.     return PySequence_GetItem(o, i);
  5323. #endif
  5324. }
  5325. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  5326.                                                               CYTHON_NCP_UNUSED int wraparound,
  5327.                                                               CYTHON_NCP_UNUSED int boundscheck) {
  5328. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5329.     Py_ssize_t wrapped_i = i;
  5330.     if (wraparound & unlikely(i < 0)) {
  5331.         wrapped_i += PyTuple_GET_SIZE(o);
  5332.     }
  5333.     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  5334.         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  5335.         Py_INCREF(r);
  5336.         return r;
  5337.     }
  5338.     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  5339. #else
  5340.     return PySequence_GetItem(o, i);
  5341. #endif
  5342. }
  5343. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  5344.                                                      CYTHON_NCP_UNUSED int wraparound,
  5345.                                                      CYTHON_NCP_UNUSED int boundscheck) {
  5346. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  5347.     if (is_list || PyList_CheckExact(o)) {
  5348.         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  5349.         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  5350.             PyObject *r = PyList_GET_ITEM(o, n);
  5351.             Py_INCREF(r);
  5352.             return r;
  5353.         }
  5354.     }
  5355.     else if (PyTuple_CheckExact(o)) {
  5356.         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  5357.         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  5358.             PyObject *r = PyTuple_GET_ITEM(o, n);
  5359.             Py_INCREF(r);
  5360.             return r;
  5361.         }
  5362.     } else {
  5363.         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  5364.         if (likely(m && m->sq_item)) {
  5365.             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  5366.                 Py_ssize_t l = m->sq_length(o);
  5367.                 if (likely(l >= 0)) {
  5368.                     i += l;
  5369.                 } else {
  5370.                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  5371.                         return NULL;
  5372.                     PyErr_Clear();
  5373.                 }
  5374.             }
  5375.             return m->sq_item(o, i);
  5376.         }
  5377.     }
  5378. #else
  5379.     if (is_list || PySequence_Check(o)) {
  5380.         return PySequence_GetItem(o, i);
  5381.     }
  5382. #endif
  5383.     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  5384. }
  5385.  
  5386. /* ObjectGetItem */
  5387. #if CYTHON_USE_TYPE_SLOTS
  5388. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
  5389.     PyObject *runerr;
  5390.     Py_ssize_t key_value;
  5391.     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
  5392.     if (unlikely(!(m && m->sq_item))) {
  5393.         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
  5394.         return NULL;
  5395.     }
  5396.     key_value = __Pyx_PyIndex_AsSsize_t(index);
  5397.     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  5398.         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  5399.     }
  5400.     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  5401.         PyErr_Clear();
  5402.         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
  5403.     }
  5404.     return NULL;
  5405. }
  5406. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
  5407.     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
  5408.     if (likely(m && m->mp_subscript)) {
  5409.         return m->mp_subscript(obj, key);
  5410.     }
  5411.     return __Pyx_PyObject_GetIndex(obj, key);
  5412. }
  5413. #endif
  5414.  
  5415. /* PyIntBinop */
  5416. #if !CYTHON_COMPILING_IN_PYPY
  5417. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
  5418.     (void)inplace;
  5419.     (void)zerodivision_check;
  5420.     #if PY_MAJOR_VERSION < 3
  5421.     if (likely(PyInt_CheckExact(op1))) {
  5422.         const long b = intval;
  5423.         long x;
  5424.         long a = PyInt_AS_LONG(op1);
  5425.             x = (long)((unsigned long)a + b);
  5426.             if (likely((x^a) >= 0 || (x^b) >= 0))
  5427.                 return PyInt_FromLong(x);
  5428.             return PyLong_Type.tp_as_number->nb_add(op1, op2);
  5429.     }
  5430.     #endif
  5431.     #if CYTHON_USE_PYLONG_INTERNALS
  5432.     if (likely(PyLong_CheckExact(op1))) {
  5433.         const long b = intval;
  5434.         long a, x;
  5435. #ifdef HAVE_LONG_LONG
  5436.         const PY_LONG_LONG llb = intval;
  5437.         PY_LONG_LONG lla, llx;
  5438. #endif
  5439.         const digit* digits = ((PyLongObject*)op1)->ob_digit;
  5440.         const Py_ssize_t size = Py_SIZE(op1);
  5441.         if (likely(__Pyx_sst_abs(size) <= 1)) {
  5442.             a = likely(size) ? digits[0] : 0;
  5443.             if (size == -1) a = -a;
  5444.         } else {
  5445.             switch (size) {
  5446.                 case -2:
  5447.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  5448.                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5449.                         break;
  5450. #ifdef HAVE_LONG_LONG
  5451.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  5452.                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5453.                         goto long_long;
  5454. #endif
  5455.                     }
  5456.                     CYTHON_FALLTHROUGH;
  5457.                 case 2:
  5458.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  5459.                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5460.                         break;
  5461. #ifdef HAVE_LONG_LONG
  5462.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  5463.                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5464.                         goto long_long;
  5465. #endif
  5466.                     }
  5467.                     CYTHON_FALLTHROUGH;
  5468.                 case -3:
  5469.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  5470.                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5471.                         break;
  5472. #ifdef HAVE_LONG_LONG
  5473.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  5474.                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5475.                         goto long_long;
  5476. #endif
  5477.                     }
  5478.                     CYTHON_FALLTHROUGH;
  5479.                 case 3:
  5480.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  5481.                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5482.                         break;
  5483. #ifdef HAVE_LONG_LONG
  5484.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  5485.                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5486.                         goto long_long;
  5487. #endif
  5488.                     }
  5489.                     CYTHON_FALLTHROUGH;
  5490.                 case -4:
  5491.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  5492.                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5493.                         break;
  5494. #ifdef HAVE_LONG_LONG
  5495.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  5496.                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5497.                         goto long_long;
  5498. #endif
  5499.                     }
  5500.                     CYTHON_FALLTHROUGH;
  5501.                 case 4:
  5502.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  5503.                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5504.                         break;
  5505. #ifdef HAVE_LONG_LONG
  5506.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  5507.                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5508.                         goto long_long;
  5509. #endif
  5510.                     }
  5511.                     CYTHON_FALLTHROUGH;
  5512.                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
  5513.             }
  5514.         }
  5515.                 x = a + b;
  5516.             return PyLong_FromLong(x);
  5517. #ifdef HAVE_LONG_LONG
  5518.         long_long:
  5519.                 llx = lla + llb;
  5520.             return PyLong_FromLongLong(llx);
  5521. #endif
  5522.        
  5523.        
  5524.     }
  5525.     #endif
  5526.     if (PyFloat_CheckExact(op1)) {
  5527.         const long b = intval;
  5528.         double a = PyFloat_AS_DOUBLE(op1);
  5529.             double result;
  5530.             PyFPE_START_PROTECT("add", return NULL)
  5531.             result = ((double)a) + (double)b;
  5532.             PyFPE_END_PROTECT(result)
  5533.             return PyFloat_FromDouble(result);
  5534.     }
  5535.     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  5536. }
  5537. #endif
  5538.  
  5539. /* PyErrFetchRestore */
  5540. #if CYTHON_FAST_THREAD_STATE
  5541. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  5542.     PyObject *tmp_type, *tmp_value, *tmp_tb;
  5543.     tmp_type = tstate->curexc_type;
  5544.     tmp_value = tstate->curexc_value;
  5545.     tmp_tb = tstate->curexc_traceback;
  5546.     tstate->curexc_type = type;
  5547.     tstate->curexc_value = value;
  5548.     tstate->curexc_traceback = tb;
  5549.     Py_XDECREF(tmp_type);
  5550.     Py_XDECREF(tmp_value);
  5551.     Py_XDECREF(tmp_tb);
  5552. }
  5553. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  5554.     *type = tstate->curexc_type;
  5555.     *value = tstate->curexc_value;
  5556.     *tb = tstate->curexc_traceback;
  5557.     tstate->curexc_type = 0;
  5558.     tstate->curexc_value = 0;
  5559.     tstate->curexc_traceback = 0;
  5560. }
  5561. #endif
  5562.  
  5563. /* WriteUnraisableException */
  5564. static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
  5565.                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
  5566.                                   int full_traceback, CYTHON_UNUSED int nogil) {
  5567.     PyObject *old_exc, *old_val, *old_tb;
  5568.     PyObject *ctx;
  5569.     __Pyx_PyThreadState_declare
  5570. #ifdef WITH_THREAD
  5571.     PyGILState_STATE state;
  5572.     if (nogil)
  5573.         state = PyGILState_Ensure();
  5574. #ifdef _MSC_VER
  5575.     else state = (PyGILState_STATE)-1;
  5576. #endif
  5577. #endif
  5578.     __Pyx_PyThreadState_assign
  5579.     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
  5580.     if (full_traceback) {
  5581.         Py_XINCREF(old_exc);
  5582.         Py_XINCREF(old_val);
  5583.         Py_XINCREF(old_tb);
  5584.         __Pyx_ErrRestore(old_exc, old_val, old_tb);
  5585.         PyErr_PrintEx(1);
  5586.     }
  5587.     #if PY_MAJOR_VERSION < 3
  5588.     ctx = PyString_FromString(name);
  5589.     #else
  5590.     ctx = PyUnicode_FromString(name);
  5591.     #endif
  5592.     __Pyx_ErrRestore(old_exc, old_val, old_tb);
  5593.     if (!ctx) {
  5594.         PyErr_WriteUnraisable(Py_None);
  5595.     } else {
  5596.         PyErr_WriteUnraisable(ctx);
  5597.         Py_DECREF(ctx);
  5598.     }
  5599. #ifdef WITH_THREAD
  5600.     if (nogil)
  5601.         PyGILState_Release(state);
  5602. #endif
  5603. }
  5604.  
  5605. /* RaiseArgTupleInvalid */
  5606. static void __Pyx_RaiseArgtupleInvalid(
  5607.     const char* func_name,
  5608.     int exact,
  5609.     Py_ssize_t num_min,
  5610.     Py_ssize_t num_max,
  5611.     Py_ssize_t num_found)
  5612. {
  5613.     Py_ssize_t num_expected;
  5614.     const char *more_or_less;
  5615.     if (num_found < num_min) {
  5616.         num_expected = num_min;
  5617.         more_or_less = "at least";
  5618.     } else {
  5619.         num_expected = num_max;
  5620.         more_or_less = "at most";
  5621.     }
  5622.     if (exact) {
  5623.         more_or_less = "exactly";
  5624.     }
  5625.     PyErr_Format(PyExc_TypeError,
  5626.                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  5627.                  func_name, more_or_less, num_expected,
  5628.                  (num_expected == 1) ? "" : "s", num_found);
  5629. }
  5630.  
  5631. /* RaiseDoubleKeywords */
  5632. static void __Pyx_RaiseDoubleKeywordsError(
  5633.     const char* func_name,
  5634.     PyObject* kw_name)
  5635. {
  5636.     PyErr_Format(PyExc_TypeError,
  5637.         #if PY_MAJOR_VERSION >= 3
  5638.         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  5639.         #else
  5640.         "%s() got multiple values for keyword argument '%s'", func_name,
  5641.         PyString_AsString(kw_name));
  5642.         #endif
  5643. }
  5644.  
  5645. /* ParseKeywords */
  5646. static int __Pyx_ParseOptionalKeywords(
  5647.     PyObject *kwds,
  5648.     PyObject **argnames[],
  5649.     PyObject *kwds2,
  5650.     PyObject *values[],
  5651.     Py_ssize_t num_pos_args,
  5652.     const char* function_name)
  5653. {
  5654.     PyObject *key = 0, *value = 0;
  5655.     Py_ssize_t pos = 0;
  5656.     PyObject*** name;
  5657.     PyObject*** first_kw_arg = argnames + num_pos_args;
  5658.     while (PyDict_Next(kwds, &pos, &key, &value)) {
  5659.         name = first_kw_arg;
  5660.         while (*name && (**name != key)) name++;
  5661.         if (*name) {
  5662.             values[name-argnames] = value;
  5663.             continue;
  5664.         }
  5665.         name = first_kw_arg;
  5666.         #if PY_MAJOR_VERSION < 3
  5667.         if (likely(PyString_Check(key))) {
  5668.             while (*name) {
  5669.                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  5670.                         && _PyString_Eq(**name, key)) {
  5671.                     values[name-argnames] = value;
  5672.                     break;
  5673.                 }
  5674.                 name++;
  5675.             }
  5676.             if (*name) continue;
  5677.             else {
  5678.                 PyObject*** argname = argnames;
  5679.                 while (argname != first_kw_arg) {
  5680.                     if ((**argname == key) || (
  5681.                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  5682.                              && _PyString_Eq(**argname, key))) {
  5683.                         goto arg_passed_twice;
  5684.                     }
  5685.                     argname++;
  5686.                 }
  5687.             }
  5688.         } else
  5689.         #endif
  5690.         if (likely(PyUnicode_Check(key))) {
  5691.             while (*name) {
  5692.                 int cmp = (**name == key) ? 0 :
  5693.                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  5694.                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  5695.                 #endif
  5696.                     PyUnicode_Compare(**name, key);
  5697.                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  5698.                 if (cmp == 0) {
  5699.                     values[name-argnames] = value;
  5700.                     break;
  5701.                 }
  5702.                 name++;
  5703.             }
  5704.             if (*name) continue;
  5705.             else {
  5706.                 PyObject*** argname = argnames;
  5707.                 while (argname != first_kw_arg) {
  5708.                     int cmp = (**argname == key) ? 0 :
  5709.                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  5710.                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  5711.                     #endif
  5712.                         PyUnicode_Compare(**argname, key);
  5713.                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  5714.                     if (cmp == 0) goto arg_passed_twice;
  5715.                     argname++;
  5716.                 }
  5717.             }
  5718.         } else
  5719.             goto invalid_keyword_type;
  5720.         if (kwds2) {
  5721.             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  5722.         } else {
  5723.             goto invalid_keyword;
  5724.         }
  5725.     }
  5726.     return 0;
  5727. arg_passed_twice:
  5728.     __Pyx_RaiseDoubleKeywordsError(function_name, key);
  5729.     goto bad;
  5730. invalid_keyword_type:
  5731.     PyErr_Format(PyExc_TypeError,
  5732.         "%.200s() keywords must be strings", function_name);
  5733.     goto bad;
  5734. invalid_keyword:
  5735.     PyErr_Format(PyExc_TypeError,
  5736.     #if PY_MAJOR_VERSION < 3
  5737.         "%.200s() got an unexpected keyword argument '%.200s'",
  5738.         function_name, PyString_AsString(key));
  5739.     #else
  5740.         "%s() got an unexpected keyword argument '%U'",
  5741.         function_name, key);
  5742.     #endif
  5743. bad:
  5744.     return -1;
  5745. }
  5746.  
  5747. /* ArgTypeTest */
  5748. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  5749. {
  5750.     if (unlikely(!type)) {
  5751.         PyErr_SetString(PyExc_SystemError, "Missing type object");
  5752.         return 0;
  5753.     }
  5754.     else if (exact) {
  5755.         #if PY_MAJOR_VERSION == 2
  5756.         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  5757.         #endif
  5758.     }
  5759.     else {
  5760.         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  5761.     }
  5762.     PyErr_Format(PyExc_TypeError,
  5763.         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  5764.         name, type->tp_name, Py_TYPE(obj)->tp_name);
  5765.     return 0;
  5766. }
  5767.  
  5768. /* PyIntBinop */
  5769. #if !CYTHON_COMPILING_IN_PYPY
  5770. static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
  5771.     (void)inplace;
  5772.     (void)zerodivision_check;
  5773.     #if PY_MAJOR_VERSION < 3
  5774.     if (likely(PyInt_CheckExact(op1))) {
  5775.         const long b = intval;
  5776.         long x;
  5777.         long a = PyInt_AS_LONG(op1);
  5778.             x = (long)((unsigned long)a - b);
  5779.             if (likely((x^a) >= 0 || (x^~b) >= 0))
  5780.                 return PyInt_FromLong(x);
  5781.             return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  5782.     }
  5783.     #endif
  5784.     #if CYTHON_USE_PYLONG_INTERNALS
  5785.     if (likely(PyLong_CheckExact(op1))) {
  5786.         const long b = intval;
  5787.         long a, x;
  5788. #ifdef HAVE_LONG_LONG
  5789.         const PY_LONG_LONG llb = intval;
  5790.         PY_LONG_LONG lla, llx;
  5791. #endif
  5792.         const digit* digits = ((PyLongObject*)op1)->ob_digit;
  5793.         const Py_ssize_t size = Py_SIZE(op1);
  5794.         if (likely(__Pyx_sst_abs(size) <= 1)) {
  5795.             a = likely(size) ? digits[0] : 0;
  5796.             if (size == -1) a = -a;
  5797.         } else {
  5798.             switch (size) {
  5799.                 case -2:
  5800.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  5801.                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5802.                         break;
  5803. #ifdef HAVE_LONG_LONG
  5804.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  5805.                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5806.                         goto long_long;
  5807. #endif
  5808.                     }
  5809.                     CYTHON_FALLTHROUGH;
  5810.                 case 2:
  5811.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  5812.                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5813.                         break;
  5814. #ifdef HAVE_LONG_LONG
  5815.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  5816.                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5817.                         goto long_long;
  5818. #endif
  5819.                     }
  5820.                     CYTHON_FALLTHROUGH;
  5821.                 case -3:
  5822.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  5823.                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5824.                         break;
  5825. #ifdef HAVE_LONG_LONG
  5826.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  5827.                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5828.                         goto long_long;
  5829. #endif
  5830.                     }
  5831.                     CYTHON_FALLTHROUGH;
  5832.                 case 3:
  5833.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  5834.                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5835.                         break;
  5836. #ifdef HAVE_LONG_LONG
  5837.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  5838.                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5839.                         goto long_long;
  5840. #endif
  5841.                     }
  5842.                     CYTHON_FALLTHROUGH;
  5843.                 case -4:
  5844.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  5845.                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5846.                         break;
  5847. #ifdef HAVE_LONG_LONG
  5848.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  5849.                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5850.                         goto long_long;
  5851. #endif
  5852.                     }
  5853.                     CYTHON_FALLTHROUGH;
  5854.                 case 4:
  5855.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  5856.                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  5857.                         break;
  5858. #ifdef HAVE_LONG_LONG
  5859.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  5860.                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  5861.                         goto long_long;
  5862. #endif
  5863.                     }
  5864.                     CYTHON_FALLTHROUGH;
  5865.                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  5866.             }
  5867.         }
  5868.                 x = a - b;
  5869.             return PyLong_FromLong(x);
  5870. #ifdef HAVE_LONG_LONG
  5871.         long_long:
  5872.                 llx = lla - llb;
  5873.             return PyLong_FromLongLong(llx);
  5874. #endif
  5875.        
  5876.        
  5877.     }
  5878.     #endif
  5879.     if (PyFloat_CheckExact(op1)) {
  5880.         const long b = intval;
  5881.         double a = PyFloat_AS_DOUBLE(op1);
  5882.             double result;
  5883.             PyFPE_START_PROTECT("subtract", return NULL)
  5884.             result = ((double)a) - (double)b;
  5885.             PyFPE_END_PROTECT(result)
  5886.             return PyFloat_FromDouble(result);
  5887.     }
  5888.     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  5889. }
  5890. #endif
  5891.  
  5892. /* GetTopmostException */
  5893. #if CYTHON_USE_EXC_INFO_STACK
  5894. static _PyErr_StackItem *
  5895. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  5896. {
  5897.     _PyErr_StackItem *exc_info = tstate->exc_info;
  5898.     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
  5899.            exc_info->previous_item != NULL)
  5900.     {
  5901.         exc_info = exc_info->previous_item;
  5902.     }
  5903.     return exc_info;
  5904. }
  5905. #endif
  5906.  
  5907. /* SaveResetException */
  5908. #if CYTHON_FAST_THREAD_STATE
  5909. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  5910.     #if CYTHON_USE_EXC_INFO_STACK
  5911.     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  5912.     *type = exc_info->exc_type;
  5913.     *value = exc_info->exc_value;
  5914.     *tb = exc_info->exc_traceback;
  5915.     #else
  5916.     *type = tstate->exc_type;
  5917.     *value = tstate->exc_value;
  5918.     *tb = tstate->exc_traceback;
  5919.     #endif
  5920.     Py_XINCREF(*type);
  5921.     Py_XINCREF(*value);
  5922.     Py_XINCREF(*tb);
  5923. }
  5924. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  5925.     PyObject *tmp_type, *tmp_value, *tmp_tb;
  5926.     #if CYTHON_USE_EXC_INFO_STACK
  5927.     _PyErr_StackItem *exc_info = tstate->exc_info;
  5928.     tmp_type = exc_info->exc_type;
  5929.     tmp_value = exc_info->exc_value;
  5930.     tmp_tb = exc_info->exc_traceback;
  5931.     exc_info->exc_type = type;
  5932.     exc_info->exc_value = value;
  5933.     exc_info->exc_traceback = tb;
  5934.     #else
  5935.     tmp_type = tstate->exc_type;
  5936.     tmp_value = tstate->exc_value;
  5937.     tmp_tb = tstate->exc_traceback;
  5938.     tstate->exc_type = type;
  5939.     tstate->exc_value = value;
  5940.     tstate->exc_traceback = tb;
  5941.     #endif
  5942.     Py_XDECREF(tmp_type);
  5943.     Py_XDECREF(tmp_value);
  5944.     Py_XDECREF(tmp_tb);
  5945. }
  5946. #endif
  5947.  
  5948. /* PyErrExceptionMatches */
  5949. #if CYTHON_FAST_THREAD_STATE
  5950. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  5951.     Py_ssize_t i, n;
  5952.     n = PyTuple_GET_SIZE(tuple);
  5953. #if PY_MAJOR_VERSION >= 3
  5954.     for (i=0; i<n; i++) {
  5955.         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  5956.     }
  5957. #endif
  5958.     for (i=0; i<n; i++) {
  5959.         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  5960.     }
  5961.     return 0;
  5962. }
  5963. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  5964.     PyObject *exc_type = tstate->curexc_type;
  5965.     if (exc_type == err) return 1;
  5966.     if (unlikely(!exc_type)) return 0;
  5967.     if (unlikely(PyTuple_Check(err)))
  5968.         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  5969.     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  5970. }
  5971. #endif
  5972.  
  5973. /* GetException */
  5974. #if CYTHON_FAST_THREAD_STATE
  5975. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  5976. #else
  5977. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  5978. #endif
  5979. {
  5980.     PyObject *local_type, *local_value, *local_tb;
  5981. #if CYTHON_FAST_THREAD_STATE
  5982.     PyObject *tmp_type, *tmp_value, *tmp_tb;
  5983.     local_type = tstate->curexc_type;
  5984.     local_value = tstate->curexc_value;
  5985.     local_tb = tstate->curexc_traceback;
  5986.     tstate->curexc_type = 0;
  5987.     tstate->curexc_value = 0;
  5988.     tstate->curexc_traceback = 0;
  5989. #else
  5990.     PyErr_Fetch(&local_type, &local_value, &local_tb);
  5991. #endif
  5992.     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  5993. #if CYTHON_FAST_THREAD_STATE
  5994.     if (unlikely(tstate->curexc_type))
  5995. #else
  5996.     if (unlikely(PyErr_Occurred()))
  5997. #endif
  5998.         goto bad;
  5999.     #if PY_MAJOR_VERSION >= 3
  6000.     if (local_tb) {
  6001.         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  6002.             goto bad;
  6003.     }
  6004.     #endif
  6005.     Py_XINCREF(local_tb);
  6006.     Py_XINCREF(local_type);
  6007.     Py_XINCREF(local_value);
  6008.     *type = local_type;
  6009.     *value = local_value;
  6010.     *tb = local_tb;
  6011. #if CYTHON_FAST_THREAD_STATE
  6012.     #if CYTHON_USE_EXC_INFO_STACK
  6013.     {
  6014.         _PyErr_StackItem *exc_info = tstate->exc_info;
  6015.         tmp_type = exc_info->exc_type;
  6016.         tmp_value = exc_info->exc_value;
  6017.         tmp_tb = exc_info->exc_traceback;
  6018.         exc_info->exc_type = local_type;
  6019.         exc_info->exc_value = local_value;
  6020.         exc_info->exc_traceback = local_tb;
  6021.     }
  6022.     #else
  6023.     tmp_type = tstate->exc_type;
  6024.     tmp_value = tstate->exc_value;
  6025.     tmp_tb = tstate->exc_traceback;
  6026.     tstate->exc_type = local_type;
  6027.     tstate->exc_value = local_value;
  6028.     tstate->exc_traceback = local_tb;
  6029.     #endif
  6030.     Py_XDECREF(tmp_type);
  6031.     Py_XDECREF(tmp_value);
  6032.     Py_XDECREF(tmp_tb);
  6033. #else
  6034.     PyErr_SetExcInfo(local_type, local_value, local_tb);
  6035. #endif
  6036.     return 0;
  6037. bad:
  6038.     *type = 0;
  6039.     *value = 0;
  6040.     *tb = 0;
  6041.     Py_XDECREF(local_type);
  6042.     Py_XDECREF(local_value);
  6043.     Py_XDECREF(local_tb);
  6044.     return -1;
  6045. }
  6046.  
  6047. /* RaiseException */
  6048. #if PY_MAJOR_VERSION < 3
  6049. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  6050.                         CYTHON_UNUSED PyObject *cause) {
  6051.     __Pyx_PyThreadState_declare
  6052.     Py_XINCREF(type);
  6053.     if (!value || value == Py_None)
  6054.         value = NULL;
  6055.     else
  6056.         Py_INCREF(value);
  6057.     if (!tb || tb == Py_None)
  6058.         tb = NULL;
  6059.     else {
  6060.         Py_INCREF(tb);
  6061.         if (!PyTraceBack_Check(tb)) {
  6062.             PyErr_SetString(PyExc_TypeError,
  6063.                 "raise: arg 3 must be a traceback or None");
  6064.             goto raise_error;
  6065.         }
  6066.     }
  6067.     if (PyType_Check(type)) {
  6068. #if CYTHON_COMPILING_IN_PYPY
  6069.         if (!value) {
  6070.             Py_INCREF(Py_None);
  6071.             value = Py_None;
  6072.         }
  6073. #endif
  6074.         PyErr_NormalizeException(&type, &value, &tb);
  6075.     } else {
  6076.         if (value) {
  6077.             PyErr_SetString(PyExc_TypeError,
  6078.                 "instance exception may not have a separate value");
  6079.             goto raise_error;
  6080.         }
  6081.         value = type;
  6082.         type = (PyObject*) Py_TYPE(type);
  6083.         Py_INCREF(type);
  6084.         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  6085.             PyErr_SetString(PyExc_TypeError,
  6086.                 "raise: exception class must be a subclass of BaseException");
  6087.             goto raise_error;
  6088.         }
  6089.     }
  6090.     __Pyx_PyThreadState_assign
  6091.     __Pyx_ErrRestore(type, value, tb);
  6092.     return;
  6093. raise_error:
  6094.     Py_XDECREF(value);
  6095.     Py_XDECREF(type);
  6096.     Py_XDECREF(tb);
  6097.     return;
  6098. }
  6099. #else
  6100. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  6101.     PyObject* owned_instance = NULL;
  6102.     if (tb == Py_None) {
  6103.         tb = 0;
  6104.     } else if (tb && !PyTraceBack_Check(tb)) {
  6105.         PyErr_SetString(PyExc_TypeError,
  6106.             "raise: arg 3 must be a traceback or None");
  6107.         goto bad;
  6108.     }
  6109.     if (value == Py_None)
  6110.         value = 0;
  6111.     if (PyExceptionInstance_Check(type)) {
  6112.         if (value) {
  6113.             PyErr_SetString(PyExc_TypeError,
  6114.                 "instance exception may not have a separate value");
  6115.             goto bad;
  6116.         }
  6117.         value = type;
  6118.         type = (PyObject*) Py_TYPE(value);
  6119.     } else if (PyExceptionClass_Check(type)) {
  6120.         PyObject *instance_class = NULL;
  6121.         if (value && PyExceptionInstance_Check(value)) {
  6122.             instance_class = (PyObject*) Py_TYPE(value);
  6123.             if (instance_class != type) {
  6124.                 int is_subclass = PyObject_IsSubclass(instance_class, type);
  6125.                 if (!is_subclass) {
  6126.                     instance_class = NULL;
  6127.                 } else if (unlikely(is_subclass == -1)) {
  6128.                     goto bad;
  6129.                 } else {
  6130.                     type = instance_class;
  6131.                 }
  6132.             }
  6133.         }
  6134.         if (!instance_class) {
  6135.             PyObject *args;
  6136.             if (!value)
  6137.                 args = PyTuple_New(0);
  6138.             else if (PyTuple_Check(value)) {
  6139.                 Py_INCREF(value);
  6140.                 args = value;
  6141.             } else
  6142.                 args = PyTuple_Pack(1, value);
  6143.             if (!args)
  6144.                 goto bad;
  6145.             owned_instance = PyObject_Call(type, args, NULL);
  6146.             Py_DECREF(args);
  6147.             if (!owned_instance)
  6148.                 goto bad;
  6149.             value = owned_instance;
  6150.             if (!PyExceptionInstance_Check(value)) {
  6151.                 PyErr_Format(PyExc_TypeError,
  6152.                              "calling %R should have returned an instance of "
  6153.                              "BaseException, not %R",
  6154.                              type, Py_TYPE(value));
  6155.                 goto bad;
  6156.             }
  6157.         }
  6158.     } else {
  6159.         PyErr_SetString(PyExc_TypeError,
  6160.             "raise: exception class must be a subclass of BaseException");
  6161.         goto bad;
  6162.     }
  6163.     if (cause) {
  6164.         PyObject *fixed_cause;
  6165.         if (cause == Py_None) {
  6166.             fixed_cause = NULL;
  6167.         } else if (PyExceptionClass_Check(cause)) {
  6168.             fixed_cause = PyObject_CallObject(cause, NULL);
  6169.             if (fixed_cause == NULL)
  6170.                 goto bad;
  6171.         } else if (PyExceptionInstance_Check(cause)) {
  6172.             fixed_cause = cause;
  6173.             Py_INCREF(fixed_cause);
  6174.         } else {
  6175.             PyErr_SetString(PyExc_TypeError,
  6176.                             "exception causes must derive from "
  6177.                             "BaseException");
  6178.             goto bad;
  6179.         }
  6180.         PyException_SetCause(value, fixed_cause);
  6181.     }
  6182.     PyErr_SetObject(type, value);
  6183.     if (tb) {
  6184. #if CYTHON_COMPILING_IN_PYPY
  6185.         PyObject *tmp_type, *tmp_value, *tmp_tb;
  6186.         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  6187.         Py_INCREF(tb);
  6188.         PyErr_Restore(tmp_type, tmp_value, tb);
  6189.         Py_XDECREF(tmp_tb);
  6190. #else
  6191.         PyThreadState *tstate = __Pyx_PyThreadState_Current;
  6192.         PyObject* tmp_tb = tstate->curexc_traceback;
  6193.         if (tb != tmp_tb) {
  6194.             Py_INCREF(tb);
  6195.             tstate->curexc_traceback = tb;
  6196.             Py_XDECREF(tmp_tb);
  6197.         }
  6198. #endif
  6199.     }
  6200. bad:
  6201.     Py_XDECREF(owned_instance);
  6202.     return;
  6203. }
  6204. #endif
  6205.  
  6206. /* RaiseTooManyValuesToUnpack */
  6207. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  6208.     PyErr_Format(PyExc_ValueError,
  6209.                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  6210. }
  6211.  
  6212. /* RaiseNeedMoreValuesToUnpack */
  6213. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  6214.     PyErr_Format(PyExc_ValueError,
  6215.                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  6216.                  index, (index == 1) ? "" : "s");
  6217. }
  6218.  
  6219. /* IterFinish */
  6220. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  6221. #if CYTHON_FAST_THREAD_STATE
  6222.     PyThreadState *tstate = __Pyx_PyThreadState_Current;
  6223.     PyObject* exc_type = tstate->curexc_type;
  6224.     if (unlikely(exc_type)) {
  6225.         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
  6226.             PyObject *exc_value, *exc_tb;
  6227.             exc_value = tstate->curexc_value;
  6228.             exc_tb = tstate->curexc_traceback;
  6229.             tstate->curexc_type = 0;
  6230.             tstate->curexc_value = 0;
  6231.             tstate->curexc_traceback = 0;
  6232.             Py_DECREF(exc_type);
  6233.             Py_XDECREF(exc_value);
  6234.             Py_XDECREF(exc_tb);
  6235.             return 0;
  6236.         } else {
  6237.             return -1;
  6238.         }
  6239.     }
  6240.     return 0;
  6241. #else
  6242.     if (unlikely(PyErr_Occurred())) {
  6243.         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
  6244.             PyErr_Clear();
  6245.             return 0;
  6246.         } else {
  6247.             return -1;
  6248.         }
  6249.     }
  6250.     return 0;
  6251. #endif
  6252. }
  6253.  
  6254. /* UnpackItemEndCheck */
  6255. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  6256.     if (unlikely(retval)) {
  6257.         Py_DECREF(retval);
  6258.         __Pyx_RaiseTooManyValuesError(expected);
  6259.         return -1;
  6260.     } else {
  6261.         return __Pyx_IterFinish();
  6262.     }
  6263.     return 0;
  6264. }
  6265.  
  6266. /* TypeImport */
  6267. #ifndef __PYX_HAVE_RT_ImportType
  6268. #define __PYX_HAVE_RT_ImportType
  6269. static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
  6270.     size_t size, enum __Pyx_ImportType_CheckSize check_size)
  6271. {
  6272.     PyObject *result = 0;
  6273.     char warning[200];
  6274.     Py_ssize_t basicsize;
  6275. #ifdef Py_LIMITED_API
  6276.     PyObject *py_basicsize;
  6277. #endif
  6278.     result = PyObject_GetAttrString(module, class_name);
  6279.     if (!result)
  6280.         goto bad;
  6281.     if (!PyType_Check(result)) {
  6282.         PyErr_Format(PyExc_TypeError,
  6283.             "%.200s.%.200s is not a type object",
  6284.             module_name, class_name);
  6285.         goto bad;
  6286.     }
  6287. #ifndef Py_LIMITED_API
  6288.     basicsize = ((PyTypeObject *)result)->tp_basicsize;
  6289. #else
  6290.     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  6291.     if (!py_basicsize)
  6292.         goto bad;
  6293.     basicsize = PyLong_AsSsize_t(py_basicsize);
  6294.     Py_DECREF(py_basicsize);
  6295.     py_basicsize = 0;
  6296.     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  6297.         goto bad;
  6298. #endif
  6299.     if ((size_t)basicsize < size) {
  6300.         PyErr_Format(PyExc_ValueError,
  6301.             "%.200s.%.200s size changed, may indicate binary incompatibility. "
  6302.             "Expected %zd from C header, got %zd from PyObject",
  6303.             module_name, class_name, size, basicsize);
  6304.         goto bad;
  6305.     }
  6306.     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
  6307.         PyErr_Format(PyExc_ValueError,
  6308.             "%.200s.%.200s size changed, may indicate binary incompatibility. "
  6309.             "Expected %zd from C header, got %zd from PyObject",
  6310.             module_name, class_name, size, basicsize);
  6311.         goto bad;
  6312.     }
  6313.     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
  6314.         PyOS_snprintf(warning, sizeof(warning),
  6315.             "%s.%s size changed, may indicate binary incompatibility. "
  6316.             "Expected %zd from C header, got %zd from PyObject",
  6317.             module_name, class_name, size, basicsize);
  6318.         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  6319.     }
  6320.     return (PyTypeObject *)result;
  6321. bad:
  6322.     Py_XDECREF(result);
  6323.     return NULL;
  6324. }
  6325. #endif
  6326.  
  6327. /* Import */
  6328. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  6329.     PyObject *empty_list = 0;
  6330.     PyObject *module = 0;
  6331.     PyObject *global_dict = 0;
  6332.     PyObject *empty_dict = 0;
  6333.     PyObject *list;
  6334.     #if PY_MAJOR_VERSION < 3
  6335.     PyObject *py_import;
  6336.     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  6337.     if (!py_import)
  6338.         goto bad;
  6339.     #endif
  6340.     if (from_list)
  6341.         list = from_list;
  6342.     else {
  6343.         empty_list = PyList_New(0);
  6344.         if (!empty_list)
  6345.             goto bad;
  6346.         list = empty_list;
  6347.     }
  6348.     global_dict = PyModule_GetDict(__pyx_m);
  6349.     if (!global_dict)
  6350.         goto bad;
  6351.     empty_dict = PyDict_New();
  6352.     if (!empty_dict)
  6353.         goto bad;
  6354.     {
  6355.         #if PY_MAJOR_VERSION >= 3
  6356.         if (level == -1) {
  6357.             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
  6358.                 module = PyImport_ImportModuleLevelObject(
  6359.                     name, global_dict, empty_dict, list, 1);
  6360.                 if (!module) {
  6361.                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
  6362.                         goto bad;
  6363.                     PyErr_Clear();
  6364.                 }
  6365.             }
  6366.             level = 0;
  6367.         }
  6368.         #endif
  6369.         if (!module) {
  6370.             #if PY_MAJOR_VERSION < 3
  6371.             PyObject *py_level = PyInt_FromLong(level);
  6372.             if (!py_level)
  6373.                 goto bad;
  6374.             module = PyObject_CallFunctionObjArgs(py_import,
  6375.                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
  6376.             Py_DECREF(py_level);
  6377.             #else
  6378.             module = PyImport_ImportModuleLevelObject(
  6379.                 name, global_dict, empty_dict, list, level);
  6380.             #endif
  6381.         }
  6382.     }
  6383. bad:
  6384.     #if PY_MAJOR_VERSION < 3
  6385.     Py_XDECREF(py_import);
  6386.     #endif
  6387.     Py_XDECREF(empty_list);
  6388.     Py_XDECREF(empty_dict);
  6389.     return module;
  6390. }
  6391.  
  6392. /* CLineInTraceback */
  6393. #ifndef CYTHON_CLINE_IN_TRACEBACK
  6394. static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
  6395.     PyObject *use_cline;
  6396.     PyObject *ptype, *pvalue, *ptraceback;
  6397. #if CYTHON_COMPILING_IN_CPYTHON
  6398.     PyObject **cython_runtime_dict;
  6399. #endif
  6400.     if (unlikely(!__pyx_cython_runtime)) {
  6401.         return c_line;
  6402.     }
  6403.     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  6404. #if CYTHON_COMPILING_IN_CPYTHON
  6405.     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  6406.     if (likely(cython_runtime_dict)) {
  6407.         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  6408.             use_cline, *cython_runtime_dict,
  6409.             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  6410.     } else
  6411. #endif
  6412.     {
  6413.       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  6414.       if (use_cline_obj) {
  6415.         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  6416.         Py_DECREF(use_cline_obj);
  6417.       } else {
  6418.         PyErr_Clear();
  6419.         use_cline = NULL;
  6420.       }
  6421.     }
  6422.     if (!use_cline) {
  6423.         c_line = 0;
  6424.         (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  6425.     }
  6426.     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  6427.         c_line = 0;
  6428.     }
  6429.     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  6430.     return c_line;
  6431. }
  6432. #endif
  6433.  
  6434. /* CodeObjectCache */
  6435. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  6436.     int start = 0, mid = 0, end = count - 1;
  6437.     if (end >= 0 && code_line > entries[end].code_line) {
  6438.         return count;
  6439.     }
  6440.     while (start < end) {
  6441.         mid = start + (end - start) / 2;
  6442.         if (code_line < entries[mid].code_line) {
  6443.             end = mid;
  6444.         } else if (code_line > entries[mid].code_line) {
  6445.              start = mid + 1;
  6446.         } else {
  6447.             return mid;
  6448.         }
  6449.     }
  6450.     if (code_line <= entries[mid].code_line) {
  6451.         return mid;
  6452.     } else {
  6453.         return mid + 1;
  6454.     }
  6455. }
  6456. static PyCodeObject *__pyx_find_code_object(int code_line) {
  6457.     PyCodeObject* code_object;
  6458.     int pos;
  6459.     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  6460.         return NULL;
  6461.     }
  6462.     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  6463.     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  6464.         return NULL;
  6465.     }
  6466.     code_object = __pyx_code_cache.entries[pos].code_object;
  6467.     Py_INCREF(code_object);
  6468.     return code_object;
  6469. }
  6470. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  6471.     int pos, i;
  6472.     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  6473.     if (unlikely(!code_line)) {
  6474.         return;
  6475.     }
  6476.     if (unlikely(!entries)) {
  6477.         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  6478.         if (likely(entries)) {
  6479.             __pyx_code_cache.entries = entries;
  6480.             __pyx_code_cache.max_count = 64;
  6481.             __pyx_code_cache.count = 1;
  6482.             entries[0].code_line = code_line;
  6483.             entries[0].code_object = code_object;
  6484.             Py_INCREF(code_object);
  6485.         }
  6486.         return;
  6487.     }
  6488.     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  6489.     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  6490.         PyCodeObject* tmp = entries[pos].code_object;
  6491.         entries[pos].code_object = code_object;
  6492.         Py_DECREF(tmp);
  6493.         return;
  6494.     }
  6495.     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  6496.         int new_max = __pyx_code_cache.max_count + 64;
  6497.         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  6498.             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  6499.         if (unlikely(!entries)) {
  6500.             return;
  6501.         }
  6502.         __pyx_code_cache.entries = entries;
  6503.         __pyx_code_cache.max_count = new_max;
  6504.     }
  6505.     for (i=__pyx_code_cache.count; i>pos; i--) {
  6506.         entries[i] = entries[i-1];
  6507.     }
  6508.     entries[pos].code_line = code_line;
  6509.     entries[pos].code_object = code_object;
  6510.     __pyx_code_cache.count++;
  6511.     Py_INCREF(code_object);
  6512. }
  6513.  
  6514. /* AddTraceback */
  6515. #include "compile.h"
  6516. #include "frameobject.h"
  6517. #include "traceback.h"
  6518. #if PY_VERSION_HEX >= 0x030b00a6
  6519.   #ifndef Py_BUILD_CORE
  6520.     #define Py_BUILD_CORE 1
  6521.   #endif
  6522.   #include "internal/pycore_frame.h"
  6523. #endif
  6524. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  6525.             const char *funcname, int c_line,
  6526.             int py_line, const char *filename) {
  6527.     PyCodeObject *py_code = NULL;
  6528.     PyObject *py_funcname = NULL;
  6529.     #if PY_MAJOR_VERSION < 3
  6530.     PyObject *py_srcfile = NULL;
  6531.     py_srcfile = PyString_FromString(filename);
  6532.     if (!py_srcfile) goto bad;
  6533.     #endif
  6534.     if (c_line) {
  6535.         #if PY_MAJOR_VERSION < 3
  6536.         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  6537.         if (!py_funcname) goto bad;
  6538.         #else
  6539.         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  6540.         if (!py_funcname) goto bad;
  6541.         funcname = PyUnicode_AsUTF8(py_funcname);
  6542.         if (!funcname) goto bad;
  6543.         #endif
  6544.     }
  6545.     else {
  6546.         #if PY_MAJOR_VERSION < 3
  6547.         py_funcname = PyString_FromString(funcname);
  6548.         if (!py_funcname) goto bad;
  6549.         #endif
  6550.     }
  6551.     #if PY_MAJOR_VERSION < 3
  6552.     py_code = __Pyx_PyCode_New(
  6553.         0,
  6554.         0,
  6555.         0,
  6556.         0,
  6557.         0,
  6558.         __pyx_empty_bytes, /*PyObject *code,*/
  6559.         __pyx_empty_tuple, /*PyObject *consts,*/
  6560.         __pyx_empty_tuple, /*PyObject *names,*/
  6561.         __pyx_empty_tuple, /*PyObject *varnames,*/
  6562.         __pyx_empty_tuple, /*PyObject *freevars,*/
  6563.         __pyx_empty_tuple, /*PyObject *cellvars,*/
  6564.         py_srcfile,   /*PyObject *filename,*/
  6565.         py_funcname,  /*PyObject *name,*/
  6566.         py_line,
  6567.         __pyx_empty_bytes  /*PyObject *lnotab*/
  6568.     );
  6569.     Py_DECREF(py_srcfile);
  6570.     #else
  6571.     py_code = PyCode_NewEmpty(filename, funcname, py_line);
  6572.     #endif
  6573.     Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
  6574.     return py_code;
  6575. bad:
  6576.     Py_XDECREF(py_funcname);
  6577.     #if PY_MAJOR_VERSION < 3
  6578.     Py_XDECREF(py_srcfile);
  6579.     #endif
  6580.     return NULL;
  6581. }
  6582. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  6583.                                int py_line, const char *filename) {
  6584.     PyCodeObject *py_code = 0;
  6585.     PyFrameObject *py_frame = 0;
  6586.     PyThreadState *tstate = __Pyx_PyThreadState_Current;
  6587.     PyObject *ptype, *pvalue, *ptraceback;
  6588.     if (c_line) {
  6589.         c_line = __Pyx_CLineForTraceback(tstate, c_line);
  6590.     }
  6591.     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  6592.     if (!py_code) {
  6593.         __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  6594.         py_code = __Pyx_CreateCodeObjectForTraceback(
  6595.             funcname, c_line, py_line, filename);
  6596.         if (!py_code) {
  6597.             /* If the code object creation fails, then we should clear the
  6598.                fetched exception references and propagate the new exception */
  6599.             Py_XDECREF(ptype);
  6600.             Py_XDECREF(pvalue);
  6601.             Py_XDECREF(ptraceback);
  6602.             goto bad;
  6603.         }
  6604.         __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  6605.         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  6606.     }
  6607.     py_frame = PyFrame_New(
  6608.         tstate,            /*PyThreadState *tstate,*/
  6609.         py_code,           /*PyCodeObject *code,*/
  6610.         __pyx_d,    /*PyObject *globals,*/
  6611.         0                  /*PyObject *locals*/
  6612.     );
  6613.     if (!py_frame) goto bad;
  6614.     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  6615.     PyTraceBack_Here(py_frame);
  6616. bad:
  6617.     Py_XDECREF(py_code);
  6618.     Py_XDECREF(py_frame);
  6619. }
  6620.  
  6621. /* CIntFromPyVerify */
  6622. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  6623.     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  6624. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  6625.     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  6626. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  6627.     {\
  6628.         func_type value = func_value;\
  6629.         if (sizeof(target_type) < sizeof(func_type)) {\
  6630.             if (unlikely(value != (func_type) (target_type) value)) {\
  6631.                 func_type zero = 0;\
  6632.                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  6633.                     return (target_type) -1;\
  6634.                 if (is_unsigned && unlikely(value < zero))\
  6635.                     goto raise_neg_overflow;\
  6636.                 else\
  6637.                     goto raise_overflow;\
  6638.             }\
  6639.         }\
  6640.         return (target_type) value;\
  6641.     }
  6642.  
  6643. /* Declarations */
  6644. #if CYTHON_CCOMPLEX
  6645.   #ifdef __cplusplus
  6646.     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  6647.       return ::std::complex< float >(x, y);
  6648.     }
  6649.   #else
  6650.     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  6651.       return x + y*(__pyx_t_float_complex)_Complex_I;
  6652.     }
  6653.   #endif
  6654. #else
  6655.     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  6656.       __pyx_t_float_complex z;
  6657.       z.real = x;
  6658.       z.imag = y;
  6659.       return z;
  6660.     }
  6661. #endif
  6662.  
  6663. /* Arithmetic */
  6664. #if CYTHON_CCOMPLEX
  6665. #else
  6666.     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6667.        return (a.real == b.real) && (a.imag == b.imag);
  6668.     }
  6669.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6670.         __pyx_t_float_complex z;
  6671.         z.real = a.real + b.real;
  6672.         z.imag = a.imag + b.imag;
  6673.         return z;
  6674.     }
  6675.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6676.         __pyx_t_float_complex z;
  6677.         z.real = a.real - b.real;
  6678.         z.imag = a.imag - b.imag;
  6679.         return z;
  6680.     }
  6681.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6682.         __pyx_t_float_complex z;
  6683.         z.real = a.real * b.real - a.imag * b.imag;
  6684.         z.imag = a.real * b.imag + a.imag * b.real;
  6685.         return z;
  6686.     }
  6687.     #if 1
  6688.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6689.         if (b.imag == 0) {
  6690.             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
  6691.         } else if (fabsf(b.real) >= fabsf(b.imag)) {
  6692.             if (b.real == 0 && b.imag == 0) {
  6693.                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
  6694.             } else {
  6695.                 float r = b.imag / b.real;
  6696.                 float s = (float)(1.0) / (b.real + b.imag * r);
  6697.                 return __pyx_t_float_complex_from_parts(
  6698.                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  6699.             }
  6700.         } else {
  6701.             float r = b.real / b.imag;
  6702.             float s = (float)(1.0) / (b.imag + b.real * r);
  6703.             return __pyx_t_float_complex_from_parts(
  6704.                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  6705.         }
  6706.     }
  6707.     #else
  6708.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6709.         if (b.imag == 0) {
  6710.             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
  6711.         } else {
  6712.             float denom = b.real * b.real + b.imag * b.imag;
  6713.             return __pyx_t_float_complex_from_parts(
  6714.                 (a.real * b.real + a.imag * b.imag) / denom,
  6715.                 (a.imag * b.real - a.real * b.imag) / denom);
  6716.         }
  6717.     }
  6718.     #endif
  6719.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
  6720.         __pyx_t_float_complex z;
  6721.         z.real = -a.real;
  6722.         z.imag = -a.imag;
  6723.         return z;
  6724.     }
  6725.     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
  6726.        return (a.real == 0) && (a.imag == 0);
  6727.     }
  6728.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
  6729.         __pyx_t_float_complex z;
  6730.         z.real =  a.real;
  6731.         z.imag = -a.imag;
  6732.         return z;
  6733.     }
  6734.     #if 1
  6735.         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
  6736.           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  6737.             return sqrtf(z.real*z.real + z.imag*z.imag);
  6738.           #else
  6739.             return hypotf(z.real, z.imag);
  6740.           #endif
  6741.         }
  6742.         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6743.             __pyx_t_float_complex z;
  6744.             float r, lnr, theta, z_r, z_theta;
  6745.             if (b.imag == 0 && b.real == (int)b.real) {
  6746.                 if (b.real < 0) {
  6747.                     float denom = a.real * a.real + a.imag * a.imag;
  6748.                     a.real = a.real / denom;
  6749.                     a.imag = -a.imag / denom;
  6750.                     b.real = -b.real;
  6751.                 }
  6752.                 switch ((int)b.real) {
  6753.                     case 0:
  6754.                         z.real = 1;
  6755.                         z.imag = 0;
  6756.                         return z;
  6757.                     case 1:
  6758.                         return a;
  6759.                     case 2:
  6760.                         return __Pyx_c_prod_float(a, a);
  6761.                     case 3:
  6762.                         z = __Pyx_c_prod_float(a, a);
  6763.                         return __Pyx_c_prod_float(z, a);
  6764.                     case 4:
  6765.                         z = __Pyx_c_prod_float(a, a);
  6766.                         return __Pyx_c_prod_float(z, z);
  6767.                 }
  6768.             }
  6769.             if (a.imag == 0) {
  6770.                 if (a.real == 0) {
  6771.                     return a;
  6772.                 } else if (b.imag == 0) {
  6773.                     z.real = powf(a.real, b.real);
  6774.                     z.imag = 0;
  6775.                     return z;
  6776.                 } else if (a.real > 0) {
  6777.                     r = a.real;
  6778.                     theta = 0;
  6779.                 } else {
  6780.                     r = -a.real;
  6781.                     theta = atan2f(0.0, -1.0);
  6782.                 }
  6783.             } else {
  6784.                 r = __Pyx_c_abs_float(a);
  6785.                 theta = atan2f(a.imag, a.real);
  6786.             }
  6787.             lnr = logf(r);
  6788.             z_r = expf(lnr * b.real - theta * b.imag);
  6789.             z_theta = theta * b.real + lnr * b.imag;
  6790.             z.real = z_r * cosf(z_theta);
  6791.             z.imag = z_r * sinf(z_theta);
  6792.             return z;
  6793.         }
  6794.     #endif
  6795. #endif
  6796.  
  6797. /* Declarations */
  6798. #if CYTHON_CCOMPLEX
  6799.   #ifdef __cplusplus
  6800.     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  6801.       return ::std::complex< double >(x, y);
  6802.     }
  6803.   #else
  6804.     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  6805.       return x + y*(__pyx_t_double_complex)_Complex_I;
  6806.     }
  6807.   #endif
  6808. #else
  6809.     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  6810.       __pyx_t_double_complex z;
  6811.       z.real = x;
  6812.       z.imag = y;
  6813.       return z;
  6814.     }
  6815. #endif
  6816.  
  6817. /* Arithmetic */
  6818. #if CYTHON_CCOMPLEX
  6819. #else
  6820.     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6821.        return (a.real == b.real) && (a.imag == b.imag);
  6822.     }
  6823.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6824.         __pyx_t_double_complex z;
  6825.         z.real = a.real + b.real;
  6826.         z.imag = a.imag + b.imag;
  6827.         return z;
  6828.     }
  6829.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6830.         __pyx_t_double_complex z;
  6831.         z.real = a.real - b.real;
  6832.         z.imag = a.imag - b.imag;
  6833.         return z;
  6834.     }
  6835.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6836.         __pyx_t_double_complex z;
  6837.         z.real = a.real * b.real - a.imag * b.imag;
  6838.         z.imag = a.real * b.imag + a.imag * b.real;
  6839.         return z;
  6840.     }
  6841.     #if 1
  6842.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6843.         if (b.imag == 0) {
  6844.             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  6845.         } else if (fabs(b.real) >= fabs(b.imag)) {
  6846.             if (b.real == 0 && b.imag == 0) {
  6847.                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
  6848.             } else {
  6849.                 double r = b.imag / b.real;
  6850.                 double s = (double)(1.0) / (b.real + b.imag * r);
  6851.                 return __pyx_t_double_complex_from_parts(
  6852.                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  6853.             }
  6854.         } else {
  6855.             double r = b.real / b.imag;
  6856.             double s = (double)(1.0) / (b.imag + b.real * r);
  6857.             return __pyx_t_double_complex_from_parts(
  6858.                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  6859.         }
  6860.     }
  6861.     #else
  6862.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6863.         if (b.imag == 0) {
  6864.             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  6865.         } else {
  6866.             double denom = b.real * b.real + b.imag * b.imag;
  6867.             return __pyx_t_double_complex_from_parts(
  6868.                 (a.real * b.real + a.imag * b.imag) / denom,
  6869.                 (a.imag * b.real - a.real * b.imag) / denom);
  6870.         }
  6871.     }
  6872.     #endif
  6873.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
  6874.         __pyx_t_double_complex z;
  6875.         z.real = -a.real;
  6876.         z.imag = -a.imag;
  6877.         return z;
  6878.     }
  6879.     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  6880.        return (a.real == 0) && (a.imag == 0);
  6881.     }
  6882.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
  6883.         __pyx_t_double_complex z;
  6884.         z.real =  a.real;
  6885.         z.imag = -a.imag;
  6886.         return z;
  6887.     }
  6888.     #if 1
  6889.         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  6890.           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  6891.             return sqrt(z.real*z.real + z.imag*z.imag);
  6892.           #else
  6893.             return hypot(z.real, z.imag);
  6894.           #endif
  6895.         }
  6896.         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  6897.             __pyx_t_double_complex z;
  6898.             double r, lnr, theta, z_r, z_theta;
  6899.             if (b.imag == 0 && b.real == (int)b.real) {
  6900.                 if (b.real < 0) {
  6901.                     double denom = a.real * a.real + a.imag * a.imag;
  6902.                     a.real = a.real / denom;
  6903.                     a.imag = -a.imag / denom;
  6904.                     b.real = -b.real;
  6905.                 }
  6906.                 switch ((int)b.real) {
  6907.                     case 0:
  6908.                         z.real = 1;
  6909.                         z.imag = 0;
  6910.                         return z;
  6911.                     case 1:
  6912.                         return a;
  6913.                     case 2:
  6914.                         return __Pyx_c_prod_double(a, a);
  6915.                     case 3:
  6916.                         z = __Pyx_c_prod_double(a, a);
  6917.                         return __Pyx_c_prod_double(z, a);
  6918.                     case 4:
  6919.                         z = __Pyx_c_prod_double(a, a);
  6920.                         return __Pyx_c_prod_double(z, z);
  6921.                 }
  6922.             }
  6923.             if (a.imag == 0) {
  6924.                 if (a.real == 0) {
  6925.                     return a;
  6926.                 } else if (b.imag == 0) {
  6927.                     z.real = pow(a.real, b.real);
  6928.                     z.imag = 0;
  6929.                     return z;
  6930.                 } else if (a.real > 0) {
  6931.                     r = a.real;
  6932.                     theta = 0;
  6933.                 } else {
  6934.                     r = -a.real;
  6935.                     theta = atan2(0.0, -1.0);
  6936.                 }
  6937.             } else {
  6938.                 r = __Pyx_c_abs_double(a);
  6939.                 theta = atan2(a.imag, a.real);
  6940.             }
  6941.             lnr = log(r);
  6942.             z_r = exp(lnr * b.real - theta * b.imag);
  6943.             z_theta = theta * b.real + lnr * b.imag;
  6944.             z.real = z_r * cos(z_theta);
  6945.             z.imag = z_r * sin(z_theta);
  6946.             return z;
  6947.         }
  6948.     #endif
  6949. #endif
  6950.  
  6951. /* CIntFromPy */
  6952. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  6953. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  6954. #pragma GCC diagnostic push
  6955. #pragma GCC diagnostic ignored "-Wconversion"
  6956. #endif
  6957.     const int neg_one = (int) -1, const_zero = (int) 0;
  6958. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  6959. #pragma GCC diagnostic pop
  6960. #endif
  6961.     const int is_unsigned = neg_one > const_zero;
  6962. #if PY_MAJOR_VERSION < 3
  6963.     if (likely(PyInt_Check(x))) {
  6964.         if (sizeof(int) < sizeof(long)) {
  6965.             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  6966.         } else {
  6967.             long val = PyInt_AS_LONG(x);
  6968.             if (is_unsigned && unlikely(val < 0)) {
  6969.                 goto raise_neg_overflow;
  6970.             }
  6971.             return (int) val;
  6972.         }
  6973.     } else
  6974. #endif
  6975.     if (likely(PyLong_Check(x))) {
  6976.         if (is_unsigned) {
  6977. #if CYTHON_USE_PYLONG_INTERNALS
  6978.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  6979.             switch (Py_SIZE(x)) {
  6980.                 case  0: return (int) 0;
  6981.                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  6982.                 case 2:
  6983.                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  6984.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  6985.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  6986.                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  6987.                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  6988.                         }
  6989.                     }
  6990.                     break;
  6991.                 case 3:
  6992.                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  6993.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  6994.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  6995.                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  6996.                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  6997.                         }
  6998.                     }
  6999.                     break;
  7000.                 case 4:
  7001.                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  7002.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7003.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7004.                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  7005.                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  7006.                         }
  7007.                     }
  7008.                     break;
  7009.             }
  7010. #endif
  7011. #if CYTHON_COMPILING_IN_CPYTHON
  7012.             if (unlikely(Py_SIZE(x) < 0)) {
  7013.                 goto raise_neg_overflow;
  7014.             }
  7015. #else
  7016.             {
  7017.                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  7018.                 if (unlikely(result < 0))
  7019.                     return (int) -1;
  7020.                 if (unlikely(result == 1))
  7021.                     goto raise_neg_overflow;
  7022.             }
  7023. #endif
  7024.             if (sizeof(int) <= sizeof(unsigned long)) {
  7025.                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  7026. #ifdef HAVE_LONG_LONG
  7027.             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  7028.                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  7029. #endif
  7030.             }
  7031.         } else {
  7032. #if CYTHON_USE_PYLONG_INTERNALS
  7033.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  7034.             switch (Py_SIZE(x)) {
  7035.                 case  0: return (int) 0;
  7036.                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  7037.                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
  7038.                 case -2:
  7039.                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  7040.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7041.                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7042.                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  7043.                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7044.                         }
  7045.                     }
  7046.                     break;
  7047.                 case 2:
  7048.                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  7049.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7050.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7051.                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  7052.                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7053.                         }
  7054.                     }
  7055.                     break;
  7056.                 case -3:
  7057.                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  7058.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7059.                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7060.                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  7061.                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7062.                         }
  7063.                     }
  7064.                     break;
  7065.                 case 3:
  7066.                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  7067.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7068.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7069.                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  7070.                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7071.                         }
  7072.                     }
  7073.                     break;
  7074.                 case -4:
  7075.                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  7076.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7077.                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7078.                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  7079.                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7080.                         }
  7081.                     }
  7082.                     break;
  7083.                 case 4:
  7084.                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  7085.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7086.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7087.                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  7088.                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7089.                         }
  7090.                     }
  7091.                     break;
  7092.             }
  7093. #endif
  7094.             if (sizeof(int) <= sizeof(long)) {
  7095.                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  7096. #ifdef HAVE_LONG_LONG
  7097.             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  7098.                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  7099. #endif
  7100.             }
  7101.         }
  7102.         {
  7103. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  7104.             PyErr_SetString(PyExc_RuntimeError,
  7105.                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  7106. #else
  7107.             int val;
  7108.             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  7109.  #if PY_MAJOR_VERSION < 3
  7110.             if (likely(v) && !PyLong_Check(v)) {
  7111.                 PyObject *tmp = v;
  7112.                 v = PyNumber_Long(tmp);
  7113.                 Py_DECREF(tmp);
  7114.             }
  7115.  #endif
  7116.             if (likely(v)) {
  7117.                 int one = 1; int is_little = (int)*(unsigned char *)&one;
  7118.                 unsigned char *bytes = (unsigned char *)&val;
  7119.                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
  7120.                                               bytes, sizeof(val),
  7121.                                               is_little, !is_unsigned);
  7122.                 Py_DECREF(v);
  7123.                 if (likely(!ret))
  7124.                     return val;
  7125.             }
  7126. #endif
  7127.             return (int) -1;
  7128.         }
  7129.     } else {
  7130.         int val;
  7131.         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  7132.         if (!tmp) return (int) -1;
  7133.         val = __Pyx_PyInt_As_int(tmp);
  7134.         Py_DECREF(tmp);
  7135.         return val;
  7136.     }
  7137. raise_overflow:
  7138.     PyErr_SetString(PyExc_OverflowError,
  7139.         "value too large to convert to int");
  7140.     return (int) -1;
  7141. raise_neg_overflow:
  7142.     PyErr_SetString(PyExc_OverflowError,
  7143.         "can't convert negative value to int");
  7144.     return (int) -1;
  7145. }
  7146.  
  7147. /* CIntToPy */
  7148. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
  7149. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7150. #pragma GCC diagnostic push
  7151. #pragma GCC diagnostic ignored "-Wconversion"
  7152. #endif
  7153.     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
  7154. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7155. #pragma GCC diagnostic pop
  7156. #endif
  7157.     const int is_unsigned = neg_one > const_zero;
  7158.     if (is_unsigned) {
  7159.         if (sizeof(Py_intptr_t) < sizeof(long)) {
  7160.             return PyInt_FromLong((long) value);
  7161.         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
  7162.             return PyLong_FromUnsignedLong((unsigned long) value);
  7163. #ifdef HAVE_LONG_LONG
  7164.         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
  7165.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7166. #endif
  7167.         }
  7168.     } else {
  7169.         if (sizeof(Py_intptr_t) <= sizeof(long)) {
  7170.             return PyInt_FromLong((long) value);
  7171. #ifdef HAVE_LONG_LONG
  7172.         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
  7173.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  7174. #endif
  7175.         }
  7176.     }
  7177.     {
  7178.         int one = 1; int little = (int)*(unsigned char *)&one;
  7179.         unsigned char *bytes = (unsigned char *)&value;
  7180.         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
  7181.                                      little, !is_unsigned);
  7182.     }
  7183. }
  7184.  
  7185. /* CIntToPy */
  7186. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  7187. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7188. #pragma GCC diagnostic push
  7189. #pragma GCC diagnostic ignored "-Wconversion"
  7190. #endif
  7191.     const int neg_one = (int) -1, const_zero = (int) 0;
  7192. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7193. #pragma GCC diagnostic pop
  7194. #endif
  7195.     const int is_unsigned = neg_one > const_zero;
  7196.     if (is_unsigned) {
  7197.         if (sizeof(int) < sizeof(long)) {
  7198.             return PyInt_FromLong((long) value);
  7199.         } else if (sizeof(int) <= sizeof(unsigned long)) {
  7200.             return PyLong_FromUnsignedLong((unsigned long) value);
  7201. #ifdef HAVE_LONG_LONG
  7202.         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  7203.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7204. #endif
  7205.         }
  7206.     } else {
  7207.         if (sizeof(int) <= sizeof(long)) {
  7208.             return PyInt_FromLong((long) value);
  7209. #ifdef HAVE_LONG_LONG
  7210.         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  7211.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  7212. #endif
  7213.         }
  7214.     }
  7215.     {
  7216.         int one = 1; int little = (int)*(unsigned char *)&one;
  7217.         unsigned char *bytes = (unsigned char *)&value;
  7218.         return _PyLong_FromByteArray(bytes, sizeof(int),
  7219.                                      little, !is_unsigned);
  7220.     }
  7221. }
  7222.  
  7223. /* CIntToPy */
  7224. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) {
  7225. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7226. #pragma GCC diagnostic push
  7227. #pragma GCC diagnostic ignored "-Wconversion"
  7228. #endif
  7229.     const npy_int32 neg_one = (npy_int32) -1, const_zero = (npy_int32) 0;
  7230. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7231. #pragma GCC diagnostic pop
  7232. #endif
  7233.     const int is_unsigned = neg_one > const_zero;
  7234.     if (is_unsigned) {
  7235.         if (sizeof(npy_int32) < sizeof(long)) {
  7236.             return PyInt_FromLong((long) value);
  7237.         } else if (sizeof(npy_int32) <= sizeof(unsigned long)) {
  7238.             return PyLong_FromUnsignedLong((unsigned long) value);
  7239. #ifdef HAVE_LONG_LONG
  7240.         } else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) {
  7241.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7242. #endif
  7243.         }
  7244.     } else {
  7245.         if (sizeof(npy_int32) <= sizeof(long)) {
  7246.             return PyInt_FromLong((long) value);
  7247. #ifdef HAVE_LONG_LONG
  7248.         } else if (sizeof(npy_int32) <= sizeof(PY_LONG_LONG)) {
  7249.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  7250. #endif
  7251.         }
  7252.     }
  7253.     {
  7254.         int one = 1; int little = (int)*(unsigned char *)&one;
  7255.         unsigned char *bytes = (unsigned char *)&value;
  7256.         return _PyLong_FromByteArray(bytes, sizeof(npy_int32),
  7257.                                      little, !is_unsigned);
  7258.     }
  7259. }
  7260.  
  7261. /* CIntToPy */
  7262. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  7263. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7264. #pragma GCC diagnostic push
  7265. #pragma GCC diagnostic ignored "-Wconversion"
  7266. #endif
  7267.     const long neg_one = (long) -1, const_zero = (long) 0;
  7268. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7269. #pragma GCC diagnostic pop
  7270. #endif
  7271.     const int is_unsigned = neg_one > const_zero;
  7272.     if (is_unsigned) {
  7273.         if (sizeof(long) < sizeof(long)) {
  7274.             return PyInt_FromLong((long) value);
  7275.         } else if (sizeof(long) <= sizeof(unsigned long)) {
  7276.             return PyLong_FromUnsignedLong((unsigned long) value);
  7277. #ifdef HAVE_LONG_LONG
  7278.         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  7279.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7280. #endif
  7281.         }
  7282.     } else {
  7283.         if (sizeof(long) <= sizeof(long)) {
  7284.             return PyInt_FromLong((long) value);
  7285. #ifdef HAVE_LONG_LONG
  7286.         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  7287.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  7288. #endif
  7289.         }
  7290.     }
  7291.     {
  7292.         int one = 1; int little = (int)*(unsigned char *)&one;
  7293.         unsigned char *bytes = (unsigned char *)&value;
  7294.         return _PyLong_FromByteArray(bytes, sizeof(long),
  7295.                                      little, !is_unsigned);
  7296.     }
  7297. }
  7298.  
  7299. /* CIntFromPy */
  7300. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  7301. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7302. #pragma GCC diagnostic push
  7303. #pragma GCC diagnostic ignored "-Wconversion"
  7304. #endif
  7305.     const long neg_one = (long) -1, const_zero = (long) 0;
  7306. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  7307. #pragma GCC diagnostic pop
  7308. #endif
  7309.     const int is_unsigned = neg_one > const_zero;
  7310. #if PY_MAJOR_VERSION < 3
  7311.     if (likely(PyInt_Check(x))) {
  7312.         if (sizeof(long) < sizeof(long)) {
  7313.             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  7314.         } else {
  7315.             long val = PyInt_AS_LONG(x);
  7316.             if (is_unsigned && unlikely(val < 0)) {
  7317.                 goto raise_neg_overflow;
  7318.             }
  7319.             return (long) val;
  7320.         }
  7321.     } else
  7322. #endif
  7323.     if (likely(PyLong_Check(x))) {
  7324.         if (is_unsigned) {
  7325. #if CYTHON_USE_PYLONG_INTERNALS
  7326.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  7327.             switch (Py_SIZE(x)) {
  7328.                 case  0: return (long) 0;
  7329.                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  7330.                 case 2:
  7331.                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  7332.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7333.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7334.                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  7335.                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  7336.                         }
  7337.                     }
  7338.                     break;
  7339.                 case 3:
  7340.                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  7341.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7342.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7343.                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  7344.                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  7345.                         }
  7346.                     }
  7347.                     break;
  7348.                 case 4:
  7349.                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  7350.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7351.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7352.                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  7353.                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  7354.                         }
  7355.                     }
  7356.                     break;
  7357.             }
  7358. #endif
  7359. #if CYTHON_COMPILING_IN_CPYTHON
  7360.             if (unlikely(Py_SIZE(x) < 0)) {
  7361.                 goto raise_neg_overflow;
  7362.             }
  7363. #else
  7364.             {
  7365.                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  7366.                 if (unlikely(result < 0))
  7367.                     return (long) -1;
  7368.                 if (unlikely(result == 1))
  7369.                     goto raise_neg_overflow;
  7370.             }
  7371. #endif
  7372.             if (sizeof(long) <= sizeof(unsigned long)) {
  7373.                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  7374. #ifdef HAVE_LONG_LONG
  7375.             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  7376.                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  7377. #endif
  7378.             }
  7379.         } else {
  7380. #if CYTHON_USE_PYLONG_INTERNALS
  7381.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  7382.             switch (Py_SIZE(x)) {
  7383.                 case  0: return (long) 0;
  7384.                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  7385.                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
  7386.                 case -2:
  7387.                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  7388.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7389.                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7390.                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  7391.                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7392.                         }
  7393.                     }
  7394.                     break;
  7395.                 case 2:
  7396.                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  7397.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7398.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7399.                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  7400.                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7401.                         }
  7402.                     }
  7403.                     break;
  7404.                 case -3:
  7405.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  7406.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7407.                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7408.                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7409.                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7410.                         }
  7411.                     }
  7412.                     break;
  7413.                 case 3:
  7414.                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  7415.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7416.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7417.                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7418.                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7419.                         }
  7420.                     }
  7421.                     break;
  7422.                 case -4:
  7423.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7424.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7425.                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7426.                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  7427.                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7428.                         }
  7429.                     }
  7430.                     break;
  7431.                 case 4:
  7432.                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  7433.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7434.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7435.                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  7436.                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7437.                         }
  7438.                     }
  7439.                     break;
  7440.             }
  7441. #endif
  7442.             if (sizeof(long) <= sizeof(long)) {
  7443.                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  7444. #ifdef HAVE_LONG_LONG
  7445.             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  7446.                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  7447. #endif
  7448.             }
  7449.         }
  7450.         {
  7451. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  7452.             PyErr_SetString(PyExc_RuntimeError,
  7453.                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  7454. #else
  7455.             long val;
  7456.             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  7457.  #if PY_MAJOR_VERSION < 3
  7458.             if (likely(v) && !PyLong_Check(v)) {
  7459.                 PyObject *tmp = v;
  7460.                 v = PyNumber_Long(tmp);
  7461.                 Py_DECREF(tmp);
  7462.             }
  7463.  #endif
  7464.             if (likely(v)) {
  7465.                 int one = 1; int is_little = (int)*(unsigned char *)&one;
  7466.                 unsigned char *bytes = (unsigned char *)&val;
  7467.                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
  7468.                                               bytes, sizeof(val),
  7469.                                               is_little, !is_unsigned);
  7470.                 Py_DECREF(v);
  7471.                 if (likely(!ret))
  7472.                     return val;
  7473.             }
  7474. #endif
  7475.             return (long) -1;
  7476.         }
  7477.     } else {
  7478.         long val;
  7479.         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  7480.         if (!tmp) return (long) -1;
  7481.         val = __Pyx_PyInt_As_long(tmp);
  7482.         Py_DECREF(tmp);
  7483.         return val;
  7484.     }
  7485. raise_overflow:
  7486.     PyErr_SetString(PyExc_OverflowError,
  7487.         "value too large to convert to long");
  7488.     return (long) -1;
  7489. raise_neg_overflow:
  7490.     PyErr_SetString(PyExc_OverflowError,
  7491.         "can't convert negative value to long");
  7492.     return (long) -1;
  7493. }
  7494.  
  7495. /* FastTypeChecks */
  7496. #if CYTHON_COMPILING_IN_CPYTHON
  7497. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  7498.     while (a) {
  7499.         a = a->tp_base;
  7500.         if (a == b)
  7501.             return 1;
  7502.     }
  7503.     return b == &PyBaseObject_Type;
  7504. }
  7505. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  7506.     PyObject *mro;
  7507.     if (a == b) return 1;
  7508.     mro = a->tp_mro;
  7509.     if (likely(mro)) {
  7510.         Py_ssize_t i, n;
  7511.         n = PyTuple_GET_SIZE(mro);
  7512.         for (i = 0; i < n; i++) {
  7513.             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  7514.                 return 1;
  7515.         }
  7516.         return 0;
  7517.     }
  7518.     return __Pyx_InBases(a, b);
  7519. }
  7520. #if PY_MAJOR_VERSION == 2
  7521. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  7522.     PyObject *exception, *value, *tb;
  7523.     int res;
  7524.     __Pyx_PyThreadState_declare
  7525.     __Pyx_PyThreadState_assign
  7526.     __Pyx_ErrFetch(&exception, &value, &tb);
  7527.     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  7528.     if (unlikely(res == -1)) {
  7529.         PyErr_WriteUnraisable(err);
  7530.         res = 0;
  7531.     }
  7532.     if (!res) {
  7533.         res = PyObject_IsSubclass(err, exc_type2);
  7534.         if (unlikely(res == -1)) {
  7535.             PyErr_WriteUnraisable(err);
  7536.             res = 0;
  7537.         }
  7538.     }
  7539.     __Pyx_ErrRestore(exception, value, tb);
  7540.     return res;
  7541. }
  7542. #else
  7543. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  7544.     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  7545.     if (!res) {
  7546.         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  7547.     }
  7548.     return res;
  7549. }
  7550. #endif
  7551. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  7552.     Py_ssize_t i, n;
  7553.     assert(PyExceptionClass_Check(exc_type));
  7554.     n = PyTuple_GET_SIZE(tuple);
  7555. #if PY_MAJOR_VERSION >= 3
  7556.     for (i=0; i<n; i++) {
  7557.         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  7558.     }
  7559. #endif
  7560.     for (i=0; i<n; i++) {
  7561.         PyObject *t = PyTuple_GET_ITEM(tuple, i);
  7562.         #if PY_MAJOR_VERSION < 3
  7563.         if (likely(exc_type == t)) return 1;
  7564.         #endif
  7565.         if (likely(PyExceptionClass_Check(t))) {
  7566.             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  7567.         } else {
  7568.         }
  7569.     }
  7570.     return 0;
  7571. }
  7572. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  7573.     if (likely(err == exc_type)) return 1;
  7574.     if (likely(PyExceptionClass_Check(err))) {
  7575.         if (likely(PyExceptionClass_Check(exc_type))) {
  7576.             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  7577.         } else if (likely(PyTuple_Check(exc_type))) {
  7578.             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  7579.         } else {
  7580.         }
  7581.     }
  7582.     return PyErr_GivenExceptionMatches(err, exc_type);
  7583. }
  7584. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  7585.     assert(PyExceptionClass_Check(exc_type1));
  7586.     assert(PyExceptionClass_Check(exc_type2));
  7587.     if (likely(err == exc_type1 || err == exc_type2)) return 1;
  7588.     if (likely(PyExceptionClass_Check(err))) {
  7589.         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  7590.     }
  7591.     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  7592. }
  7593. #endif
  7594.  
  7595. /* CheckBinaryVersion */
  7596. static int __Pyx_check_binary_version(void) {
  7597.     char ctversion[5];
  7598.     int same=1, i, found_dot;
  7599.     const char* rt_from_call = Py_GetVersion();
  7600.     PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  7601.     found_dot = 0;
  7602.     for (i = 0; i < 4; i++) {
  7603.         if (!ctversion[i]) {
  7604.             same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
  7605.             break;
  7606.         }
  7607.         if (rt_from_call[i] != ctversion[i]) {
  7608.             same = 0;
  7609.             break;
  7610.         }
  7611.     }
  7612.     if (!same) {
  7613.         char rtversion[5] = {'\0'};
  7614.         char message[200];
  7615.         for (i=0; i<4; ++i) {
  7616.             if (rt_from_call[i] == '.') {
  7617.                 if (found_dot) break;
  7618.                 found_dot = 1;
  7619.             } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
  7620.                 break;
  7621.             }
  7622.             rtversion[i] = rt_from_call[i];
  7623.         }
  7624.         PyOS_snprintf(message, sizeof(message),
  7625.                       "compiletime version %s of module '%.100s' "
  7626.                       "does not match runtime version %s",
  7627.                       ctversion, __Pyx_MODULE_NAME, rtversion);
  7628.         return PyErr_WarnEx(NULL, message, 1);
  7629.     }
  7630.     return 0;
  7631. }
  7632.  
  7633. /* FunctionExport */
  7634. static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
  7635.     PyObject *d = 0;
  7636.     PyObject *cobj = 0;
  7637.     union {
  7638.         void (*fp)(void);
  7639.         void *p;
  7640.     } tmp;
  7641.     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
  7642.     if (!d) {
  7643.         PyErr_Clear();
  7644.         d = PyDict_New();
  7645.         if (!d)
  7646.             goto bad;
  7647.         Py_INCREF(d);
  7648.         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
  7649.             goto bad;
  7650.     }
  7651.     tmp.fp = f;
  7652. #if PY_VERSION_HEX >= 0x02070000
  7653.     cobj = PyCapsule_New(tmp.p, sig, 0);
  7654. #else
  7655.     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
  7656. #endif
  7657.     if (!cobj)
  7658.         goto bad;
  7659.     if (PyDict_SetItemString(d, name, cobj) < 0)
  7660.         goto bad;
  7661.     Py_DECREF(cobj);
  7662.     Py_DECREF(d);
  7663.     return 0;
  7664. bad:
  7665.     Py_XDECREF(cobj);
  7666.     Py_XDECREF(d);
  7667.     return -1;
  7668. }
  7669.  
  7670. /* InitStrings */
  7671. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  7672.     while (t->p) {
  7673.         #if PY_MAJOR_VERSION < 3
  7674.         if (t->is_unicode) {
  7675.             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  7676.         } else if (t->intern) {
  7677.             *t->p = PyString_InternFromString(t->s);
  7678.         } else {
  7679.             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  7680.         }
  7681.         #else
  7682.         if (t->is_unicode | t->is_str) {
  7683.             if (t->intern) {
  7684.                 *t->p = PyUnicode_InternFromString(t->s);
  7685.             } else if (t->encoding) {
  7686.                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  7687.             } else {
  7688.                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  7689.             }
  7690.         } else {
  7691.             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  7692.         }
  7693.         #endif
  7694.         if (!*t->p)
  7695.             return -1;
  7696.         if (PyObject_Hash(*t->p) == -1)
  7697.             return -1;
  7698.         ++t;
  7699.     }
  7700.     return 0;
  7701. }
  7702.  
  7703. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  7704.     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  7705. }
  7706. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  7707.     Py_ssize_t ignore;
  7708.     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  7709. }
  7710. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  7711. #if !CYTHON_PEP393_ENABLED
  7712. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  7713.     char* defenc_c;
  7714.     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  7715.     if (!defenc) return NULL;
  7716.     defenc_c = PyBytes_AS_STRING(defenc);
  7717. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  7718.     {
  7719.         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  7720.         char* c;
  7721.         for (c = defenc_c; c < end; c++) {
  7722.             if ((unsigned char) (*c) >= 128) {
  7723.                 PyUnicode_AsASCIIString(o);
  7724.                 return NULL;
  7725.             }
  7726.         }
  7727.     }
  7728. #endif
  7729.     *length = PyBytes_GET_SIZE(defenc);
  7730.     return defenc_c;
  7731. }
  7732. #else
  7733. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  7734.     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  7735. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  7736.     if (likely(PyUnicode_IS_ASCII(o))) {
  7737.         *length = PyUnicode_GET_LENGTH(o);
  7738.         return PyUnicode_AsUTF8(o);
  7739.     } else {
  7740.         PyUnicode_AsASCIIString(o);
  7741.         return NULL;
  7742.     }
  7743. #else
  7744.     return PyUnicode_AsUTF8AndSize(o, length);
  7745. #endif
  7746. }
  7747. #endif
  7748. #endif
  7749. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  7750. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  7751.     if (
  7752. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  7753.             __Pyx_sys_getdefaultencoding_not_ascii &&
  7754. #endif
  7755.             PyUnicode_Check(o)) {
  7756.         return __Pyx_PyUnicode_AsStringAndSize(o, length);
  7757.     } else
  7758. #endif
  7759. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  7760.     if (PyByteArray_Check(o)) {
  7761.         *length = PyByteArray_GET_SIZE(o);
  7762.         return PyByteArray_AS_STRING(o);
  7763.     } else
  7764. #endif
  7765.     {
  7766.         char* result;
  7767.         int r = PyBytes_AsStringAndSize(o, &result, length);
  7768.         if (unlikely(r < 0)) {
  7769.             return NULL;
  7770.         } else {
  7771.             return result;
  7772.         }
  7773.     }
  7774. }
  7775. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  7776.    int is_true = x == Py_True;
  7777.    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  7778.    else return PyObject_IsTrue(x);
  7779. }
  7780. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  7781.     int retval;
  7782.     if (unlikely(!x)) return -1;
  7783.     retval = __Pyx_PyObject_IsTrue(x);
  7784.     Py_DECREF(x);
  7785.     return retval;
  7786. }
  7787. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  7788. #if PY_MAJOR_VERSION >= 3
  7789.     if (PyLong_Check(result)) {
  7790.         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  7791.                 "__int__ returned non-int (type %.200s).  "
  7792.                 "The ability to return an instance of a strict subclass of int "
  7793.                 "is deprecated, and may be removed in a future version of Python.",
  7794.                 Py_TYPE(result)->tp_name)) {
  7795.             Py_DECREF(result);
  7796.             return NULL;
  7797.         }
  7798.         return result;
  7799.     }
  7800. #endif
  7801.     PyErr_Format(PyExc_TypeError,
  7802.                  "__%.4s__ returned non-%.4s (type %.200s)",
  7803.                  type_name, type_name, Py_TYPE(result)->tp_name);
  7804.     Py_DECREF(result);
  7805.     return NULL;
  7806. }
  7807. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  7808. #if CYTHON_USE_TYPE_SLOTS
  7809.   PyNumberMethods *m;
  7810. #endif
  7811.   const char *name = NULL;
  7812.   PyObject *res = NULL;
  7813. #if PY_MAJOR_VERSION < 3
  7814.   if (likely(PyInt_Check(x) || PyLong_Check(x)))
  7815. #else
  7816.   if (likely(PyLong_Check(x)))
  7817. #endif
  7818.     return __Pyx_NewRef(x);
  7819. #if CYTHON_USE_TYPE_SLOTS
  7820.   m = Py_TYPE(x)->tp_as_number;
  7821.   #if PY_MAJOR_VERSION < 3
  7822.   if (m && m->nb_int) {
  7823.     name = "int";
  7824.     res = m->nb_int(x);
  7825.   }
  7826.   else if (m && m->nb_long) {
  7827.     name = "long";
  7828.     res = m->nb_long(x);
  7829.   }
  7830.   #else
  7831.   if (likely(m && m->nb_int)) {
  7832.     name = "int";
  7833.     res = m->nb_int(x);
  7834.   }
  7835.   #endif
  7836. #else
  7837.   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  7838.     res = PyNumber_Int(x);
  7839.   }
  7840. #endif
  7841.   if (likely(res)) {
  7842. #if PY_MAJOR_VERSION < 3
  7843.     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  7844. #else
  7845.     if (unlikely(!PyLong_CheckExact(res))) {
  7846. #endif
  7847.         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  7848.     }
  7849.   }
  7850.   else if (!PyErr_Occurred()) {
  7851.     PyErr_SetString(PyExc_TypeError,
  7852.                     "an integer is required");
  7853.   }
  7854.   return res;
  7855. }
  7856. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  7857.   Py_ssize_t ival;
  7858.   PyObject *x;
  7859. #if PY_MAJOR_VERSION < 3
  7860.   if (likely(PyInt_CheckExact(b))) {
  7861.     if (sizeof(Py_ssize_t) >= sizeof(long))
  7862.         return PyInt_AS_LONG(b);
  7863.     else
  7864.         return PyInt_AsSsize_t(b);
  7865.   }
  7866. #endif
  7867.   if (likely(PyLong_CheckExact(b))) {
  7868.     #if CYTHON_USE_PYLONG_INTERNALS
  7869.     const digit* digits = ((PyLongObject*)b)->ob_digit;
  7870.     const Py_ssize_t size = Py_SIZE(b);
  7871.     if (likely(__Pyx_sst_abs(size) <= 1)) {
  7872.         ival = likely(size) ? digits[0] : 0;
  7873.         if (size == -1) ival = -ival;
  7874.         return ival;
  7875.     } else {
  7876.       switch (size) {
  7877.          case 2:
  7878.            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  7879.              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  7880.            }
  7881.            break;
  7882.          case -2:
  7883.            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  7884.              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  7885.            }
  7886.            break;
  7887.          case 3:
  7888.            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  7889.              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  7890.            }
  7891.            break;
  7892.          case -3:
  7893.            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  7894.              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  7895.            }
  7896.            break;
  7897.          case 4:
  7898.            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  7899.              return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  7900.            }
  7901.            break;
  7902.          case -4:
  7903.            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  7904.              return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  7905.            }
  7906.            break;
  7907.       }
  7908.     }
  7909.     #endif
  7910.     return PyLong_AsSsize_t(b);
  7911.   }
  7912.   x = PyNumber_Index(b);
  7913.   if (!x) return -1;
  7914.   ival = PyInt_AsSsize_t(x);
  7915.   Py_DECREF(x);
  7916.   return ival;
  7917. }
  7918. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  7919.   if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  7920.     return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  7921. #if PY_MAJOR_VERSION < 3
  7922.   } else if (likely(PyInt_CheckExact(o))) {
  7923.     return PyInt_AS_LONG(o);
  7924. #endif
  7925.   } else {
  7926.     Py_ssize_t ival;
  7927.     PyObject *x;
  7928.     x = PyNumber_Index(o);
  7929.     if (!x) return -1;
  7930.     ival = PyInt_AsLong(x);
  7931.     Py_DECREF(x);
  7932.     return ival;
  7933.   }
  7934. }
  7935. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  7936.   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  7937. }
  7938. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  7939.     return PyInt_FromSize_t(ival);
  7940. }
  7941.  
  7942.  
  7943. #endif /* Py_PYTHON_H */
  7944.  
Tags: AoC2022
Add Comment
Please, Sign In to add comment