zccneil/codelingua_dataset huggingface dataset:
assistant: n, m = map(int, input().strip().split())
out = [0 for _ in range(n)]
comp = [i + 2 for i in range(n)]
for _ in range(m):
    l, r, x = map(int, input().strip().split())
    t = l
    while t <= r:
        next_val = comp[t - 1]
        if out[t - 1] == 0 and t != x:
            out[t - 1] = x
        comp[t - 1] = r + 1 if t >= x else x
        t = next_val
print(* out)


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

public class codeforces_356_A {
    public static void main(String[] args) throws Exception {
        FastReader in = new FastReader();
        int n = in.nextInt();
        TreeSet<Integer> left = new TreeSet<>();
        int[] answer = new int[n];
        for (int i = 0; i < n; i++) {
            left.add(i);
        }
        int q = in.nextInt();
        while (q-- > 0) {
            int l = in.nextInt() - 1;
            int r = in.nextInt() - 1;
            int win = in.nextInt();
            while (left.ceiling(l) != null && left.ceiling(l) <= r) {
                int curr = left.ceiling(l);
                answer[curr] = win;
                left.remove(curr);
            }
            answer[win - 1] = 0;
            left.add(win - 1);
        }
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < n; i++) {
            ans.append(answer[i] + "");
        }
        System.out.println(ans);
    }

    static class FastReader {
        StringTokenizer st;
        BufferedReader br;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() {
            String s = "";
            while (st == null || st.hasMoreElements()) {
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return s;
        }
    }
}
assistant: def get_nums(num, t):
    return [t // num + 1 if i in range(t % num) else t // num for i in range(num)]


n, k, l, r, sa, sk = map(int, input().split())
ans = get_nums(k, sk) + get_nums(n - k, sa - sk)
print(' '.join(map(str, ans)))


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

public class codeforces_369_B {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int l = scan.nextInt();
        int r = scan.nextInt();
        int sAll = scan.nextInt();
        int sk = scan.nextInt();
        int[] ans = getPoints(n, k, l, r, sAll, sk);
        for (int num : ans) {
            System.out.print(num + " ");
        }
    }

    public static int[] getPoints(int n, int k, int l, int r, int sAll, int sk) {
        int[] ans = new int[n];
        Arrays.fill(ans, l);
        sAll -= sk + (n - k) * l;
        sk -= k * l;
        while (sk > 0) {
            int idx = n - 1;
            while (sk > 0 && idx >= n - k) {
                ans[idx--]++;
                sk--;
            }
        }
        while (sAll > 0) {
            int idx = 0;
            while (sAll > 0 && idx < n - k) {
                ans[idx++]++;
                sAll--;
            }
        }
        return ans;
    }
}
assistant: def sum(k):
    ret = 0
    pw = 10
    len = 1
    while 1 == 1:
        cur = min(pw - 1, k)
        prev = pw // 10
        ret += (cur - prev + 1) * len
        if (pw - 1 >= k):
            break
        len += 1
        pw *= 10
    return ret


w, m, k = map(int, input().split())
lo = 0
hi = int(1e18)
while hi - lo > 1:
    md = (lo + hi) // 2
    c = sum(m + md - 1) - sum(m - 1)
    if c * k <= w:
        lo = md
    else:
        hi = md
print(lo)


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

public class codeforces_373_B {
    public static long ans = 0;

    public static long get(long a) {
        long ret = 0;
        long now = 1;
        long t = 1;
        for (; ; ) {
            if (now * 10 > a) {
                ret += (a - now + 1) * t;
                break;
            }
            ret += now * 9 * t;
            now *= 10;
            t++;
        }
        return ret;
    }

    public static long binarySearch(long k, long l, long r, long x) {
        if (r >= l) {
            long mid = l + (r - l) / 2;
            if (mid > ans && mid * k <= x) ans = mid;

            if (k * mid == x) return mid;

            if (k * mid > x) return binarySearch(k, l, mid - 1, x);

            return binarySearch(k, mid + 1, r, x);
        }

        return -1;
    }

    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        Scanner S = new Scanner(System.in);
        long gen, st, tim;
        gen = S.nextLong();
        st = S.nextLong();
        tim = S.nextLong();
        gen /= tim;
        long beg = st - 1, end = (long) Math.pow(10, 18);
        while (true) {
            long med = (beg + end) / 2 + 1;
            if (get(med) - get(st - 1) > gen) {
                end = med - 1;
            } else {
                beg = med;
            }
            if (beg == end) {
                System.out.println(beg - st + 1);
                break;
            }
        }
    }
}
assistant: import re
candeleIntere, b = map(int, input().split())
s = 0
restoSciolte = 0
while candeleIntere > 0 or restoSciolte >= b:
    candeleIntere += restoSciolte // b
    restoSciolte %= b
    s += candeleIntere
    restoSciolte += candeleIntere % b
    candeleIntere //= b
print(s)


user: import java.util.*;

public class codeforces_379_A {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int res = a;
        while (a >= b) {
            res += (a / b);
            a = (a / b) + (a % b);
        }
        System.out.println(res);
    }
}
assistant: n = int(input())
l = list(map(int, input().split()))
high = 1
tower = n
maximum = 1
l.sort()
for i in range(1, n):
    if l[i] == l[i - 1]:
        tower -= 1
        high += 1
    else:
        if high > maximum:
            maximum = high
        high = 1
if high > maximum:
    maximum = high
print(maximum, tower)


user: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class codeforces_37_A {
    public static void main(String[] args) {
        FastScanner input = new FastScanner();
        int n = input.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int val = input.nextInt();
            map.put(val, map.getOrDefault(val, 0) + 1);
        }
        int max = Integer.MIN_VALUE;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            Integer value = entry.getValue();
            max = Math.max(max, value);
        }
        System.out.println(max + "" + map.size());
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() throws IOException {
            return br.readLine();
        }
    }
}
assistant: h1, m1 = (map(int, input().split(':')))
m1 += h1 * 60
h2, m2 = (map(int, input().split(':')))
m2 += h2 * 60
m2 = m1 - m2
m2 %= 1440
print("%02d:%02d" % (m2 // 60, m2 % 60))


user: import java.io.IOException;
import java.time.LocalTime;
import java.util.*;

public class codeforces_387_A {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split(":");
        String[] t = sc.next().split(":");
        LocalTime x = LocalTime.of(Integer.parseInt(s[0]), Integer.parseInt(s[1]));
        LocalTime y = LocalTime.of(Integer.parseInt(t[0]), Integer.parseInt(t[1]));
        System.out.println(x.minusHours(y.getHour()).minusMinutes(y.getMinute()));
    }
}
assistant: def main():
    n, m = [int(i) for i in input().split()]
    round_complexity = [int(i) for i in input().split()]
    george_complexity = [int(i) for i in input().split()]
    i = j = 0
    while (i < n and j < m):
        i += 1 * (round_complexity[i] <= george_complexity[j])
        j += 1
    print(n - i)


if __name__ == '__main__':
    main()


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

public class codeforces_387_B {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int m = input.nextInt();
        ArrayList<Integer> req = new ArrayList();
        ArrayList<Integer> pre = new ArrayList();
        for (int i = 0; i < n; i++) {
            req.add(input.nextInt());
        }
        for (int i = 0; i < m; i++) {
            pre.add(input.nextInt());
        }
        int i = n - 1, j = m - 1;
        int ans = 0;
        while (i >= 0 && j >= 0) {
            if (req.get(i) > pre.get(j)) {
                ans++;
            } else {
                j--;
            }
            i--;
        }
        System.out.print(ans + i + 1);
    }
}
assistant: class CodeforcesTask397BSolution:
    def __init__(self):
        self.result = ''
        self.t = 0
        self.queries = []

    def read_input(self):
        self.t = int(input())
        for _ in range(self.t):
            self.queries.append([int(x) for x in input().split(" ")])

    def process_task(self):
        res = []
        for query in self.queries:
            k = query[0] // query[1]
            res.append("Yes" if k * query[2] >= query[0] else "No")
        self.result = "\n".join(res)

    def get_result(self):
        return self.result


if __name__ == "__main__":
    Solution = CodeforcesTask397BSolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())


user: import java.io.PrintWriter;
import java.util.Scanner;

public class codeforces_397_B {
    static int N;
    static int MOD = (int) (1e9 + 7);

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int t = in.nextInt();
        while (t-- > 0) {
            long n = in.nextInt();
            long a = in.nextInt();
            long b = in.nextInt();
            if (n < a) {
                out.println("No");
                continue;
            }
            if (a == b) {
                if (n % a == 0) {
                    out.println("Yes");
                } else {
                    out.println("No");
                }
                continue;
            }
            long x = b / (b - a);
            if (n > x * a) {
                out.println("Yes");
                continue;
            }
            long low = 1;
            long high = x + 1;
            long ans = 1;
            while (low <= high) {
                long mid = (low + high) / 2;
                if (mid * a < n) {
                    low = mid + 1;
                } else {
                    ans = mid;
                    high = mid - 1;
                }
            }
            if (n > (ans - 1) * b && n < ans * a) {
                out.println("No");
            } else {
                out.println("Yes");
            }
        }
        out.close();
    }
}
assistant: import collections
import heapq
import sys
import math
import itertools
import bisect
from io import BytesIO, IOBase
import os
def value(): return tuple(map(int, input().split()))
def values(): return tuple(map(int, sys.stdin.readline().split()))
def inlst(): return [int(i) for i in input().split()]
def inlsts(): return [int(i) for i in sys.stdin.readline().split()]
def inp(): return int(input())
def inps(): return int(sys.stdin.readline())
def instr(): return input()
def stlst(): return [i for i in input().split()]


def help(a, b, l):
    tot = []
    for i in range(b):
        tot.append(l[i * a: i * a + a])
    for i in zip(* tot):
        if sum((i)) == b:
            return True
    return False


def solve():
    tot = []
    x = instr()
    s = []
    for i in x:
        if i == 'O':
            s.append(0)
        else:
            s.append(1)
    for i in range(1, 13):
        if 12 % i == 0:
            if help(i, 12 // i, s):
                tot.append((12 // i, i))
    print(len(tot), end=' ')
    for a, b in sorted(tot):
        print(f'{a}x{b}', end=' ')
    print()


if __name__ == "__main__":
    for i in range(inp()):
        solve()


user: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class codeforces_400_A {
    public static boolean isSolution(int columnsCount, String x) {
        boolean allXs[] = new boolean[columnsCount];
        Arrays.fill(allXs, true);
        for (int i = 0; i < 12; i++) {
            if (x.charAt(i) != 'X') allXs[i % columnsCount] = false;
        }
        for (int i = 0; i < columnsCount; i++) if (allXs[i]) return true;
        return false;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int t = Integer.parseInt(br.readLine());
        for (int i = 0; i < t; i++) {
            int possibleSolutions = 0;
            StringBuilder solutions = new StringBuilder();
            String s = br.readLine();
            if (isSolution(12, s)) {
                solutions.append(" 1x12");
                possibleSolutions++;
            }
            if (isSolution(6, s)) {
                solutions.append(" 2x6");
                possibleSolutions++;
            }
            if (isSolution(4, s)) {
                solutions.append(" 3x4");
                possibleSolutions++;
            }
            if (isSolution(3, s)) {
                solutions.append(" 4x3");
                possibleSolutions++;
            }
            if (isSolution(2, s)) {
                solutions.append(" 6x2");
                possibleSolutions++;
            }
            if (isSolution(1, s)) {
                solutions.append(" 12x1");
                possibleSolutions++;
            }
            pw.print(possibleSolutions++);
            pw.println(solutions);
        }
        pw.flush();
        pw.close();
    }
}
assistant: n, m = map(int, input().split())
c = set(s.find("S") - s.find("G") for s in (input() for _ in range(n)))
print(- 1 if any(a < 0 for a in c) else len(c))


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

public class codeforces_400_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        String arrs[] = new String[n];
        for (int i = 0; i < n; i++) {
            arrs[i] = sc.next();
        }
        int[] length = new int[n];
        int index = 0;
        int returnDex = 0;
        for (String tmp : arrs) {
            int dexG = tmp.indexOf("G");
            int dexS = tmp.indexOf("S");
            if (dexG > dexS) {
                returnDex = -1;
            }
            length[index++] = dexS - dexG;
        }
        HashSet set = new HashSet<Integer>();
        for (int len : length) {
            set.add(len);
        }
        if (returnDex == -1) {
            System.out.println(returnDex);
        } else {
            System.out.println(set.size());
        }
    }
}
assistant: n = int(input())
s = []
for i in range(n):
    k = input()
    s.append(k)
flag = 0
d1 = []
d2 = []
rem = set()
for i in range(n):
    for j in range(n):
        if (i == j):
            d1.append(s[i][j])
        if (i == n - j - 1):
            d2.append(s[i][j])
        if (i != j and i != n - j - 1):
            rem.add(s[i][j])
if (len(rem) != 1):
    print('NO')
elif (d1 != d2):
    print('NO')
elif (len(set(d1)) != 1):
    print('NO')
elif (set(d1) == rem):
    print('NO')
else:
    print('YES')


user: import java.util.*;

public class codeforces_404_A {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char arr[][] = new char[n][n];
        String str[] = new String[n];
        for (int i = 0; i < n; i++) {
            str[i] = sc.next();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                arr[i][j] = str[i].charAt(j);
            }
        }
        char a = arr[0][0];
        char b = arr[0][1];
        if (a == b) System.out.println("NO");
        else {
            boolean res = true;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (i == j || i + j == n - 1) {
                        if (arr[i][j] != a) {
                            res = false;
                            break;
                        }
                    } else {
                        if (arr[i][j] != b) {
                            res = false;
                            break;
                        }
                    }
                }
            }
            if (res) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}
assistant: from collections import defaultdict, deque
from functools import lru_cache
from heapq import heappush, heappop
from typing import Counter
from bisect import bisect_right, bisect_left
import math
hpop = heappop
hpush = heappush


def solution():
    line = input()
    bought_count = Counter(line)
    line = input()
    made_cout = Counter(line)
    res = 0
    for color in made_cout:
        if color not in bought_count:
            return print(- 1)
        res += min(bought_count[color], made_cout[color])
    print(res)


def main():
    t = 1
    for _ in range(t):
        solution()


main()


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

public class codeforces_408_B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String s1 = s.next();
        String s2 = s.next();
        if (isValid(s1, s2) == false) {
            System.out.println(-1);
        } else {
            HashMap<Character, Integer> m1 = new HashMap<>();
            HashMap<Character, Integer> m2 = new HashMap<>();
            for (char c : s1.toCharArray()) {
                if (m1.containsKey(c)) {
                    m1.put(c, m1.get(c) + 1);
                } else {
                    m1.put(c, 1);
                }
            }
            for (char c : s2.toCharArray()) {
                if (m2.containsKey(c)) {
                    m2.put(c, m2.get(c) + 1);
                } else {
                    m2.put(c, 1);
                }
            }
            int ans = 0;
            HashSet<Character> hs = new HashSet<>();
            for (char c : s2.toCharArray()) {
                if (!hs.contains(c)) {
                    hs.add(c);
                    int x1 = m1.get(c);
                    int x2 = m2.get(c);
                    x1 = Math.min(x1, x2);
                    ans += x1;
                }
            }
            System.out.println(ans);
        }
    }

    public static boolean isValid(String s1, String s2) {
        int n1 = s1.length();
        int n2 = s2.length();
        HashMap<Character, Boolean> map = new HashMap<>();
        for (char c : s1.toCharArray()) {
            map.put(c, true);
        }
        for (char c : s2.toCharArray()) {
            if (!map.containsKey(c)) return false;
        }
        return true;
    }
}
assistant: n, k = map(int, input().split())
v = input()
d = ["LEFT", "RIGHT"]
f = k - 1 < n - k
m = min(k - 1, n - k)
a = []
for i in range(0, m):
    a.append(d[not f])
for i in v[:: - 1 + 2 * f]:
    a.append("PRINT " + i)
    a.append(d[f])
print(* a[: - 1], sep="\n")


user: import java.util.Scanner;

public class codeforces_412_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        String a = sc.next();
        if (k > n / 2) {
            while (k < n) {
                System.out.println("RIGHT");
                k++;
            }
        } else {
            while (k > 1) {
                System.out.println("LEFT");
                k--;
            }
        }
        if (k == 1) {
            for (int i = 0; i < a.length(); i++) {
                System.out.println("PRINT " + a.charAt(i));
                if ((i + 1) < a.length()) {
                    System.out.println("RIGHT");
                }
            }
        } else {
            for (int i = a.length() - 1; i >= 0; i--) {
                System.out.println("PRINT " + a.charAt(i));
                if ((i - 1) >= 0) {
                    System.out.println("LEFT");
                }
            }
        }
    }
}
assistant: n, a, b = [int(x) for x in input().split(" ")]
lista = [int(x) for x in input().split(" ")]
listb = [int(x) for x in input().split(" ")]
for k in range(n):
    if k + 1 in lista:
        print(1, end=" ")
    else:
        print(2, end=" ")


user: import java.util.*;

public class codeforces_421_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, a, b;
        n = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
        ArrayList<Integer> list1 = new ArrayList<>();
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 0; i < a; i++) {
            list1.add(sc.nextInt());
        }
        for (int i = 0; i < b; i++) {
            list2.add(sc.nextInt());
        }
        for (int i = 0; i < n; i++) {
            if (list1.contains(i + 1)) {
                System.out.print(1 + " ");
            } else {
                System.out.print(2 + " ");
            }
        }
    }
}
assistant: n, m = map(int, input().split())
l = []
for i in range(n):
    s = input()
    s = list(s)
    for j in range(m):
        if s[j] == '.':
            if (i + j) & 1:
                s[j] = 'W'
            else:
                s[j] = 'B'
    l.append(s)
for c in l:
    print("".join(c))


user: import java.io.*;

public class codeforces_445_A {
    public static void main(String[] args) throws IOException {
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        String[] inp = buf.readLine().split("");
        int n = Integer.parseInt(inp[0]);
        int m = Integer.parseInt(inp[1]);
        String[] ans = new String[n];
        for (int i = 0; i < n; i++) {
            String str = buf.readLine();
            StringBuilder temp = new StringBuilder("");
            for (int j = 0; j < m; j++)
                if (str.charAt(j) == '-') temp.append("-");
                else {
                    if ((i + j) % 2 == 1) temp.append("W");
                    else temp.append("B");
                }
            ans[i] = temp.toString();
        }
        for (int i = 0; i < n; i++) {
            System.out.println(ans[i]);
        }
    }
}