@@ -0,0 +1,595 @@
+// https://codeforces.com/problemset/problem/1099/A%0A%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 w = read.nextInt();%0A%09%09int h = read.nextInt();%0A%09%09int u1 = read.nextInt();%0A%09%09int d1 = read.nextInt();%0A%09%09int u2 = read.nextInt();%0A%09%09int d2 = read.nextInt();%0A%09%09%0A%09%09int i = h;%0A%09%09while (i != 0) %7B%0A%09%09%09w += i;%0A%09%09%09%0A%09%09%09if (i == d1) %7B%0A%09%09%09%09w = Math.max(0, w-u1);%0A%09%09%09%7D%0A%09%09%09else if (i == d2) %7B%0A%09%09%09%09w = Math.max(0, w-u2);%0A%09%09%09%7D%0A%09%09%09%09%0A%09%09%09i--;%0A%09%09%7D%0A%09%09%0A%09%09System.out.println(w);%0A%09%09%0A%09%09// Close scanner%0A%09%09read.close();%0A%09%7D%0A%0A%7D%0A

Create Snowball.java