Problem:
視力検査

視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。

判定

視力

A

1.1 以上

B

0.6 以上 1.1 未満

C

0.2 以上 0.6 未満

D

0.2 未満

Input

入力は以下の形式で与えられます。

l1 r1
l2 r2
l3 r3
:
:

i 行目に i 人目の左の視力を表す実数 li と右の視力を表す実数 ri が空白区切りで与えられます。ただし、視力は 0.1 以上 2.0 以下で、 0.1 刻みで与えられます。

入力の行数は 40 を超えません。

Output

以下の形式で、判定表を出力してください。

1行目 左の視力がAの人数 右の視力がAの人数（空白区切り）

2行目 左の視力がBの人数 右の視力がBの人数（空白区切り）

3行目 左の視力がCの人数 右の視力がCの人数（空白区切り）

4行目 左の視力がDの人数 右の視力がDの人数（空白区切り）

Sample Input

1.0 1.2
0.8 1.5
1.2 0.7
2.0 2.0

Output for the Sample Input

2 3
2 1
0 0
0 0

Solution in JAVA (judge verdict: Accepted)

import java.util.*;
import java.io.*;

public class Main {

	static void solve (FastScanner in, PrintWriter out, Methods ms) {
		
		int[] left = new int[4], right = new int[4];
		
		while (in.hasNext() == true) {
//		for (int k=0; k<4; k++) {
			double L = in.nextDouble(), R = in.nextDouble();
			if (L >= 1.1) left[0]++;
			else if (0.6<=L && L<1.1) left[1]++;
			else if (0.2<=L && L<0.6) left[2]++;
			else left[3]++;
			if (R >= 1.1) right[0]++;
			else if (0.6<=R && R<1.1) right[1]++;
			else if (0.2<=R && R<0.6) right[2]++;
			else right[3]++;
		}
		
		for (int i=0; i<4; i++) {
			out.println(left[i] + " " + right[i]);
		}
		
	}



	public static void main(String[] args) {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		Methods ms = new Methods();
		solve(in, out, ms);
		in.close();
		out.close();
	}

	static class Methods {

		public void print (Object... ar) {System.out.println(Arrays.deepToString(ar));}

		public int max (int... ar) {Arrays.sort(ar); return ar[ar.length-1];}

		public int min (int... ar) {Arrays.sort(ar); return ar[0];}

		public long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}

		public long lcm (long a, long b) {return a/gcd(a,b)*b;}

		public long factorial (int i) {
			if (i==1) return 1;
			else return i*factorial(i-1);
		}

		public int manhat (int x1, int y1, int x2, int y2) {
			return Math.abs(x1-x2)+Math.abs(y1-y2);
		}

		public double euclid (double x1, double y1, double x2, double y2) {
			return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		}

		public boolean isPrime (int n) {
			if (n==2) return true;
			if (n<2 || n%2==0) return false;
			for (int i=3; i<=Math.sqrt(n); i+=2) if(n%i==0) return false;
			return true;
		}

	}

	static class FastScanner {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private  int length = 0, p = 0;

		public FastScanner (InputStream stream) {
			in = stream;
		}

		public boolean hasNextByte () {
			if (p < length) return true;
			else {
				p = 0;
				try {length = in.read(buffer);}
				catch (Exception e) {e.printStackTrace();}
				if (length <= 0) return false;
			}
			return true;
		}

		public int readByte () {
			if (hasNextByte() == true) return buffer[p++];
			return -1;
		}

		public boolean isPrintable (int n) {return 33<=n&&n<=126;}

		public void skip () {
			while (hasNextByte() && !isPrintable(buffer[p])) p++;
		}

		public boolean hasNext () {skip(); return hasNextByte();}

		public String next () {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int t = readByte();
			while (isPrintable(t)) {
				sb.appendCodePoint(t);
				t = readByte();
			}
			return sb.toString();
		}

		public String[] nextArray (int n) {
			String[] ar = new String[n];
			for (int i=0; i<n; i++) ar[i] = next();
			return ar;
		}

		public int nextInt () {return Math.toIntExact(nextLong());}

		public int[] nextIntArray (int n) {
			int[] ar = new int[n];
			for (int i=0; i<n; i++) ar[i] = nextInt();
			return ar;
		}

		public long nextLong () {
			if (!hasNext()) throw new NoSuchElementException();
			boolean minus = false;
			int temp = readByte();
			if (temp == '-') {
				minus = true;
				temp = readByte();
			}
			if (temp<'0' || '9'<temp) throw new NumberFormatException();
			long n = 0;
			while (isPrintable(temp)) {
				if ('0'<=temp && temp<='9') {
					n *= 10;
					n += temp - '0';
				}
				else throw new NumberFormatException();
				temp = readByte();
			}
			return minus? -n : n;
		}

		public long[] nextLongArray (int n) {
			long[] ar = new long[n];
			for (int i=0; i<n; i++) ar[i] = nextLong();
			return ar;
		}

		public double nextDouble () {
			return Double.parseDouble(next());
		}

		public double[] nextDoubleArray (int n) {
			double[] ar = new double[n];
			for (int i=0; i<n; i++) ar[i] = nextDouble();
			return ar;
		}

		public void close () {
			try {in.close();}
			catch(Exception e){}
		}

	}

}