using System; // Disables lots of warnings that appear in the test suite #pragma warning disable 0168, 0169, 0219, 0162, 0414 namespace Test { class Test { static readonly sbyte []_rangei_key_offsets = { 0, 0, 4, 8, 12, 16, 22, 24, 0, }; static readonly char []_rangei_trans_keys = { '\u0041', '\u005a', '\u0061', '\u007a', '\u0041', '\u005a', '\u0061', '\u007a', '\u003c', '\u005d', '\u0061', '\u007a', '\u0041', '\u005a', '\u005e', '\u007d', '\u0041', '\u0045', '\u0056', '\u0065', '\u0076', '\u007a', '\u003c', '\u007d', '\u0000', }; static readonly sbyte []_rangei_single_lengths = { 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static readonly sbyte []_rangei_range_lengths = { 0, 2, 2, 2, 2, 3, 1, 0, 0, }; static readonly sbyte []_rangei_index_offsets = { 0, 0, 3, 6, 9, 12, 16, 18, 0, }; static readonly sbyte []_rangei_trans_cond_spaces = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, }; static readonly sbyte []_rangei_trans_offsets = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, }; static readonly sbyte []_rangei_trans_lengths = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, }; static readonly sbyte []_rangei_cond_keys = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static readonly sbyte []_rangei_cond_targs = { 2, 2, 0, 3, 3, 0, 4, 4, 0, 5, 5, 0, 6, 6, 6, 0, 7, 0, 0, 0, }; static readonly sbyte []_rangei_cond_actions = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static readonly sbyte []_rangei_nfa_targs = { 0, 0, }; static readonly sbyte []_rangei_nfa_offsets = { 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static readonly sbyte []_rangei_nfa_push_actions = { 0, 0, }; static readonly sbyte []_rangei_nfa_pop_trans = { 0, 0, }; static readonly int rangei_start = 1; static readonly int rangei_first_final = 7; static readonly int rangei_error = 0; static readonly int rangei_en_main = 1; int cs; void init() { { cs = (int)rangei_start; } } void exec( char[] data, int len ) { int p = 0; int pe = len; int eof = len; string _s; char [] buffer = new char [1024]; int blen = 0; { int _klen; int _keys; int _ckeys; int _cpc; uint _trans = 0; uint _cond = 0; if ( p == pe ) goto _test_eof; if ( cs == 0 ) goto _out; _resume : _keys = _rangei_key_offsets[cs] ; _trans = (uint )_rangei_index_offsets[cs]; _klen = (int)_rangei_single_lengths[cs]; if ( _klen > 0 ) { int _lower; int _mid; int _upper; _lower = _keys; _upper = _keys + _klen - 1; while ( true ) { if ( _upper < _lower ) break; _mid = _lower + ((_upper-_lower) >> 1); if ( ( data[p ]) < _rangei_trans_keys[_mid ] ) _upper = _mid - 1; else if ( ( data[p ]) > _rangei_trans_keys[_mid ] ) _lower = _mid + 1; else { _trans += (uint )(_mid - _keys); goto _match; } } _keys += _klen; _trans += (uint )_klen; } _klen = (int)_rangei_range_lengths[cs]; if ( _klen > 0 ) { int _lower; int _mid; int _upper; _lower = _keys; _upper = _keys + (_klen<<1) - 2; while ( true ) { if ( _upper < _lower ) break; _mid = _lower + (((_upper-_lower) >> 1) & ~1); if ( ( data[p ]) < _rangei_trans_keys[_mid ] ) _upper = _mid - 2; else if ( ( data[p ]) > _rangei_trans_keys[_mid + 1] ) _lower = _mid + 2; else { _trans += (uint )((_mid - _keys)>>1); goto _match; } } _trans += (uint )_klen; } _match : _ckeys = _rangei_trans_offsets[_trans] ; _klen = (int)_rangei_trans_lengths[_trans]; _cond = (uint )_rangei_trans_offsets[_trans]; _cpc = 0; { int _lower; int _mid; int _upper; _lower = _ckeys; _upper = _ckeys + _klen - 1; while ( true ) { if ( _upper < _lower ) break; _mid = _lower + ((_upper-_lower) >> 1); if ( _cpc < (int)_rangei_cond_keys[_mid ] ) _upper = _mid - 1; else if ( _cpc > (int)_rangei_cond_keys[_mid ] ) _lower = _mid + 1; else { _cond += (uint )(_mid - _ckeys); goto _match_cond; } } cs = 0; goto _again; } _match_cond : cs = (int)_rangei_cond_targs[_cond]; _again : if ( cs == 0 ) goto _out; p += 1; if ( p != pe ) goto _resume; _test_eof : {} _out : {} } } void finish( ) { if ( cs >= rangei_first_final ) Console.WriteLine( "ACCEPT" ); else Console.WriteLine( "FAIL" ); } static readonly string[] inp = { "AaBbAa", "Aa`bAa", "AaB@Aa", "AaBbMa", "AaBbma", }; static readonly int inplen = 5; public static void Main (string[] args) { Test machine = new Test(); for ( int i = 0; i < inplen; i++ ) { machine.init(); machine.exec( inp[i].ToCharArray(), inp[i].Length ); machine.finish(); } } } }