Language: Java

import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int price = sc.nextInt();
      	int dislikeNumsCount = sc.nextInt();
      	int payment=0;
      	List<Integer> nums = new ArrayList<>();
      	for (int i=0;i<10;i++){
        	nums.add(i);
        }
      	for(int i=0;i<dislikeNumsCount;i++){
          int dislikeNum = sc.nextInt();
          if(nums.contains(dislikeNum)){
          	nums.remove(nums.indexOf(dislikeNum));
          }
        }
 		if(price<10){
          	int onesDigit=0;
         	while(true){
        		int onesDigit=nums.get(i);
          		if(onesDigit>price){
              		break;
        		}
        	}
          
            payment=onesDigit;
        }else if(price>=10 && price<100){
        	int tensDigit=0;
        	while(true){
        		tensDgit=nums.get(i);
          		if(tenDigit*10>price){
              		break;
        		}
        	}
			int onesDigit=0;
         	while(true){
        		onesDigit=nums.get(i);
          		if(tensDigit*10+onesDigit>price){
              		break;
        		}
        	}
          
         	payment=tensDigit*10+onesDigit;
		}else if(price>=100 && price<1000){
        	int hundredsDigit=0;
           	while(true){
                hundredsDigit=nums.get(i);
                if(hundredsDigit*100>price){
                      break;
                }
       		}
          	int tensDigit=0;
        	while(true){
        		tensDigit=nums.get(i);
          		if(hundredsDigit*100+tensDigit*10>price){
              		break;
        		}
        	}
          	int onesDigit=0;
         	while(true){
        		onesDigit=nums.get(i);
          		if(hundredsDigit*100+tensDigit*10+onesDigit>price){
              		break;
                }
        	}
          
            payment=hundredsDigit*100+tensDigit*10+onesDigit;
        }else if(price>=1000 && price<10000){
            int thousandsDigit=0;
            while(true){
              thousandsDigit=nums.get(i);
              if(thousandsDigit*1000>price){
                	break;
              }
       		}
          	int hundredsDigit=0;
           	while(true){
                hundredsDigit=nums.get(i);
                if(thousandsDigit*1000+hundredsDigit*100>price){
                 	break;
                }
       		}
          	int tensDigit=0;          	
        	while(true){
        		tenDgit=nums.get(i);
          		if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10>price){
              		break;
        		}
        	}
          	int onesDigit=0;
         	while(true){
        		onesDigit=nums.get(i);
          		if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit>price){
              		break;
                }
        	}
          
            payment=thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit;
        }
       	System.out.println(payment);
   		sc.close();
	}
}

Compiler output:
Main.java:24: error: variable onesDigit is already defined in method main(String[])
        		int onesDigit=nums.get(i);
        		    ^
Main.java:24: error: cannot find symbol
        		int onesDigit=nums.get(i);
        		                       ^
  symbol:   variable i
  location: class Main
Main.java:34: error: cannot find symbol
        		tensDgit=nums.get(i);
        		^
  symbol:   variable tensDgit
  location: class Main
Main.java:34: error: cannot find symbol
        		tensDgit=nums.get(i);
        		                  ^
  symbol:   variable i
  location: class Main
Main.java:35: error: cannot find symbol
          		if(tenDigit*10>price){
          		   ^
  symbol:   variable tenDigit
  location: class Main
Main.java:41: error: cannot find symbol
        		onesDigit=nums.get(i);
        		                   ^
  symbol:   variable i
  location: class Main
Main.java:51: error: cannot find symbol
                hundredsDigit=nums.get(i);
                                       ^
  symbol:   variable i
  location: class Main
Main.java:58: error: cannot find symbol
        		tensDigit=nums.get(i);
        		                   ^
  symbol:   variable i
  location: class Main
Main.java:65: error: cannot find symbol
        		onesDigit=nums.get(i);
        		                   ^
  symbol:   variable i
  location: class Main
Main.java:75: error: cannot find symbol
              thousandsDigit=nums.get(i);
                                      ^
  symbol:   variable i
  location: class Main
Main.java:82: error: cannot find symbol
                hundredsDigit=nums.get(i);
                                       ^
  symbol:   variable i
  location: class Main
Main.java:89: error: cannot find symbol
        		tenDgit=nums.get(i);
        		^
  symbol:   variable tenDgit
  location: class Main
Main.java:89: error: cannot find symbol
        		tenDgit=nums.get(i);
        		                 ^
  symbol:   variable i
  location: class Main
Main.java:96: error: cannot find symbol
        		onesDigit=nums.get(i);
        		                   ^
  symbol:   variable i
  location: class Main
14 errors