Language: C++

import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:1:37: error: expected ':' before 'static'
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                     ^~~~~~~
      |                                     :
a.cc:1:55: error: 'String' has not been declared
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                       ^~~~~~
a.cc:1:63: error: expected ',' or '...' before 'z'
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                               ^
a.cc:1:274: error: expected ';' after class definition
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                                                                                                                                                                                                                                  ^
      |                                                                                                                                                                                                                                                                                  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:1:66: error: 'Scanner' was not declared in this scope
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                  ^~~~~~~
a.cc:1:99: error: 'String' was not declared in this scope
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                                                   ^~~~~~
a.cc:1:127: error: 's' was not declared in this scope
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                                                                               ^
a.cc:1:142: error: 'System' was not declared in this scope
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                                                                                              ^~~~~~
a.cc:1:161: error: 'r' was not declared in this scope
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                                                                                                                 ^
a.cc:1:257: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String r;for(int n,a,b,c;(n=s.nextInt())>0;System.out.println(r+a+(a<c?"-"+c:"")))for(r="",a=c=s.nextInt();n-->1;){b=s.nextInt();if(b-c>1){r+=a+(a<c?"-"+c:"")+" ";a=b;}c=b;}}}
      |                                                                                                                                                                                                                                                 ~~~~~~~~~~~~~~~~^~~~
      |                                                                                                                                                                                                                                                  |               |
      |                                                                                                                                                                                                                                                  const char*     const char [2]