A

#include <stdio.h>
 
int w;
 
int main() {
    scanf("%d", &w);
    if (w % 2 == 0 && 4 <= w) {
        printf("YES");
    } else {
        printf("NO");
    }
    return 0;
}

B

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
 
#define FOR(i, n) for (i = 0; i < n; ++i)
#define br break
#define con continue
 
int i, j, k;
 
typedef struct {
    int minTime;
    int cap;
} t;
 
int main() {
    int d;
    int sumTime, sumMax = 0, sumMin = 0;
    t h[30];
    FOR (i, 30) {
        h[i].minTime = 0;
        h[i].cap = 0;
    }
 
    cin >> d >> sumTime;
 
    FOR(i, d) {
        int minTime, maxTime;
 
        cin >> minTime >> maxTime;
 
 
        h[i].minTime = minTime;
        h[i].cap = maxTime - minTime;
 
        sumMin += minTime;
        sumMax += maxTime;
    }
    // cout << sumTime << endl;
    // cout << sumMin << endl;
    // cout << sumMax << endl;
    
    if (sumMin > sumTime || sumMax < sumTime) {
        cout << "NO" << endl;
        return 0;
    }
    std::cout << "YES" << std::endl;
    FOR (i, d) {
        int diff = min(h[i].cap, sumTime - sumMin);
 
        h[i].minTime += diff;
        h[i].cap -= diff;
        sumMin += diff;
 
        cout << h[i].minTime << ' ';
    }
 
    return 0;
}

C

import java.util.*

fun readInt(): Int {
    return readLine()!!.toInt()
}

fun readString(): String {
    return readLine()!!.trim()
}

fun readIntList(): List<Int> {
    return readLine()!!.split(' ').map { it.toInt() }
}

fun main(vararg args: String) {
    val n = readInt()

    val map = mutableMapOf<String, Int>()

    for (i in 0 until n) {
        val text = readLine()!!
        val num: Int
        if (map.containsKey(text)) {
            var p: Int = map[text]!!;
            p++;
            map[text] = p
            println(text + p.toString())
        } else {
            map[text] = 0
            println("OK")
        }
    }
}

D

import java.lang.Integer.max
import java.util.*
import kotlin.Comparator

fun readInt(): Int {
    return readLine()!!.toInt()
}

fun readString(): String {
    return readLine()!!.trim()
}

fun readIntList(): List<Int> {
    return readLine()!!.split(' ').map { it.toInt() }
}

data class Envelope(val index: Int, val w: Int, val h: Int) {
    var num = 1
    var pre = -1
}

fun main() {
    val (n, w, h) = readIntList()
    var list = mutableListOf<Envelope>()

    for (i in 1..n) {
        val (wi, hi) = readIntList()
        if (wi <= w || hi <= h) continue

        list.add(Envelope(i, wi, hi))
    }
    if (list.isEmpty()) {
        println(0)
        return
    }

    list = list.distinct().toMutableList()

    list.sortWith { o1, o2 ->
        if (o1.w == o2.w)
            o1.h.compareTo(o2.h)
        else
            o1.w.compareTo(o2.w)
    }

    for (i in 1 until list.size) {
        for (j in 0 until i) {
            list[j].also {
                if (list[i].w > it.w && list[i].h > it.h && it.num + 1 > list[i].num) {
                    list[i].pre = j
                    list[i].num = it.num + 1
                }
            }
        }
    }

    var max: Int = 0
    var id: Int = -1
    for ((i, e) in list.withIndex()) {
        if (i == 0) {
            max = e.num
            id = i
            continue
        }
        if (max < e.num) {
            max = e.num
            id = i
        }
    }
    println(max)
    if (max == 0) return

    var ids = IntArray(max)
    var i: Int = 0

    while (id != -1) {
        val e = list[id]
        ids[i] = e.index
        i++
        id = e.pre
    }

    for (i in max - 1 downTo 0) {
        print("${ids[i]} ")
    }
    return
}