As you may know, the c++17 compiler is 32-bit, and the c++20 compiler is 64-bit. In the 32-bit compiler, size_t is uint32_t and in the 64-bit compiler, size_t is uint64_t.
Therefore, when you attempt int i=a.size()-1 on Line 127 when a.size() is $0$ (consider sample case 4), although both versions encounter underflow, the outcomes differ. In the 32-bit version, the underflowed result is $2^{32}-1$, which is assigned to a long long (note the #define int long long in the front!), so $i$ becomes a huge positive integer and visiting a[i] clearly raises a runtime error. In the 64-bit version, however, the underflowed result is $2^{64}-1$, which is "correctly" assigned to a long long, which will overflow again to the correct -1.
As you may know, the c++17 compiler is 32-bit, and the c++20 compiler is 64-bit. In the 32-bit compiler,
size_tisuint32_tand in the 64-bit compiler,size_tisuint64_t.Therefore, when you attempt
int i=a.size()-1on Line 127 whena.size()is $0$ (consider sample case 4), although both versions encounter underflow, the outcomes differ. In the 32-bit version, the underflowed result is $2^{32}-1$, which is assigned to along long(note the#define int long longin the front!), so $i$ becomes a huge positive integer and visitinga[i]clearly raises a runtime error. In the 64-bit version, however, the underflowed result is $2^{64}-1$, which is "correctly" assigned to along long, which will overflow again to the correct-1.