fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String args[]) {
  11. Scanner sc=new Scanner(System.in);
  12. int n=sc.nextInt();
  13. HashMaphm=new HashMap();
  14. int count=0;
  15. //int arr[]=new int[n];
  16. for(int i=0;imap:hm.entrySet()){
  17. if(map.getValue()%2==0 || map.getValue()>=2){
  18. //System.out.println();
  19. count=count+map.getValue()/2;
  20. }
  21. }
  22. System.out.println(count);
  23. }
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
6
42 44 40 42 44 42
compilation info
Main.java:16: error: ';' expected
for(int i=0;imap:hm.entrySet()){
                ^
Main.java:16: error: ')' expected
for(int i=0;imap:hm.entrySet()){
                 ^
Main.java:16: error: illegal start of expression
for(int i=0;imap:hm.entrySet()){
                   ^
Main.java:16: error: ';' expected
for(int i=0;imap:hm.entrySet()){
                            ^
Main.java:16: error: variable declaration not allowed here
for(int i=0;imap:hm.entrySet()){
                    ^
5 errors
stdout
Standard output is empty