fork download
  1. import java.io.*;
  2. import java.util.*;
  3. /* Name of the class has to be "Main" only if the class is public. */
  4. public class Main
  5. {
  6. public static void main (String[] args)
  7. {
  8. Scanner in = new Scanner(System.in);
  9. PrintWriter out = new PrintWriter(System.out);
  10. int n, m, i, buf;
  11. n = in.nextInt();
  12. m = in.nextInt();
  13. int[] a = new int [n];
  14. for(i = 0; i < n; a[i] = 0, ++i);
  15. for(i = 0; i < 2*m ;buf = in.nextInt(), ++a[buf - 1], ++i);
  16. for(i = 0; i < n; ++i){
  17. out.println(a[i]);
  18. }
  19. out.flush();
  20. }
  21. }
Success #stdin #stdout 0.15s 321280KB
stdin
4 4
1 2
1 3
2 3
3 4
stdout
2
2
3
1