@@ -0,0 +1,1121 @@
+// https://codeforces.com/problemset/problem/248/A%0A%0A// Simplified solution (not by me: https://github.com/fuwutu/CodeForces/blob/master/248A%2520-%2520Cupboards.cpp)%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Scanner;%0A%0Apublic class Solution %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Scanner read = new Scanner(System.in);%0A%09%09%0A%09%09int n = read.nextInt();%0A%09%09%0A%09%09Map%3CInteger, Integer%3E leftDoorFrequencies = new HashMap%3C%3E();%0A%09%09leftDoorFrequencies.put(0, 0);%0A%09%09leftDoorFrequencies.put(1, 0);%0A%09%09%0A%09%09Map%3CInteger, Integer%3E rightDoorFrequencies = new HashMap%3C%3E();%0A%09%09rightDoorFrequencies.put(0, 0);%0A%09%09rightDoorFrequencies.put(1, 0);%0A%09%09%0A%09%09for (int i = 0; i %3C n; ++i) %7B%0A%09%09%09int l = read.nextInt();%0A%09%09%09int r = read.nextInt();%09%0A%09%09%09leftDoorFrequencies.put(l, leftDoorFrequencies.get(l)+1);%0A%09%09%09rightDoorFrequencies.put(r, rightDoorFrequencies.get(r)+1);%0A%09%09%7D%0A%09%09%0A%09%09int leftMin = Math.min(leftDoorFrequencies.get(0), leftDoorFrequencies.get(1));%0A%09%09int rightMin = Math.min(rightDoorFrequencies.get(0), rightDoorFrequencies.get(1));%0A%09%09%0A%09%09System.out.println( leftMin + rightMin );%0A%09%09%0A%09%09// Close scanner%0A%09%09read.close();%0A%09%7D%0A%0A%7D%0A

Create Cupboards.java