zccneil/codelingua_dataset huggingface dataset:
assistant: n = int(input())
x = list(int(i) for i in input().split())
a = []
b = []
for i in range(0, n):
    if i % 2 == 0:
        a.append(x[i])
    else:
        b.append(x[i])
cnta = [0] * (100002 + 1)
cntb = [0] * (100002 + 1)
vala = 0
vala1 = 0
maxCnta = 0
maxCnta1 = 0
for i in a:
    cnta[i] += 1
for i in a:
    if maxCnta < cnta[i]:
        vala = i
        maxCnta = cnta[i]
for i in a:
    if maxCnta1 < cnta[i] and vala != i:
        maxCnta1 = cnta[i]
        vala1 = i
valb = 0
valb1 = 0
maxCntb = 0
maxCntb1 = 0
for i in b:
    cntb[i] += 1
for i in b:
    if maxCntb < cntb[i]:
        valb = i
        maxCntb = cntb[i]
for i in b:
    if maxCntb1 < cntb[i] and valb != i:
        maxCntb1 = cntb[i]
        valb1 = i
if valb != vala:
    res = 0
    for i in a:
        if i != vala:
            res += 1
    for i in b:
        if i != valb:
            res += 1
    print(res)
else:
    resa = 0
    resb = 0
    resa1 = 0
    resb1 = 0
    for i in a:
        if i != vala:
            resa += 1
        if i != vala1:
            resa1 += 1
    for i in b:
        if i != valb:
            resb += 1
        if i != valb1:
            resb1 += 1
    print(min(resa + resb1, resa1 + resb))


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

public class atcoder_ABC111_C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] v = new int[100010];
        for (int i = 0; i < n; i++) {
            v[i] = Integer.parseInt(sc.next());
        }
        Integer[] vo = new Integer[100010];
        Integer[] ve = new Integer[100010];
        Integer[] vt = new Integer[100010];
        Arrays.fill(vo, 0);
        Arrays.fill(ve, 0);
        Arrays.fill(vt, 0);
        for (int i = 0; i < n; i++) {
            vt[v[i]]++;
            if (i % 2 == 0) {
                ve[v[i]]++;
            } else {
                vo[v[i]]++;
            }
        }
        Arrays.sort(vo, Collections.reverseOrder());
        Arrays.sort(ve, Collections.reverseOrder());
        Arrays.sort(vt, Collections.reverseOrder());
        int ans = 0;
        if (vo[0] + ve[0] == vt[0]) {
            ans = Math.min(n - vo[0] - ve[1], n - vo[1] - ve[0]);
        } else {
            ans = n - vo[0] - ve[0];
        }
        System.out.println(ans);
        sc.close();
    }
}
assistant: age = int(input())
if age == 1:
    print('Hello World')
else:
    a, b = [int(input()) for i in range(2)]
    print(a + b)


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

public class atcoder_ABC112_A {
    private static BufferedReader br = null;

    public static void main(String[] args) {
        int n = Integer.parseInt(read(1)[0]);
        if (n == 1) {
            System.out.println("Hello World");
        } else {
            String[] strs = read(2);
            System.out.println(Integer.parseInt(strs[0]) + Integer.parseInt(strs[1]));
        }
    }

    private static String[] read(int len) {
        List<String> strList = new ArrayList<>();
        try {
            if (br == null) {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
            for (int i = 0; i < len; i++) {
                strList.add(br.readLine());
            }
        } catch (IOException e) {
        }
        return strList.toArray(new String[0]);
    }

    private static void close() {
        try {
            if (br != null) {
                br.close();
            }
        } catch (IOException e) {
        }
    }
}
assistant: import sys


def solve(n, ls_xyh):
    x0 = None
    for i in range(n):
        if ls_xyh[i][2] > 0:
            [x0, y0, h0] = ls_xyh[i]
            break
    cands = [(cx, cy, h0 + abs(cx - x0) + abs(cy - y0))
             for cx in range(101) for cy in range(101)]
    for [x, y, h] in ls_xyh:
        cands = [(cx, cy, ch) for (cx, cy, ch) in cands if max(
            ch - abs(cx - x) - abs(cy - y), 0) == h]
    (xx, yy, hh) = cands[0]
    return ' '.join([str(xx), str(yy), str(hh)])


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    n = int(ws[0])
    ls_xyh = [list(map(int, sys.stdin.readline().strip().split()))
              for j in range(n)]
    return (n, ls_xyh)


def main():
    print(solve(* readQuestion()))


main()


user: import java.util.Scanner;
import java.util.stream.IntStream;

public class atcoder_ABC112_C {
    private static final int MAX = 100;

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int n = scanner.nextInt();
            int[] x = new int[n], y = new int[n], h = new int[n];
            IntStream.range(0, n)
                    .forEach(
                            i -> {
                                x[i] = scanner.nextInt();
                                y[i] = scanner.nextInt();
                                h[i] = scanner.nextInt();
                            });
            for (int i = 0; i <= MAX; i++) {
                for (int j = 0; j <= MAX; j++) {
                    int ch = check(n, x, y, h, i, j);
                    if (ch > 0) {
                        System.out.println(i + " " + j + " " + ch);
                    }
                }
            }
        }
    }

    private static int check(int n, int[] x, int[] y, int[] h, int cx, int cy) {
        int ch = -1;
        for (int i = 0; i < n; i++) {
            if (h[i] > 0) {
                ch = Math.abs(x[i] - cx) + Math.abs(y[i] - cy) + h[i];
                break;
            }
        }
        for (int i = 0; i < n; i++) {
            if (h[i] != Math.max(ch - Math.abs(x[i] - cx) - Math.abs(y[i] - cy), 0)) {
                return -1;
            }
        }
        return ch;
    }
}
assistant: N = int(input())


def aaa(n):
    if int(n) > N:
        return 0
    ans = 1 if set(str(int(n))) == {'7', '5', '3'} else 0
    for i in '753':
        ans += aaa(n + i)
    return ans


print(aaa('0'))


user: import java.util.Scanner;

public class atcoder_ABC114_C {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        int N = gi();
        long i = 357;
        int c = 0;
        while (i <= N) {
            String s = String.valueOf(i);
            if (s.contains("3") && s.contains("5") && s.contains("7")) c++;
            StringBuilder sb = new StringBuilder();
            boolean f = false;
            for (int j = 0; j < s.length(); j++) {
                char a = s.charAt(s.length() - 1 - j);
                if (f) {
                    sb.append(a);
                } else {
                    if (a == '3') {
                        sb.append('5');
                        f = true;
                    } else if (a == '5') {
                        sb.append('7');
                        f = true;
                    } else {
                        sb.append('3');
                    }
                }
            }
            if (!f) sb.append(3);
            StringBuffer sb2 = new StringBuffer(sb);
            i = Long.parseLong(sb2.reverse().toString());
        }
        System.out.println(c);
    }

    public static String gs() {
        return scanner.next();
    }

    public static int gi() {
        return Integer.parseInt(scanner.next());
    }

    public static long gl() {
        return Long.parseLong(scanner.next());
    }

    public static double gd() {
        return Double.parseDouble(scanner.next());
    }
}
assistant: import fractions
import functools
N = int(input())
A = list(map(int, input().split()))
gcd = functools.reduce(fractions.gcd, A)
print(gcd)


user: import java.util.*;

public class atcoder_ABC118_C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> a = new ArrayList<>();
        if (n == 1) {
            System.out.println(sc.nextInt());
            System.exit(0);
        }
        for (int i = 0; i < n; i++) {
            a.add(sc.nextInt());
        }
        Collections.sort(a);
        if (a.get(a.size() - 1) == 0) {
            System.out.println(0);
            System.exit(0);
        }
        int ans = 0;
        while (true) {
            if (a.size() == 1) {
                ans = a.get(0);
                break;
            }
            a = func(a);
        }
        System.out.println(ans);
    }

    private static ArrayList<Integer> func(ArrayList<Integer> A) {
        ArrayList<Integer> a = A;
        int min = 0;
        for (int i = 0; i < a.size(); i++) {
            if (a.get(i) == 0) {
                a.remove(i);
                i--;
            } else {
                if (min != 0) {
                    a.set(i, a.get(i) % min);
                    if (a.get(i) == 1) {
                        System.out.println(1);
                        System.exit(0);
                    }
                } else {
                    min = a.get(i);
                }
            }
        }
        Collections.sort(a);
        return a;
    }
}
assistant: N = int(input())
x = [eval(input().replace('JPY', '* 1.0').replace('BTC', '* 380000.0'))
     for i in range(N)]
print(sum(x))


user: import java.util.Scanner;
import java.util.stream.IntStream;

public class atcoder_ABC119_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double[] x = new double[N];
        String[] u = new String[N];
        for (int i = 0; i < N; ++i) {
            x[i] = sc.nextDouble();
            u[i] = sc.next();
        }
        System.out.println(solve(x, u));
        sc.close();
    }

    static double solve(double[] x, String[] u) {
        return IntStream.range(0, x.length)
                .mapToDouble(i -> x[i] * (u[i].equals("JPY") ? 1 : 380000))
                .sum();
    }
}
assistant: from collections import deque
from collections import Counter
from itertools import product, permutations, combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    s = input()
    if len(set(s)) == 1:
        print(0)
        sys.exit()
    a = Counter(s)
    ans = min(a.values()) * 2
    print(ans)


if __name__ == '__main__':
    main()


user: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Stack;
import java.util.StringTokenizer;

public class atcoder_ABC120_C {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String x = in.next();
            Stack<Character> s = new Stack<>();
            int c = 0;
            for (int i = 0; i < x.length(); i++) {
                s.push(x.charAt(i));
                while (s.size() > 1) {
                    Character p = s.pop();
                    Character q = s.pop();
                    if ((p == '1' && q == '0') || (p == '0' && q == '1')) {
                        c++;
                        continue;
                    } else {
                        s.push(q);
                        s.push(p);
                        break;
                    }
                }
            }
            out.println(c * 2);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}
assistant: from itertools import accumulate
n, q = map(int, input().split())
s = input()
problems = [list(map(int, input().split())) for _ in range(q)]


def count(total, i):
    return total + 1 if s[i - 1: i + 1] == 'AC' else total


cumsum = list(accumulate([0] + list(range(1, n)), count))
for l, r in problems:
    print(cumsum[r - 1] - cumsum[l - 1])


user: import java.util.*;

public class atcoder_ABC122_C {
    static final long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        char[] c = sc.next().toCharArray();
        int[][] range = new int[q][2];
        for (int i = 0; i < q; i++) {
            range[i][0] = sc.nextInt();
            range[i][1] = sc.nextInt();
        }
        int[] frag = new int[n + 1];
        int[] rui = new int[n + 1];
        for (int i = 2; i <= n; i++) {
            if (c[i - 2] == 'A' && c[i - 1] == 'C') {
                frag[i]++;
            }
            rui[i] = rui[i - 1] + frag[i];
        }
        for (int i = 0; i < q; i++) {
            int left = range[i][0];
            int right = range[i][1];
            System.out.println(rui[right] - rui[left]);
        }
    }
}
assistant: def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i - 1] = t[i - 1], t[i]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True


def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == n:
        return 1
    ret = 0
    for c in "ACGT":
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % mod
    memo[cur][last3] = ret
    return ret


n = int(input())
mod = 10 ** 9 + 7
memo = [{} for i in range(n + 1)]
print(dfs(0, 'TTT'))


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

public class atcoder_ABC122_D {
    int N;
    long MOD = 1000000007L;
    String[] TOKENS = {"A", "C", "G", "T"};
    Map<String, Long>[] memo;

    atcoder_ABC122_D() {
        Scanner in = new Scanner(System.in);
        N = in.nextInt();
        in.close();
        this.memo = new Map[N + 1];
        for (int i = 0; i < this.memo.length; ++i) {
            this.memo[i] = new HashMap<String, Long>();
        }
    }

    long calc() {
        return dfs(0, "TTT");
    }

    boolean isOK(String last4) {
        if (last4.contains("AGC")) {
            return false;
        }
        for (int i = 0; i < 3; ++i) {
            char[] vals = last4.toCharArray();
            vals[i] = last4.charAt(i + 1);
            vals[i + 1] = last4.charAt(i);
            String s = new String(vals);
            if (s.contains("AGC")) {
                return false;
            }
        }
        return true;
    }

    long dfs(int current, String last3) {
        if (this.memo[current].containsKey(last3)) {
            return (Long) (this.memo[current].get(last3));
        }
        if (current == N) {
            return 1;
        }
        long result = 0;
        for (String c : TOKENS) {
            if (isOK(last3 + c)) {
                result = (result + dfs(current + 1, last3.substring(1, last3.length()) + c)) % MOD;
            }
        }
        memo[current].put(last3, result);
        return result;
    }

    public static void main(String[] args) {
        atcoder_ABC122_D ins = new atcoder_ABC122_D();
        System.out.println(ins.calc());
    }
}
assistant: import math
menu = []
for _ in range(5):
    m = input()
    e = int(m[- 1])
    if e == 0:
        e = 10
    menu.append([int(m), e])
menu.sort(key=lambda x: x[1])
ans = 0
for m in menu[1:]:
    ans += math.ceil(m[0] / 10) * 10
print(ans + menu[0][0])


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

public class atcoder_ABC123_B {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
        int r[] = new int[5];
        TreeMap<Integer, Integer> map = new TreeMap();
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
            r[i] = a[i] % 10;
            int b = 10;
            if (r[i] != 0) {
                b = 10 - r[i];
                map.put(b, a[i]);
            }
        }
        int ans = 0;
        if (map.size() == 0) {
            for (int i = 0; i < a.length; i++) {
                ans += a[i];
            }
            System.out.println(ans);
            return;
        }
        int last = map.get(map.lastKey());
        int idx = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] == last) {
                idx = i;
            }
        }
        for (int i = 0; i < a.length; i++) {
            if (i != idx) {
                if (a[i] % 10 == 0) {
                    ans += a[i];
                } else {
                    ans += a[i] + (10 - r[i]);
                }
            }
        }
        ans += last;
        System.out.println(ans);
    }
}
assistant: import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
N = int(input())
A = [int(input()) for i in range(5)]
print(math.ceil(N / min(A)) + 4)


user: import java.util.Scanner;

public class atcoder_ABC123_C {
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long N = sc.nextLong();
        long min = 0;
        for (int i = 0; i < 5; i++) {
            if (i == 0) min = sc.nextLong();
            else min = Math.min(min, sc.nextLong());
        }
        p((long) Math.ceil((double) N / min) + 4);
    }

    static void p(String ans) {
        System.out.println(ans);
    }
    ;

    static void p(int ans) {
        System.out.println(ans);
    }
    ;

    static void p() {
        System.out.println();
    }
    ;

    static void p(long ans) {
        System.out.println(ans);
    }
    ;

    static void p(double ans) {
        System.out.println(ans);
    }
    ;
}
assistant: x, y, z, k = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
c = [int(_) for _ in input().split()]
ab = []
for i in range(x):
    for j in range(y):
        ab.append(a[i] + b[j])
ab.sort(reverse=True)
abc = []
for i in range(min(k, x * y)):
    for j in range(z):
        abc.append(ab[i] + c[j])
abc.sort(reverse=True)
for i in range(k):
    print(abc[i])


user: import java.util.*;

public class atcoder_ABC123_D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x[] = new int[3];
        int max = 0;
        for (int i = 0; i < 3; ++i) {
            x[i] = sc.nextInt();
            max = Math.max(max, x[i]);
        }
        int k = sc.nextInt();
        List<Long> a[] = new List[3];
        for (int i = 0; i < 3; ++i) a[i] = new ArrayList<Long>();
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < x[i]; ++j) a[i].add(sc.nextLong());
            Collections.sort(a[i]);
        }
        sc.close();
        List<Long> ans = new ArrayList<Long>();
        for (int i = 0; i < x[0]; ++i) {
            for (int j = 0; j < x[1]; ++j) {
                for (int m = 0; m < x[2]; ++m) {
                    if ((i + 1) * (j + 1) * (m + 1) <= k) {
                        long tmp =
                                a[0].get(x[0] - i - 1)
                                        + a[1].get(x[1] - j - 1)
                                        + a[2].get(x[2] - m - 1);
                        ans.add(tmp);
                    }
                }
            }
        }
        Collections.sort(ans);
        int n = ans.size();
        for (int i = 0; i < k; ++i) System.out.println(ans.get(n - i - 1));
    }
}
assistant: a, b = map(int, input().split())
c = 0
for i in range(2):
    c += max(a, b)
    if a >= b:
        a -= 1
    else:
        b -= 1
print(c)


user: import java.util.Scanner;

public class atcoder_ABC124_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        ;
        int sum = 0;
        for (int i = 0; i < 2; i++) {
            if (a >= b) {
                sum += a;
                a = a - 1;
            } else {
                sum += b;
                b = b - 1;
            }
        }
        System.out.println(sum);
    }
}
assistant: import collections
s = list(input())
even = collections.Counter(s[0:: 2])
odd = collections.Counter(s[1:: 2])
print(min(len(s) - (even["0"] + odd["1"]), len(s) - (even["1"] + odd["0"])))


user: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class atcoder_ABC124_C {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String x = in.next();
            StringBuilder a = new StringBuilder(x);
            StringBuilder b = new StringBuilder(x);
            int a1 = 0;
            int a2 = 0;
            for (int i = 1; i < x.length(); i++) {
                if (a.charAt(i) == a.charAt(i - 1)) {
                    if (a.charAt(i) == '1') a.setCharAt(i, '0');
                    else a.setCharAt(i, '1');
                    a1++;
                }
            }
            for (int i = x.length() - 1; i > 0; i--) {
                if (b.charAt(i) == b.charAt(i - 1)) {
                    if (b.charAt(i - 1) == '1') b.setCharAt(i - 1, '0');
                    else b.setCharAt(i - 1, '1');
                    a2++;
                }
            }
            out.println(Math.min(a1, a2));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}
assistant: a, b, t = map(int, input().split())
cookie = 0
time = a
while time <= t + 0.5:
    cookie += b
    time += a
print(cookie)


user: import java.util.*;

public class atcoder_ABC125_A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sec = sc.nextInt();
        int per_num = sc.nextInt();
        double max_sec = (double) sc.nextInt() + 0.5;
        int ans_num = 0;
        for (int i = sec; i < max_sec; i += sec) {
            ans_num += per_num;
        }
        System.out.println(ans_num);
    }
}