Language: C++

using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

namespace Main
{
    class Main
    {
        /// <summary>
        /// ????????°???????????¨?????????????????????
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int SET_CARDS = 9;

            int count = int.Parse(Console.ReadLine());

            for(int ds = 0; ds < count; ds++)
            {
                // ??????????????????
                var list = new Card[SET_CARDS];

                // ??\???????????????
                string[] nums = Console.ReadLine().Split(' ');
                string[] marks = Console.ReadLine().Split(' ');

                // ??\????????????????????????????????????
                for (int i = 0; i < SET_CARDS; i++)
                    list[i] = new Card() { Mark = marks[i], Num = int.Parse(nums[i]) };
                
                // ?????????????????????
                Array.Sort(list, (c1, c2) => c1.Num - c2.Num);
                Array.Sort(list, (c1, c2) => char.Parse(c1.Mark) - char.Parse(c2.Mark));

                // ???????????????????????????
                Console.WriteLine(Judge(list) ? "1" : "0");
            }
        }

        /// <summary>
        /// ????????????
        /// </summary>
        /// <param name="cards">??????????????????</param>
        /// <returns>??????????????????????????????????????£????????????true???????????\??????false</returns>
        private static bool Judge(Card[] cards)
        {
            // ?????????????????????????????£?????????true
            if (cards.Length == 0)
                return true;

            // ????????????????????????3?????????????????¢??????
            for (int c1 = 0; c1 < cards.Length - 2; c1++)
            {
                for(int c2 = c1 + 1; c2 < cards.Length - 1; c2++)
                {
                    for (int c3 = c2 + 1; c3 < cards.Length; c3++)
                    {
                        // 3???????????????????????????????????§?????????
                        if(cards[c1].Mark == cards[c2].Mark && cards[c1].Mark == cards[c3].Mark)
                        {
                            // 3??????????????????????????°??????????????£?¶?????????°?????§?????????
                            if((cards[c1].Num == cards[c2].Num && cards[c1].Num == cards[c3].Num)
                                || (cards[c1].Num == cards[c2].Num - 1 && cards[c1].Num == cards[c3].Num - 2))
                            {
                                // ???????????¢???????????????????????\?????????????????§??????????????????????????????
                                List<Card> list = new List<Card>();
                                for(int i = 0; i < cards.Length; i++)
                                {
                                    if (i != c1 && i != c2 && i != c3)
                                        list.Add(cards[i]);
                                }

                                // ???????????????????????????????????§?????°??????
                                if (Judge(list.ToArray()))
                                    return true;
                            }
                        }
                    }
                }
            }

            return false;
        }
    }

    /// <summary>
    /// ??????????????????
    /// </summary>
    public class Card
    {
        /// <summary>
        /// ?????????
        /// </summary>
        public string Mark { get; set; }
        /// <summary>
        /// ??°???
        /// </summary>
        public int Num { get; set; }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.IO;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:14:26: error: 'string' has not been declared
   14 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:14:35: error: expected ',' or '...' before 'args'
   14 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:14:16: error: return type specification for constructor invalid
   14 |         static void Main(string[] args)
      |                ^~~~
a.cc:14:9: error: constructor cannot be static member function
   14 |         static void Main(string[] args)
      |         ^~~~~~
a.cc:47:16: error: expected ':' before 'static'
   47 |         private static bool Judge(Card[] cards)
      |                ^~~~~~~
      |                :
a.cc:47:35: error: 'Card' has not been declared
   47 |         private static bool Judge(Card[] cards)
      |                                   ^~~~
a.cc:47:42: error: expected ',' or '...' before 'cards'
   47 |         private static bool Judge(Card[] cards)
      |                                          ^~~~~
a.cc:86:6: error: expected ';' after class definition
   86 |     }
      |      ^
      |      ;
a.cc: In constructor 'Main::Main::Main(int*)':
a.cc:18:25: error: expected primary-expression before 'int'
   18 |             int count = int.Parse(Console.ReadLine());
      |                         ^~~
a.cc:23:17: error: 'var' was not declared in this scope
   23 |                 var list = new Card[SET_CARDS];
      |                 ^~~
a.cc:26:17: error: 'string' was not declared in this scope
   26 |                 string[] nums = Console.ReadLine().Split(' ');
      |                 ^~~~~~
a.cc:26:24: error: expected primary-expression before ']' token
   26 |                 string[] nums = Console.ReadLine().Split(' ');
      |                        ^
a.cc:27:24: error: expected primary-expression before ']' token
   27 |                 string[] marks = Console.ReadLine().Split(' ');
      |                        ^
a.cc:31:21: error: 'list' was not declared in this scope
   31 |                     list[i] = new Card() { Mark = marks[i], Num = int.Parse(nums[i]) };
      |                     ^~~~
a.cc:31:35: error: expected type-specifier before 'Card'
   31 |                     list[i] = new Card() { Mark = marks[i], Num = int.Parse(nums[i]) };
      |                                   ^~~~
a.cc:34:17: error: 'Array' was not declared in this scope
   34 |                 Array.Sort(list, (c1, c2) => c1.Num - c2.Num);
      |                 ^~~~~
a.cc:34:28: error: 'list' was not declared in this scope
   34 |                 Array.Sort(list, (c1, c2) => c1.Num - c2.Num);
      |                            ^~~~
a.cc:34:35: error: 'c1' was not declared in this scope
   34 |                 Array.Sort(list, (c1, c2) => c1.Num - c2.Num);
      |                                   ^~
a.cc:34:39: error: 'c2' was not declared in this scope
   34 |                 Array.Sort(list, (c1, c2) => c1.Num - c2.Num);
      |                                       ^~
a.cc:34:44: error: expected primary-expression before '>' token
   34 |                 Array.Sort(list, (c1, c2) => c1.Num - c2.Num);
      |                                            ^
a.cc:35:44: error: expected primary-expression before '>' token
   35 |                 Array.Sort(list, (c1, c2) => char.Parse(c1.Mark) - char.Parse(c2.Mark));
      |                                            ^
a.cc:35:46: error: expected primary-expression before 'char'
   35 |                 Array.Sort(list, (c1, c2) => char.Parse(c1.Mark) - char.Parse(c2.Mark));
      |                                              ^~~~
a.cc:38:17: error: 'Console' was not declared in this scope
   38 |                 Console.WriteLine(Judge(list) ? "1" : "0");
      |                 ^~~~~~~
a.cc: In static member function 'static bool Main::Main::Judge(int*)':
a.cc:50:17: error: 'cards' was not declared in this scope
   50 |             if (cards.Length == 0)
      |                 ^~~~~
a.cc:54:35: error: 'cards' was not declared in this scope
   54 |             for (int c1 = 0; c1 < cards.Length - 2; c1++)
      |                                   ^~~~~
a.cc:68:33: error: 'List' was not declared in this scope
   68 |                                 List<Card> list = new List<Card>();
      |                                 ^~~~
a.cc:68:38: error: 'Card' was not declared in this scope
   68 |                                 List<Card> list = new List<Card>();
      |                                      ^~~~
a.cc:68:44: error: 'list' was not declared in this scope
   68 |                                 List<Card> list = new List<Card>();
      |                                            ^~~~
a.cc:68:55: error: 'List' does not name a type
   68 |                                 List<Card> list = new List<Card>();
      |                                                       ^~~~
a.cc:68:66: error: expected primary-expression before ')' token
   68 |                                 List<Card> list = new List<Card>();
      |                                                                  ^
a.cc: At global scope:
a.cc:91:5: error: expected unqualified-id before 'public'
   91 |     public class Card
      |     ^~~~~~