Language: Java

import java.awt.print.Printable;
import java.util.Arrays;
import java.util.Scanner;
import javax.sound.midi.SysexMessage;


public class Cards {
    public int num;
    public int color;
}

public class Main
{      
    public static void main(String[] args)
    {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int p=0;p<n;p++)
        {
            boolean win = true;

            Cards cards[] = new Cards[9];

            for(int i=0;i<n;i++)
            {
                for(int j=0;j<9;j++)
                {
                    cards[j].num=sc.nextInt();
                }
                for(int j=0;j<9;j++)
                {
                    String color = sc.next();
                    if(color=="R")
                        cards[j].color=1;
                    if(color=="G")
                        cards[j].color=2;
                    if(color=="B")
                        cards[j].color=3;                
                }
            
                Arrays.sort( cards, (a,b)-> a.color - b.color );
                int nowcolor=0;

                
                for(int j=0;j<9;j++)
                {

                    if(cards[j].color!=nowcolor)
                    {
                        nowcolor=cards[j].color;

                        int nc_count=0;
                        for(int k=0;k<9;k++){
                            if(cards[k].color==nowcolor)
                                nc_count++;
                        }
                        int nums[]= new int[nc_count];
                        int nc_count2=0;
                        for(int k=0;k<9;k++){
                            if(cards[k].color==nowcolor){
                                nums[nc_count2]=cards[k];
                                nc_count2++;
                            } 
                        }
                        Arrays.sort(nums);
                        int same=0;
                        int sames[]=new int[4];
                        int lastnum=-1; 
                    
                        int samecount=0;
                        for(int k=0;k<nums.length;k++)
                        {
                            if(lastnum==nums[k])
                                same++;
                            if(same%3==0)
                            {
                                samecount++;
                                sames[semecount]=nums[k];
                                
                            }
                            lastnum=nums[k];

                        }
                        for(int k=0;k<samecount;k++)
                        {
                            int zerocount =0;
                            for(int l=0;l<9;l++){
                                if(nums[l]==sames[k])
                                    if(zerocount<3)
                                        nums[l]=-1;
                                    zerocount++;      
                            }
                        }
                        Arrays.sort(nums);
                        int lastnum2 = -1;
                        int lastnumcount=0;
                        int lastnumcount3=0;
                        for(int k=0;k<nums.length;k++)
                        {
                            if(nums[k]-1==lastnum)
                                lastnumcount++;
                            if(lastnumcount==2)
                                lastnumcount=0;
                        }
                        if(lastnumcount!=0)
                            win = false;
                    }
                }   
                    nums[j]=cards[j].num;          
            }
            if(win==true)
                System.out.println("1");
            else
                System.out.println("0");
        }
        sc.close();
    }   
}



Compiler output:
Main.java:7: error: class Cards is public, should be declared in a file named Cards.java
public class Cards {
       ^
Main.java:62: error: incompatible types: Cards cannot be converted to int
                                nums[nc_count2]=cards[k];
                                                     ^
Main.java:79: error: cannot find symbol
                                sames[semecount]=nums[k];
                                      ^
  symbol:   variable semecount
  location: class Main
Main.java:110: error: cannot find symbol
                    nums[j]=cards[j].num;          
                    ^
  symbol:   variable nums
  location: class Main
Main.java:110: error: cannot find symbol
                    nums[j]=cards[j].num;          
                         ^
  symbol:   variable j
  location: class Main
Main.java:110: error: cannot find symbol
                    nums[j]=cards[j].num;          
                                  ^
  symbol:   variable j
  location: class Main
6 errors