Compiling...
Compile: OK

Executing...
Test 1: TEST OK [0.000 secs, 208 KB]
Test 2: TEST OK [0.000 secs, 204 KB]
Test 3: TEST OK [0.032 secs, 204 KB]
Test 4: TEST OK [0.000 secs, 204 KB]
Test 5: TEST OK [0.000 secs, 204 KB]
Test 6: TEST OK [0.011 secs, 204 KB]
Test 7: TEST OK [0.000 secs, 204 KB]

All tests OK.
Your program ('dualpal') produced all correct answers at the first time!
Here are the test data inputs:

------- test 1 -------
5 1
------- test 2 -------
9 10
------- test 3 -------
15 9900
------- test 4 -------
10 90
------- test 5 -------
12 125
------- test 6 -------
12 1900
------- test 7 -------
8 500

Keep up the good work!

Thanks for your submission!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
ID:cxj6661
PROB:dualpal
LANG:PASCAL
}
//By Ceeji
//Date: 2009-6-1
//Type: NO
//Resource: USACO 1.2
Program dualpal;
Const
   fin='dualpal.in';
   fou='dualpal.out';
Var
   i,n,s,ss:longint;
Function translate(i,b:longint):string;
var s:string;
    j,p,k:longint;
begin
    if i=0 then exit('0');
    s:='';
    j:=i;
    while true do
    begin
       p:=j div b;
       k:=j-p*b;
       j:=p;
       if (p=0) then 
       begin 
          if k<10 then s:=chr(48+k)+s 
                  else s:=chr(55+k)+s; 
          exit(s); 
       end;
       if k<10 then s:=chr(48+k)+s else s:=chr(55+k)+s;
    end;
    if s='' then exit('0');
end;
Function ishuiwen(s:string):boolean;
var i,l:longint;
    s2:string;
begin
    l:=length(s); s2:='';
    for i:=l downto 1 do
    begin
       s2:=s2+s[i];
    end;
    if s2=s then exit(true) else exit(false);
end;
Function isok(ii:longint):boolean;
var j,k:longint;
begin
   k:=0;
   for j:=2 to 10 do
   begin
     if ishuiwen(translate(ii,j)) then inc(k);
     if k=2 then exit(true);
   end;
   exit(false);
end;
begin
   assign(input,fin);  reset(input);
   assign(output,fou); rewrite(output);
   readln(n,s);
   close(input); ss:=0; i:=s+1;
   while ss<n do
   begin
      if isok(i) then begin inc(ss); writeln(i); end;
      inc(i);
   end;
   close(output);
end.