zccneil/codelingua_dataset huggingface dataset:
assistant: n, m = map(int, input().split())
l = list(map(int, input().split()))
l2 = []
for i in l:
    if i % m == 0:
        l2.append(i // m)
    else:
        l2.append(i // m + 1)
mx = max(l2)
for i in range(n):
    if l2[i] == mx:
        ind = i
print(ind + 1)


user: import java.util.*;

public class codeforces_450_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Queue<Integer> q1 = new LinkedList<>();
        Queue<Integer> q2 = new LinkedList<>();
        for (int i = 1; i <= n; i++) {
            q1.add(sc.nextInt());
            q2.add(i);
        }
        int ans = 0;
        while (!q1.isEmpty()) {
            if (q1.peek() <= m) {
                q1.poll();
                ans = q2.poll();
            } else if (q1.peek() > m) {
                int x = q1.poll();
                int val = x - m;
                q1.add(val);
                int val2 = q2.poll();
                q2.add(val2);
            }
        }
        System.out.println(ans);
    }
}
assistant: n = int(input())
m = [[int(x) for x in input().split()] for i in range(n)]
m.sort(reverse=True)
a = m[0]
for i in m[1:]:
    if i[1] > a[1]:
        print('Happy Alex')
        break
    a = i
else:
    print('Poor Alex')


user: import java.util.ArrayList;
import java.util.Scanner;

public class codeforces_456_A {
    static ArrayList md = new ArrayList();

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int temp = 0;
        int q = 0;
        int w = 0, e = 0;
        boolean f = false;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
            if (temp < a[i]) {
                if (q > b[i]) {
                    f = true;
                }
                q = b[i];
                temp = a[i];
            }
            if (temp > a[i]) {
                if (q < b[i]) {
                    f = true;
                }
                q = b[i];
                temp = a[i];
            }
            if (a[i] > w) {
                w = a[i];
                if (b[i] < e) {
                    f = true;
                }
                e = b[i];
            }
            if (a[i] < w) {
                if (b[i] > e) {
                    f = true;
                }
            }
        }
        if (f == true) {
            System.out.println("Happy Alex");
        } else System.out.println("Poor Alex");
    }
}
assistant: import math
given = input("")
l1 = given.split()
l1 = [int(x) for x in l1]
x1 = l1[0]
y1 = l1[1]
x2 = l1[2]
y2 = l1[3]
denominator = x2 - x1
numerator = y2 - y1
if denominator != 0:
    quotient = numerator / denominator
if numerator == 0:
    d = int(math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2))
    x4 = x1
    x3 = x2
    y3 = y2 + d
    y4 = y1 + d
    print(f"{x3} {y3} {x4} {y4}")
elif denominator == 0:
    y4 = y2
    y3 = y1
    d = int(math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2))
    x4 = x1 + d
    x3 = x2 + d
    print(f"{x3} {y3} {x4} {y4}")
elif quotient == 1:
    x4 = x2
    x3 = x1
    y4 = y1
    y3 = y2
    print(f"{x3} {y3} {x4} {y4}")
elif quotient == - 1:
    x4 = x1
    x3 = x2
    y4 = y2
    y3 = y1
    print(f"{x3} {y3} {x4} {y4}")
else:
    print('-1')


user: import java.io.*;
import java.util.*;

public class codeforces_459_A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt();
        if (x1 == x2) {
            int dif = Math.abs(y1 - y2);
            pw.println((x1 + dif) + " " + y1 + " " + (x1 + dif) + " " + y2);
        } else if (y1 == y2) {
            int dif = Math.abs(x1 - x2);
            pw.println((x1) + " " + (y1 + dif) + " " + (x2) + " " + (y2 + dif));
        } else if (Math.abs(x1 - x2) == Math.abs(y1 - y2)) {
            pw.println(x1 + " " + y2 + " " + x2 + " " + y1);
        } else {
            pw.println(-1);
        }
        pw.close();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}
assistant: n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
a = l1[- 1]
b = l1[0]
if a == b:
    print(a - b, (n) * (n - 1) // 2)
else:
    ac = l1.count(a)
    bc = l1.count(b)
    print(a - b, ac * bc)


user: import java.io.*;
import java.util.*;

public class codeforces_459_B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int N = in.nextInt();
        int[] A = new int[N];
        for (int n = 0; n < N; n++) {
            A[n] = in.nextInt();
        }
        Arrays.sort(A);
        int min = A[0];
        int max = A[N - 1];
        long mins = 0;
        long maxs = 0;
        for (int value : A) {
            if (value == min) mins++;
            if (value == max) maxs++;
        }
        if (min == max) {
            pw.println((max - min) + " " + mins * (mins - 1) / 2);
        } else {
            pw.println((max - min) + " " + mins * maxs);
        }
        pw.close();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}
assistant: n, k = map(int, input().split())
s = input()
count = [0] * 26
for c in s:
    count[ord(c) - ord("A")] += 1
count.sort(reverse=True)
res = 0
for i in range(26):
    if count[i] >= k:
        res += k * k
        print(res)
        exit()
    k -= count[i]
    res += count[i] ** 2
print(res)


user: import java.io.*;
import java.util.*;

public class codeforces_462_B {
    public static void main(String[] args) throws Exception {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        c462b[] cards = new c462b[26];
        for (int i = 0; i < 26; i++) {
            cards[i] = new c462b();
        }
        String s = f.readLine();
        for (int t = 0; t < n; t++) {
            cards[s.charAt(t) - 'A'].left++;
        }
        long ans = 0;
        for (int i = 0; i < k; i++) {
            Arrays.sort(cards);
            long change = Math.min(cards[25].left, k - i);
            ans += change * change;
            cards[25].left -= change;
            i += change - 1;
        }
        out.println(ans);
        out.close();
    }
}

class c462b implements Comparable {
    int left = 0;

    @Override
    public int compareTo(Object o) {
        return left - ((c462b) o).left;
    }
}
assistant: max_level = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.pop(0)
y.pop(0)
x = set(x)
y = set(y)
if 0 in x:
    x.discard(0)
elif 0 in y:
    y.discard(0)
z = x.union(y)
if len(z) != max_level:
    print("Oh, my keyboard!")
else:
    print("I become the guy.")


user: import java.util.*;

public class codeforces_469_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int levels = sc.nextInt();
        int sum = 0;
        int sum2 = 0;
        int sum3 = 0;
        int[] arr = new int[levels];
        int count = 0;
        for (int i = 0; i < levels; i++) {
            arr[i] = sc.nextInt();
        }
        int level2 = sc.nextInt();
        int level3 = levels + level2;
        int[] arr2 = new int[level3];
        for (int i = 0; i < arr.length; i++) {
            arr2[i] = arr[i];
        }
        for (int i = arr.length; i < level3; i++) {
            arr2[i] = sc.nextInt();
        }
        for (int i = 0; i < arr2.length; i++) {}
        int[] arr3 = new int[n];
        int j = 0;
        for (int i = 0; i < n; i++) {
            arr3[i] = ++j;
        }
        for (int i = 0; i < n; i++) {
            for (int x = 0; x < arr2.length; x++) {
                if (arr3[i] == arr2[x]) {
                    count++;
                    break;
                }
            }
        }
        if (count == n) {
            System.out.println("I become the guy.");
        } else {
            System.out.println("Oh, my keyboard!");
        }
    }
}
assistant: L = []
input()
r = 1
for k in input().split():
    L += [r] * int(k)
    r += 1
input()
for j in input().split():
    print(L[int(j) - 1])


user: import java.io.*;
import java.util.*;

public class codeforces_474_B {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[n];
        arr[0] = sc.nextInt();
        for (int i = 1; i < n; i++) {
            int x = sc.nextInt();
            arr[i] = x + arr[i - 1];
        }
        int m = sc.nextInt();
        int q[] = new int[m];
        for (int i = 0; i < m; i++) q[i] = sc.nextInt();
        for (int k = 0; k < m; k++) System.out.println(fun(arr, q[k], n, m) + 1);
    }

    static int fun(int arr[], int q, int n, int m) {
        int res = 0;
        int i = 0, j = n;
        while (i <= j) {
            int md = i + (j - i) / 2;
            if (arr[md] == q) return md;
            else if (arr[md] > q) {
                res = md;
                j = md - 1;
            } else i = md + 1;
        }
        return res;
    }
}
assistant: a = input()
vo = ['a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y']
for i in range(len(a) - 1, - 1, - 1):
    if (a[i] == ' ' or a[i] == '?'):
        continue
    else:
        if (a[i] in vo):
            print("YES")
        else:
            print("NO")
        break


user: import java.util.Scanner;

public class codeforces_49_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int length = s.length();
        char ch = 0;
        for (int i = length - 1; i >= 0; i--) {
            if (s.charAt(i) != ' ' && s.charAt(i) != '?') {
                ch = s.charAt(i);
                break;
            }
        }
        ch = Character.toLowerCase(ch);
        if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y') {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
assistant: import sys
n, t = map(int, input().split())
s = list([int(x) for x in input().split()])
current_cell = 0
while current_cell <= t:
    current_cell += s[current_cell - 1]
    if current_cell == t:
        print("YES")
        sys.exit()
    else:
        continue
print("NO")


user: import java.util.*;

public class codeforces_500_A {
    public static boolean dfs(int currpos, int[] arr, int target) {
        if (currpos == target) return true;
        if (currpos == arr.length + 1) return false;
        boolean teleport = dfs(currpos + arr[currpos - 1], arr, target);
        if (teleport) return true;
        return false;
    }

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int goal = sc.nextInt();
        int[] arr = new int[n - 1];
        for (int i = 0; i < n - 1; i++) arr[i] = sc.nextInt();
        boolean isFound = dfs(1, arr, goal);
        if (isFound) System.out.println("YES");
        else System.out.println("NO");
        sc.close();
    }
}
assistant: ip = input()
st = ""
if len(ip) != 1:
    if ip[0] == "9":
        st = "9"
        ip = ip[1:]
    for i in ip:
        if int(i) > 4:
            n = 9 - int(i)
            st += str(n)
        else:
            st += i
else:
    st = ip
print(int(st))


user: import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class codeforces_514_A {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        List<Long> list = new ArrayList<>();
        long x = sc.nextLong();
        while (x > 0) {
            long r = x % 10;
            if (9 - r < r) {
                if (x / 10 == 0 && 9 - r == 0) list.add(r);
                else list.add(9 - r);
            } else list.add(r);
            x = x / 10;
        }
        int pow = 0;
        long newNumber = 0;
        for (int i = 0; i < list.size(); i++) {
            newNumber = newNumber + list.get(i) * (long) Math.pow(10, pow);
            pow++;
        }
        System.out.println(newNumber);
    }
}
assistant: s, t = input(), input()
freqs = dict()
freqt = dict()
yay, whoops = 0, 0
for letra in s:
    if letra in freqs:
        freqs[letra] += 1
    else:
        freqs[letra] = 1
for letra in t:
    if letra in freqt:
        freqt[letra] += 1
    else:
        freqt[letra] = 1
for letra in freqs.keys():
    while (freqs[letra] > 0 and letra in freqt and freqt[letra] > 0):
        yay += 1
        freqs[letra] -= 1
        freqt[letra] -= 1
for letra in freqs.keys():
    while (freqs[letra] > 0):
        if letra.islower() and letra.upper() in freqt.keys() and freqt[letra.upper()] > 0:
            whoops += 1
            freqs[letra] -= 1
            freqt[letra.upper()] -= 1
        elif letra.isupper() and letra.lower() in freqt.keys() and freqt[letra.lower()] > 0:
            whoops += 1
            freqs[letra] -= 1
            freqt[letra.lower()] -= 1
        else:
            break
print(yay, whoops)


user: import java.util.*;

public class codeforces_518_B {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        StringBuilder s = new StringBuilder(scan.next());
        String t = scan.next();
        int ura = 0;
        int opa = 0;
        Map<Character, Integer> tmap = new HashMap<>();
        for (int i = 0; i < t.length(); i++) {
            Character ch = t.charAt(i);
            if (!tmap.containsKey(ch)) tmap.put(ch, 1);
            else tmap.put(ch, tmap.get(ch) + 1);
        }
        int length = s.length();
        for (int i = 0; i < length; i++) {
            Character ch = s.charAt(i);
            Integer num = tmap.get(ch);
            if (num == null) continue;
            int inum = num;
            if (inum == 1) tmap.remove(ch);
            else tmap.put(ch, inum - 1);
            s.setCharAt(i, 'Я');
            ura++;
        }
        for (int i = 0; i < length; i++) {
            Character ch = s.charAt(i);
            Character rch = reverse(ch);
            Integer num = tmap.get(rch);
            if (num == null) continue;
            int inum = num;
            if (inum == 1) tmap.remove(rch);
            else tmap.put(rch, inum - 1);
            opa++;
        }
        System.out.println(ura + " " + opa);
    }

    public static Character reverse(Character ch) {
        if (Character.isLowerCase(ch)) {
            return Character.toUpperCase(ch);
        } else return Character.toLowerCase(ch);
    }
}
assistant: n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in a:
    x += i
for i in b:
    y += i
for i in c:
    z += i
print(abs(x - y))
print(abs(y - z))


user: import java.io.*;
import java.util.*;

public class codeforces_519_B {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = 0, b = 0, c = 0;
        for (int i = 0; i < n; i++) a += sc.nextInt();
        for (int i = 0; i < n - 1; i++) b += sc.nextInt();
        for (int i = 0; i < n - 2; i++) c += sc.nextInt();
        int x = a - b, y = b - c;
        System.out.println(x);
        System.out.println(y);
    }
}
assistant: v1, v2 = input().split()
t, d = input().split()
v1 = int(v1)
v2 = int(v2)
t = int(t)
d = int(d)
a = 1
v = v1
distance = 0
for i in range(t):
    if v - v2 > (t - i - 1) * d:
        a *= - 1
        v = (t - i - 1) * d + v2
    distance += v
    v += a * d
print(distance)


user: import java.util.Arrays;
import java.util.Scanner;

public class codeforces_534_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int v1 = sc.nextInt();
        int v2 = sc.nextInt();
        int t = sc.nextInt();
        int d = sc.nextInt();
        long[][] dp = new long[t - 1][1150];
        for (int i = 0; i < t - 1; i++) {
            Arrays.fill(dp[i], -(long) (1e17));
        }
        dp[0][v1] = v1;
        long sum = 0;
        for (int i = 1; i < t - 1; i++) {
            for (int j = 0; j < 1150; j++) {
                for (int x = 0; x <= d; x++) {
                    if (j + x < 1150) dp[i][j] = Math.max(dp[i][j], dp[i - 1][j + x] + j);
                }
                for (int x = d; x >= 0; x--) {
                    if (j - x >= 0) {
                        dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - x] + j);
                    }
                }
            }
        }
        long ans = Long.MIN_VALUE;
        for (int i = t - 2; i < t - 1; i++) {
            for (int j = 0; j < 1150; j++) {
                if (Math.abs(j - v2) <= d) ans = Math.max(ans, dp[i][j] + v2);
            }
        }
        System.out.println(ans);
    }
}
assistant: n, k = map(int, input().split())
x = 0
if k <= max(n ** 2 // 2, n ** 2 - (n ** 2 // 2)):
    print('YES')
    for i in range(n):
        for j in range(n):
            if i % 2 == j % 2 and x < k:
                print('L', end='')
                x += 1
            else:
                print('S', end='')
        print()
else:
    print('NO')


user: import java.util.Scanner;

public class codeforces_544_B {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int count = scan.nextInt();
        printIsland(n, count);
    }

    public static void printIsland(int n, int count) {
        int a = (n + 1) / 2;
        int b = n / 2;
        int max = a * a + b * b;
        if (count > max) {
            System.out.println("NO");
            return;
        }
        System.out.println("YES");
        for (int i = 0; i < n; i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < n; j++) {
                if ((i + j) % 2 == 0 && count > 0) {
                    sb.append('L');
                    count--;
                } else {
                    sb.append('S');
                }
            }
            System.out.println(sb);
        }
    }
}
assistant: k, n, w = input().split()
if 1 <= int(k) and int(w) <= 1000:
    total = 0
    for i in range(1, int(w) + 1):
        total += i * int(k)
    if total > int(n):
        print(total - int(n))
    else:
        print(0)


user: import java.util.Scanner;

public class codeforces_546_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long pandu, vundu, urdu, c = 0;
        pandu = sc.nextLong();
        vundu = sc.nextLong();
        urdu = sc.nextLong();
        for (int i = 1; i <= urdu; i++) {
            c += i * pandu;
        }
        if (c < vundu) {
            System.out.print("0");
        } else {
            System.out.print(c - vundu);
        }
    }
}
assistant: n = int(input())
while n % 2 == 0:
    n /= 2
if n == 1:
    print('YES')
else:
    print('NO')


user: import java.io.*;
import java.util.*;

public class codeforces_55_A {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, i = 1, k = 0, p = 1;
        boolean flag = true;
        int[] a = new int[1000];
        n = scan.nextInt();
        i = 0;
        while (k <= n) {
            i += k;
            if (i >= n) {
                while (!(i < n)) i = i - n;
            }
            ++a[i];
            ++k;
        }
        for (i = 0; i < n; ++i)
            if (a[i] == 0) {
                flag = false;
                break;
            }
        if (flag) System.out.println("YES");
        else System.out.println("NO");
    }
}
assistant: def rememberTheNumber(nums, i, operations, ans):
    if i >= 3:
        return
    for j in range(4):
        for k in range(j + 1, 4):
            if (nums[j] != - 1 and nums[k] != - 1):
                s = nums[j]
                nums[j] = - 1
                t = nums[k]
                if (operations[i] == '+'):
                    nums[k] = s + t
                elif (operations[i] == '*'):
                    nums[k] = s * t
                if (i == 2 and nums[k] < ans[0]):
                    ans[0] = nums[k]
                rememberTheNumber(nums, i + 1, operations, ans)
                nums[j] = s
                nums[k] = t


nums = list(map(int, input().split()))
operations = list(map(str, input().split()))
ans = [10000000000000000000000000]
rememberTheNumber(nums, 0, operations, ans)
print(ans[0])


user: import java.util.*;

public class codeforces_55_B {
    static long min;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        min = Long.MAX_VALUE;
        ArrayList<Long> arr = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            arr.add(sc.nextLong());
        }
        String[] ops = new String[3];
        for (int i = 0; i < 3; i++) {
            ops[i] = sc.next();
        }
        util(arr, ops, 0);
        System.out.println(min);
    }

    public static void util(ArrayList<Long> arr, String[] ops, int idx) {
        if (idx == 3) {
            min = Math.min(min, arr.get(0));
            return;
        }
        for (int i = 0; i < arr.size(); i++) {
            for (int j = i + 1; j < arr.size(); j++) {
                ArrayList<Long> a = new ArrayList<>();
                for (int k = 0; k < arr.size(); k++) {
                    if (k != j && k != i) {
                        a.add(arr.get(k));
                    }
                }
                long res;
                if (idx < 3 && ops[idx].equals("+")) {
                    res = arr.get(i) + arr.get(j);
                } else {
                    res = arr.get(i) * arr.get(j);
                }
                a.add(res);
                util(a, ops, idx + 1);
            }
        }
    }
}
assistant: inp = int(input())
lista = []
lista = [int(x) for x in input().split()]
for i in range(len(lista)):
    if i == 0:
        print(f"{lista[i+1] - lista[i]} {lista[len(lista)-1] - lista[i]}")
        continue
    elif i == len(lista) - 1:
        print(
            f"{lista[len(lista)-1] - lista[len(lista)-2]} {lista[len(lista)-1] - lista[0]}")
        continue
    elif lista[i] - lista[i - 1] > lista[i + 1] - lista[i]:
        print(lista[i + 1] - lista[i], end=" ")
    else:
        print(lista[i] - lista[i - 1], end=" ")
    if lista[len(lista) - 1] - lista[i] > lista[i] - lista[0]:
        print(lista[len(lista) - 1] - lista[i])
    else:
        print(lista[i] - lista[0])


user: import java.util.Scanner;

public class codeforces_567_A {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int ar[] = new int[a];
        int max = 0, min = 0;
        for (int i = 0; i < ar.length; i++) ar[i] = s.nextInt();
        for (int i = 0; i < ar.length; i++) {
            max = Math.max(ar[i] - ar[0], ar[ar.length - 1] - ar[i]);
            if (i == 0) min = ar[i + 1] - ar[i];
            else if (i == ar.length - 1) min = ar[i] - ar[i - 1];
            else min = Math.min(ar[i] - ar[i - 1], ar[i + 1] - ar[i]);
            System.out.println(min + " " + max);
        }
    }
}
assistant: t, s, q = map(int, input().split())
ans = 0
while (s < t):
    s *= q
    ans += 1
print(ans)


user: import java.util.Scanner;

public class codeforces_569_A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        int S = in.nextInt();
        int q = in.nextInt();
        long previous = S;
        int answer = 0;
        while (previous < T) {
            answer++;
            previous *= q;
        }
        System.out.println(answer);
    }
}