akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    int n;
    cin>>n;
    int a[n];
    set<int,greater<int> >s;
    map<int,int>m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        s.insert(a[i]);
    }
    for(int i=0;i<n;i++)
    {
        if(m[a[i]]==1)
        {
            s.erase(a[i]);
             set<int,greater<int> >::iterator it;
             it=s.begin();
            cout<<*it<<endl;
            s.insert(a[i]);
        }
        else
        {
             set<int,greater<int> >::iterator it;
             it=s.begin();
             cout<<*it<<endl;
        }


    }



}

























































Measured memory_bytes: 15328
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Integer> map = new TreeMap<>();
        String s = sc.next();
        for(int i = 0; i < s.length(); i++){
            String b = s.substring(i, i+1);
            if(map.containsKey(b)) map.put(b, map.get(b)+1);
            else map.put(b, 1);
        }
        for (int i = 1; i < n; i++) {
            Map<String, Integer> tmp = new TreeMap<>();
            s = sc.next();
            for(int j = 0; j < s.length(); j++){
                String b = s.substring(j, j+1);
                if(tmp.containsKey(b)) tmp.put(b, tmp.get(b)+1);
                else tmp.put(b, 1);
            }
            for (String k : map.keySet()) {
                if(tmp.containsKey(k)) map.put(k, Math.min(map.get(k), tmp.get(k)));
                else map.put(k, 0);
            }
        }
        StringBuilder sb = new StringBuilder();
        for (String k : map.keySet()) {
            for (int i = 1; i <= map.get(k); i++) {
                sb.append(k);
            }
        }

        System.out.println(sb.toString());
        sc.close();
    }

}


Measured memory_bytes: 22100
import sys
sys.setrecursionlimit(100000)
n=int(input())
m=len(str(n))
L=[]
def dfs(i,num):
    if i==m+1:
        return
    if 0<i<m+1:
        if len(set(num))==3 and int(num)<=n:
            L.append(int(num))
    dfs(i+1,num+'3')
    dfs(i+1,num+'5')
    dfs(i+1,num+'7')
dfs(0,'')
print(len(L))

Measured memory_bytes: 4072
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> x(N);
    for (int i=0;i<N;i++) cin >> x[i];
    int ans = INF;
    for (int i=0;i<N-K+1;i++){
        int p = x[i+K-1] - x[i] + abs(x[i+K-1]);
        int q = x[i+K-1] - x[i] + abs(x[i]);
        int r = min(p,q);
        ans = min(ans, r);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    if (s.size() % 2) {
        cout << "No\n";
        return 0;
    }
    for (int i = 0; i < s.size(); i += 2) {
        if (s[i] != 'h' || s[i + 1] != 'i') {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import stdin


N,A,B = [int(x) for x in stdin.readline().rstrip().split()]

total_train = N * A
total_tac = B

if total_train <= total_tac:
    print(total_train)
else:
    print(total_tac)

Measured memory_bytes: 2940
#include <bits/stdc++.h>

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli n,m;
vll a,b,c;
vll dist;

int main(){
  cin >> n >> m;
  a = b = c = vll(m);
  dist = vll(n+1,-LONG_MAX);
  dist[1] = 0;
  for(lli i = 0;i < m;i++){
      cin >> a[i] >> b[i] >> c[i];
  }
  for(lli i = 0;i < n;i++){
    for(lli j = 0;j < m;j++){
      if(dist[a[j]] != -LONG_MAX) dist[b[j]] = max(dist[b[j]],dist[a[j]]+c[j]);
    }
  }
  lli ans = dist[n];
  for(lli j = 0;j < m;j++){
    if(dist[a[j]] != -LONG_MAX) dist[b[j]] = max(dist[b[j]],dist[a[j]]+c[j]);
  }
  if(ans != dist[n]) cout << "inf" << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def resolve():
    N, X, Y = map(int, input().split())
    X, Y = X-1, Y-1
    S = [0]*(N-1)
    for i in range(N):
        for j in range(i+1, N):
            if i <= X and Y <= j:
                diff = X-i+j-Y+1
            elif i > X and j >= Y:
                diff = min(j-i, i-X+j-Y+1)
            elif i <= X and j < Y:
                diff = min(j-i, X-i+Y-j+1)
            else:
                diff = min(j-i, i-X+Y-j+1)
            S[diff-1] += 1

    for dc in S:
        print(dc)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 3444
#include <iostream>
using namespace std;

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  
  if(A >= B && A >= C){
    cout << 10 * A + B + C << endl;
  }
  else if(B > A && B >= C)cout << 10 * B + C + A << endl;
  else cout  << 10 * C + A + B << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc118/tasks/abc118_c

// http://ctylim.hatenablog.com/entry/2015/08/30/191553
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cstdio>

#define ALL(a) (a).begin(), (a).end()
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define MAXINDEX(c) distance((c).begin(), max_element((c).begin(), (c).end()))
#define MININDEX(c) distance((c).begin(), min_element((c).begin(), (c).end()))
#define DEBUG(x) std::cerr << #x << " = " << (x) << " (" << __FILE__ << "::" << __LINE__ << ")" << std::endl;
#define ERROR(s) std::cerr << "Error::" << __FILE__ << "::" << __LINE__ << "::" << __FUNCTION__ << "::" << (s) << std::endl;
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)

#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

template <typename T>
T inputValue()
{
  T a;
  std::cin >> a;
  // scanf("%d", &a);
  return a;
}

void inputArray(int *p, int a)
{
  rep(i, a)
  {
    std::cin >> p[i];
    // scanf("%d",p+i);
  }
}

template <typename T>
void inputVector(std::vector<T> *p, int a)
{
  rep(i, a)
  {
    T input;
    std::cin >> input;
    // scanf("%d", &input);
    p->push_back(input);
  }
}

template <typename T>
void output(T a, int precision)
{
  if (precision > 0)
  {
    std::cout << std::setprecision(precision) << a << "\n";
  }
  else
  {
    std::cout << a << "\n";
  }
}

using namespace std;

int gcd(int a, int b)
{
  while (1)
  {
    if (a < b)
      swap(a, b);
    if (!b)
      break;
    a %= b;
  }
  return a;
}

typedef unsigned long long int ulli;
int main(int argc, char **argv)
{

  ulli N = inputValue<ulli>();
  ulli K = inputValue<ulli>();
  vector<ulli> v;
  inputVector<ulli>(&v, N);

  // cout << N << "," << K <<  endl;
  // cout<< "----"<<endl;
  // EACH(k, v) cout<<*k<<",";
  // cout<<endl;

  vector<int> bitSum(64,0);

  EACH(k, v)
  {
    ulli t = *k;
    for(int i=0; i<64&&t!=0; i++){
      bitSum[i] = bitSum[i] + (t&1) ;
      t = t >> 1;
    }
  }

  ulli d = 0;

  int flag = 0;
  for (int i = 63; i >= 0; i--)
  {

    ulli K_bit = (K >> i) & 1ll;
    ulli A_bit = (bitSum[i] > N / 2 ? 0 : 1);
    ulli D_bit;
    if (!flag)
    {
      D_bit = K_bit && A_bit;
      flag = K_bit && (!A_bit);
    } else {
      D_bit = A_bit;
    }
    // cout << K_bit << "," << A_bit << "," << D_bit << ":"<< i<<endl;
    d = (d << 1) | (D_bit);
  }
  // cout<<"d," <<d<< endl;

  ulli sum = 0;
  EACH(k, v)
  {
    sum = sum + (*k^d);
  }
  cout << sum << endl;
  return 0;
}

//

Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

int main(){
  int n;
  cin >> n;
  int p[n];
  rep(i,n){
    cin >> p[i];
    p[i]--;
  }
  int ans=0;
  rep(i,n){
    if(p[i]==i){
      if(i+1<n && p[i+1]==i+1){
        i++;
      }
      ans++;
    }
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define int long long
#define INF 1145141919810364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
string s;

signed main() {
	cin >> n;
	cout << 0 << endl;
	cin >> s;
	int mi = 0, ma = n;
	int x = 0;
	if (s == "Vacant")return 0;
	if (s == "Male") x = 1;
	else x = 2;
	while (1) {
		int md = (mi + ma) / 2;
		cout << md << endl;
		cin >> s;
		if (s == "Vacant")return 0;
		if (s == "Male") {
			if (x == 1) {
				if ((md - mi) % 2)ma = md;
				else {
					mi = md;
					x = 1;
				}
			}
			else {
				if ((md - mi) % 2) {
					mi = md;
					x = 1;
				}
				else ma = md;
			}
		}
		else {
			if (x == 1) {
				if ((md - mi) % 2) {
					mi = md;
					x = 2;
				}
				else ma = md;
			}
			else {
				if ((md - mi) % 2)ma = md;
				else {
					mi = md;
					x = 2;
				}
			}
		}
	}
}

Measured memory_bytes: 852
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define int long long
#ifdef ONLINE_JUDGE
const int maxn = 3e5 + 10;
#else
const int maxn = 1e3 + 10;
#endif
using namespace std;

signed main()
{
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int ans = (N / K) * (N / K) * (N / K);
    if (~K & 1) {
        int tmp = (N + K / 2) / K;
        ans += tmp * tmp * tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() { 
    string s;cin  >>s ;
    int count = 0;
    int ma = -1;
    rep(i, s.size()) {
        if(s[i]=='R') count++;
        else {
            chmax(ma,count);
            count=0;
        }
    }
    chmax(ma,count);
    if(ma==-1) cout  << count << endl;
    else cout << ma << endl;
    return 0;
}

Measured memory_bytes: 3628
n,wmax = map(int,input().split())
dp = [[0 for ww in range(wmax+1)] for i in range(n+1)]

w,v = [],[]
for i in range(n):
    ww,vv = map(int,input().split())
    w.append(ww)
    v.append(vv)

for i in range(n):
    for ww in range(wmax+1):
        dp[i+1][ww] = dp[i][ww] if w[i]>ww else max(dp[i][ww], dp[i][ww-w[i]]+v[i])

ans = dp[n][wmax]
print(ans)


Measured memory_bytes: 171144
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int n;
  set<int> s;

  cin >> n;
  rep(i, n) {
    int v;
    cin >> v;
    s.insert(v);
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    template <bool nl>
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { final(); }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
        template <bool f = nl>
        auto final() -> std::enable_if_t<f> { cout << '\n'; }
        template <bool f = nl>
        auto final() -> std::enable_if_t<!f> {}
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy<true> operator,(T&& val)
    {
        cout << val;
        return {};
    }
    proxy<false> noreturn() { return {}; }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
    }
};

void prog()
{
    input in;
    output out;
    int a, b;
    in >> a, b;
    out, a <= 5 ? 0 : (a <= 12 ? b / 2 : b);
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  long double inv_total = 0;
  for (int i = 0; i < N; ++i) {
    long double ai;
    cin >> ai;
    inv_total += 1 / ai;
  }
  long double result = 1 / inv_total;
  cout << result << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class ABC153D
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var H = NN;
            var memo = new Dictionary<long, long>();
            Func<long, long> fun = null;
            fun = x =>
            {
                if (x < 1) return 0;
                if (x == 1) return 1;
                if (memo.ContainsKey(x)) return memo[x];
                return memo[x] = 1 + fun(x / 2) + fun(x / 2);
            };
            Console.WriteLine(fun(H));
        }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
}


Measured memory_bytes: 14944
#include <bits/stdc++.h>
using namespace std;
#define MAX 55556

bool sieve[MAX];
vector<int> primes;

void init_sieve()
{
	memset(sieve, 1, MAX);
	sieve[1] = false;
	
	for(int i = 2; i * i < MAX; i++)
	{
		if (sieve[i])
		{
			for (int j = i * i; j <= MAX; j += i)
			{
				sieve[j] = false;
			}
		}
	}
}

void print(int a, int b)
{
	for (int i = a; i < b; i++)
	{
		cout << primes[i] << " ";
	}
	cout << endl;
}


int main()
{
	int n;
	cin >> n;

	init_sieve();
	
	for (int i = 2; i < MAX; i++)
	{
		if (i % 10 == 1 && sieve[i])
		{
			cout << i << " ";
			n--;
		}
		
		if (n == 0) break;
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
let rec printList lst =
    match lst with
    | [] -> printf "\n"
    | [x] -> printf "%d" x
    | x :: tail ->
         printf "%d " x
         printList tail

let [|k; x|] = stdin.ReadLine().Split(' ') |> Array.map int
seq { (max (x - (k - 1)) -1000000)..(min (x + (k - 1)) 1000000) }
|> Seq.toList
|> printList


Measured memory_bytes: 11996
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79896
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	int arr[n];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	vector<int> dp(n,INT_MAX);
	dp[0] = 0;
	dp[1] = abs(arr[1]-arr[0]);
	// cout << dp[1] << endl;
	for(int i=2;i<n;i++){
		dp[i] = min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]));
		// cout << dp[i] << " ";
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    ans = k
    for i,v in enumerate([a,b,c,d,e]):
        for j,x in enumerate([a,b,c,d,e],i+1):
            if(abs(v-x)):
                ans = max(ans,abs(v-x))

    if(ans > k):
        print(':(')
    else:
        print('Yay!')
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    d = int(next(tokens))  # type: int
    e = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(a, b, c, d, e, k)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) (m*n)/GCD(m,n)
# define mod 1000000007

ll arr[100001];
int main()
{
   ll i,j,k,n,m,t,cnt=0,flag=0,prod=1;
   memset(arr,0,sizeof(arr));
   cin >> n >> k;
   if(n==1)
      cout << 0;
   ll a[n];
   for(i=0;i<n;i++)
    cin >> a[i];
   if(n==2)
   {
       cout << abs(a[0]-a[1]);
       return 0;
   }
    arr[0]=0;
    arr[1]=abs(a[0]-a[1]);
    for(i=1;i<k;i++)
    {
        ll ans=INT_MAX;
        for(j=0;j<i;j++)
        {
            ans=min(ans,arr[j]+abs(a[i]-a[j]));
        }
        arr[i]=ans;
    }

    for(i=k;i<n;i++)
    {
        ll ans = INT_MAX;
        for(j=i-k;j<i;j++)
            {
                ans=min(ans,arr[j]+abs(a[j]-a[i]));
            }
            arr[i]=ans;
    }
    cout << arr[n-1];
}


Measured memory_bytes: 5172
def ABC172_B():
    s = input()
    t = input()

    counter=0
    for i in range(len(s)):
        if s[i] != t[i]:
            counter += 1
    if counter == len(s):
        print(counter)
    else:
        print(counter)

    '''
ababcvcvv
ababababf
    '''

ABC172_B()


Measured memory_bytes: 9496
#include <iostream>

using namespace std;

int main()
{
    string x ;
    cin >> x ;
    int maxi = 0;
    for(int i = 0 ; i < x.length() ;i++){
        int ans = 0 ;
        while(x[i] == 'R'){
            ans++;
            i++;
        }
        if(ans > maxi)
            maxi = ans ;
    }
    cout << maxi << endl;
    return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(void){
    ll n;
    double ans = 0;
    cin >> n;

    rep(i, n){
        double tmp;
        string u;
        cin >> tmp >> u;

        if(u == "JPY")
            ans += tmp;
        if(u == "BTC")
            ans += tmp * 380000;
    }

    printf("%.10lf", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    string s, t; cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(), greater<char>());
    if(s<t) cout << "Yes" << endl;
    else cout << "No" << endl;    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,y;
	cin>>n>>y;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n-i;j++)
		{
			if(i*10000+j*5000+(n-i-j)*1000==y)
			{
				cout<<i<<" "<<j<<" "<<n-i-j<<endl;
				return 0;
			}
		}
	} 
	cout<<"-1 -1 -1"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int visit(int node, vector<vector<int>>& G, vector<int>& TSorted, vector<int>& flag){
    if (flag[node] == 1)
        return -1;
    else if (flag[node] == 0){
        flag[node] = 1;
        for (size_t i=0; i<G[node].size(); i++){
            if (-1 == visit(G[node][i], G, TSorted, flag))
                return -1;
        }
        flag[node] = 2;
        TSorted.push_back(node);
    }
    return 0;
}

int main(int argc, char** argv){
    int N;
    cin >> N;
    int M = N*(N-1)/2;
    vector<vector<int>> G(M, vector<int>());
    //vector<bool> startable(M, true);
    for (int k=0; k<N; k++){
        int prev;
        cin >> prev;
        prev--;
        int i = min(k, prev);
        int j = max(k, prev);
        prev = (i*N - i*(i+1)/2) + (j-i-1); // Index + Offset
        for (int l=1; l<N-1; l++){
            int next;
            cin >> next;
            next--;
            i = min(k, next);
            j = max(k, next);
            next = (i*N - i*(i+1)/2) + (j-i-1);
            G[prev].push_back(next);
            //startable[next] = false;
            prev = next;
        }
    }

    vector<int> TSorted(0);
    vector<int> flag(M, 0);
    for (int i=0; i<M; i++)
        if (flag[i] == 0)
            if (-1 == visit(i, G, TSorted, flag)){
                cout << "-1\n";
                return 0;
            }
    reverse(TSorted.begin(), TSorted.end());
    //for (auto x : TSorted) cerr << x << " ";
    //cerr << "\n";

    vector<unsigned int> longest(M, 0);
    for (int i=0; i<M; i++){
        int node = TSorted[i];
        for (size_t j=0; j<G[node].size(); j++)
            longest[G[node][j]] = max(longest[G[node][j]], longest[node] + 1);
    }

    unsigned int ans = 0;
    for (int i=0; i<M; i++)
        if (longest[i] > ans)
            ans = longest[i];

    cout << ans + 1 << "\n";

    return 0;
}


Measured memory_bytes: 33652
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

class Solver
{
private:
	string str;

public:
	Solver() {
		cin >> str;
	}

	void exec() {
		for (int i = 0; i < str.size() - 1; ++i)
		{
			if(str[i] == 'A' && str[i+1] == 'C') {
				cout << "Yes" << endl;
				return;
			}
		}
		cout << "No" << endl;
	}
	
};

int main() {
	Solver ce = Solver();
	ce.exec();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        int[][] dp = new int[s.length() + 1][t.length() + 1];

        for (int i = 0; i < s.length(); i++) {
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i) == t.charAt(j)) {
                    dp[i + 1][j + 1] = Math.max(dp[i][j] + 1, dp[i + 1][j]);
                    dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i][j + 1]);
                } else {
                    dp[i + 1][j + 1] = Math.max(dp[i][j + 1], dp[i + 1][j]);
                }
            }
        }

        StringBuilder sb = new StringBuilder();
        int i = s.length(), j = t.length();
        while (i > 0 && j > 0) {
            if (dp[i][j] == dp[i - 1][j]) {
                i--;
            } else if (dp[i][j] == dp[i][j - 1]) {
                j--;
            } else {
                sb.append(s.charAt(i - 1));
                i--;
                j--;
            }

        }

        System.out.println(sb.reverse().toString());
    }
}


Measured memory_bytes: 80972
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    int n,l;
    cin >> n >> l;
    vector<string> vec;
    rep(i,n) {
        string tmp;
        cin >> tmp;
        vec.push_back(tmp);
    }
    sort(all(vec));
    string ans;
    rep(i,n) {
        ans += vec[i];
    }
    cout << ans << endl;

    
}

Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

#define endl "\n"

void solve() {
    cins(s);
    cins(t);

    int ans=1e9;
    for(int i=0; i+t.size()<=s.size(); i++) {
        int lans=0;
        for(size_t j=0; j<t.size(); j++) {
            if(t[j]!=s[i+j])
                lans++;
        }
        ans=min(ans, lans);
    }
    cout<<ans<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3656
#include <iostream>
#include <string>

using namespace std;

int main(){
  string S;
  cin >> S;
  int c0 = 0, c1 = 0;
  for (int i=0; i<S.size(); i++){
    if (S[i] == '0') c0++;
    else c1++;
  }
  
  cout << (c0 < c1 ? c0 * 2 : c1 * 2) << endl;
  return 0;
  
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void){
	int N,M,C;
	scanf("%d%d%d",&N,&M,&C);
	int B[M];
	int a,b;
	for(a=0;a<M;a++){
		scanf("%d",&B[a]);
	}
	int A[M];
	int correct=0;
	int sum=0;
	for(a=0;a<N;a++){
		for(b=0;b<M;b++){
			scanf("%d",&A[b]);
			sum+=A[b]*B[b];
		}
		sum+=C;
		if(sum>0){
			correct++;
		}
		sum=0;
	}
	printf("%d",correct);
	return 0;
}

Measured memory_bytes: 128
import sys

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

gap = [abs(a-e),abs(b-e),abs(c-e),abs(d-e)]

for i in range(len(gap)):
	if gap[i] > k:
		print(':(')
		sys.exit()
print('Yay!')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

int main(){
  ll a,b,c;
  cin >> a >> b >>c;
  if(a%2LL!=0 || b%2LL!=0 || c%2LL!=0){
    cout << 0 << endl;
    return 0;
  }
  if(a==b && b==c){
    cout << -1 << endl;
    return 0;
  }
  ll ans=0;
  while(a%2==0 && b%2==0 && c%2==0){
    ll ta=(b+c)/2LL;
    ll tb=(a+c)/2LL;
    ll tc=(a+b)/2LL;
    a=ta;b=tb;c=tc;
    //    cout << a << " " << b << " " << c << endl;
    ans++;
  }
  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

#      0  1  2  3  evn odd
# kevn +  -  +  -   +   -
# kodd -  +  -  +   -   +

a0=a[0]
if a0<0:
    kevn=1-a0
    sevn=1
elif a0==0:
    kevn=1
    sevn=1
elif a0>0:
    kevn=0
    sevn=a0

for i in range(1,n):
    ai=a[i]
    if i%2==0:
        if sevn+ai<0:
            kevn=kevn+1-(ai+sevn)
            sevn=1
        elif sevn+ai==0:
            kevn=kevn+1
            sevn=1
        elif sevn+ai>0:
            kevn=kevn
            sevn=sevn+ai
    elif i%2==1:
        if sevn+ai<0:
            kevn=kevn
            sevn=sevn+ai
        elif sevn+ai==0:
            kevn=kevn+1
            sevn=-1
        elif sevn+ai>0:
            kevn=kevn+1+(ai+sevn)
            sevn=-1
kevn1=kevn
            
a0=-a[0]
if a0<0:
    kevn=1-a0
    sevn=1
elif a0==0:
    kevn=1
    sevn=1
elif a0>0:
    kevn=0
    sevn=a0

for i in range(1,n):
    ai=-a[i]
    if i%2==0:
        if sevn+ai<0:
            kevn=kevn+1-(ai+sevn)
            sevn=1
        elif sevn+ai==0:
            kevn=kevn+1
            sevn=1
        elif sevn+ai>0:
            kevn=kevn
            sevn=sevn+ai
    elif i%2==1:
        if sevn+ai<0:
            kevn=kevn
            sevn=sevn+ai
        elif sevn+ai==0:
            kevn=kevn+1
            sevn=-1
        elif sevn+ai>0:
            kevn=kevn+1+(ai+sevn)
            sevn=-1
            
kevn=min(kevn,kevn1)

print(kevn)
            

Measured memory_bytes: 14332
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N, Ma, Mb;  cin >> N >> Ma >> Mb;
    int maxA = 0, maxB = 0;
    vector<int> a(N+1), b(N+1), c(N+1);
    for(int i=1; i<=N; i++){
        cin >> a[i] >> b[i] >> c[i];
        maxA += a[i];
        maxB += b[i];
    }

    int inf = 1e9;
    vector<vector<vector<int>>> dp;
    dp = vector<vector<vector<int>>>(N+1, vector<vector<int>>(maxA+1, vector<int>(maxB+1, inf)));
    dp[0][0][0] = 0;
    for(int i=0; i<N; i++){
        for(int ia=0; ia<=maxA; ia++){
            for(int ib=0; ib<=maxB; ib++){
                if(ia < a[i+1] || ib < b[i+1]) dp[i+1][ia][ib] = dp[i][ia][ib];
                else dp[i+1][ia][ib] = min(dp[i][ia][ib], dp[i][ia - a[i+1]][ib - b[i+1]] + c[i+1]);
            }
        }
    }

    int ans = inf;
    for(int ia=1; ia<=maxA; ia++){
        for(int ib=1; ib<=maxB; ib++){
            if(ia*Mb == ib*Ma){
                ans = min(ans, dp[N][ia][ib]);
            }
        }
    }
    if(ans == inf) ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 9984
#include <iostream>
#include <algorithm>
#include <string>
#include  <queue>
#include <vector>
#include  <cstdio>
#include <cstring>
#include<map>
#include<cmath>
#include<set>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T mul(T p, T e, T M)
{
    ll ret = 0;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret + p) ;
        p = (p + p) ;
        if(ret>=M)ret-=M;
        if(p>=M)p-=M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 

#define  mx 200004
#define base 193ll
 
typedef pair<int,int >P;
//////////////////////////
////////////////////////
#define F(i,a,b) for(int i=a;i<b; i++)
#define LL long long
#define MX  200007
#define md 998244353ll
///////////////////////////
///////////////////////////
char ar[ MX +2], br [MX+2];
int main(){

    string s;
    cin>>s;
    if(s[0] != 'A'){
        PC("WA");
    }
    else {
        bool fl =0;
        int cnt = 0;
        for(int i = 1; i < s.size(); i++){
            if(s[i] >= 'A' && s[i] <= 'Z'){
                if(s[i] == 'C' && i >= 2 && i < s.size() - 1){

                    cnt++;
                }
                else fl = 1;
            }
    
        }
        if(fl || cnt != 1)PC("WA");
        else PC("AC");
    }
    NL;
    return 0;
}

Measured memory_bytes: 3692
def main():
    import bisect

    N = int(input())
    upper = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    lower = list(map(int, input().split()))

    upper.sort()
    middle.sort()
    lower.sort()

    cnt = 0

    for i in range(N):
        mid = middle[i]
        index_up = bisect.bisect_left(upper, mid)
        index_low = bisect.bisect_right(lower, mid)
        
        cnt += index_up * (N - index_low)
    
    print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 29488
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define rlp(i,a,b) for(int i=a;i>b;i--)
#define ft first
#define sd second
#define pii pair<int,int>
#define all(vect) vect.begin(),vect.end()
#define rall(vect) vect.rbegin(),rend() 
const int num = 200001;
typedef long long ll;
ll x[num],y[num];
int main()
{
	ll n,d;
	cin >> n >> d;
	rep(i,0,n)
		cin >> x[i] >> y[i];	
	ll val = d*d;
	int cnt = 0;
	rep(i,0,n)
	{
		ll cur = x[i]*x[i]+y[i]*y[i];
		if(cur<=val)
			cnt++;
	}
	cout << cnt << "\n";


	return 0;
}

Measured memory_bytes: 6648
# abc075_b.py
'''
こういうのきれいに速く実装できるようになりたい…
'''
def search_mine(i,j,glid):
    cnt = 0
    if glid[i][j] == "#":
        return "#"
    if glid[i-1][j-1] == "#":
        cnt += 1
    if glid[i-1][j] == "#":
        cnt += 1
    if glid[i-1][j+1] == "#":
        cnt += 1
    if glid[i][j-1] == "#":
        cnt += 1
    if glid[i][j] == "#":
        cnt += 1
    if glid[i][j+1] == "#":
        cnt += 1
    if glid[i+1][j-1] == "#":
        cnt += 1
    if glid[i+1][j] == "#":
        cnt += 1
    if glid[i+1][j+1] == "#":
        cnt += 1
    return cnt


H,W = map(int,input().split())
glid =[]
glid.append(list("."*(W+2)))
for i in range(H):
    glid.append(list("." + input() + "."))
glid.append(list("."*(W+2)))



for i in range(1,H+1):
    for j in range(1,W+1):
        glid[i][j] = search_mine(i,j,glid)
for i,v in enumerate(glid):
    if i == 0 or i == H+1:
        continue
    ans = ""
    for j,c in enumerate(v):
        if j == 0 or j == W+1:
            continue
        ans += str(c)
    print(ans)





Measured memory_bytes: 3064
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

bool check_natural(int num) {
  if (num <= 1) {
    return false;
  }

  if (num == 2) {
    return true;
  }

  if (num % 2 == 0) {
    return false;
  }

  int i = 3;
  while (i < sqrt(num) + 1) {
    if (num % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}

int main() {

  // input
  int n;
  cin >> n;

  std::vector<int> nums;
  for (size_t i = 0; i < n; i++) {
    int num;
    cin >> num;
    nums.push_back(num);
  }

  int natural_count = 0;
  for (int num : nums) {
    if (check_natural(num)) {
      natural_count++;
    }
  }

  std::cout << natural_count << '\n';

  return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, A, B, P, a, b, c;

int main() {
	cin >> N >> A >> B;
	for (int i = 0; i != N; ++i) {
		cin >> P;
		if (P <= A)++a;
		else if (B + 1 <= P)++c;
		else ++b;
	}
	cout << min({ a,b,c }) << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

const int INF = 1000000000;
const double PI = 3.1415926535897932384626433832795;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

using LL = long long int;
using LD = long double;
using pii = pair<int, int>;
using pdd = pair<double, double>;
using pll = pair<LL, LL>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<LL>;

//==============================================
int n, tt = 0;
vvi M;
vi D, F, searchStatus;

// ??±???????????¢?´¢
void antDfs(int u) {
	searchStatus[u] = 0;
	D[u] = ++tt;
	REP3(i, 1, n) {
		if (M[u][i] == 0) continue;

		if (searchStatus[i] == -1) {
			antDfs(i);
		}
	}
	F[u] = ++tt;
	searchStatus[u] = 1;
}

void print() {
	REP3(i, 1, n) {
		cout << i << " " << D[i] << " " << F[i] << "\n";
	}
}

void solve() {
	// ?????¢?´¢??¶???????¨????
	//REP3(i, 1, n) searchStatus[i] = -1;

	REP3(i, 1, n) {
		if (searchStatus[i] == -1) {
			antDfs(i);
		}
	}

	// ??????
	print();
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n;
	
	M.resize(n + 1, vi(n + 1));
	D.resize(n + 1);
	F.resize(n + 1);
	searchStatus.resize(n + 1, -1);

	
	int u, k, v;
	REP3(i, 1, n) {
		cin >> u >> k;
		REP3(j, 1, k) {
			cin >> v;
			M[u][v] = 1;
		}
	}

	solve();
	return 0;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid (l+r)/2
const int mod=1e9,inf=1e9+7,maxn=1e5+5;
int n,m,Q,K,S;

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    return x*f;
}



signed main(){
//  freopen("a.in","r",stdin);
//  freopen("a.out","w",stdout);
    n=read();K=read();S=read();
    for(int i=1;i<=K;++i)cout<<S<<" ";
    if(S<mod){for(int i=K+1;i<=n;++i)cout<<mod<<" ";}
    else for(int i=K+1;i<=n;++i)cout<<1<<" ";


    return 0;
}

Measured memory_bytes: 1280
fun main(args: Array<String>) = yorukatsu21d()

fun yorukatsu21d() {
    val (n, m, k) = readLine()!!.split(' ').map { it.toInt() }
    val abList = Array(m) {
        readLine()!!.split(' ').map { it.toInt() - 1 }.let { it[0] to it[1] }
    }
    val cdList = Array(k) {
        readLine()!!.split(' ').map { it.toInt() - 1 }.let { it[0] to it[1] }
    }

    val unionFind = UnionFind(n)
    val count = IntArray(n)

    abList.forEach {
        val (a, b) = it
        unionFind.unite(a, b)
        count[a]--
        count[b]--
    }

    cdList.forEach {
        val (c, d) = it
        if (unionFind.isSame(c, d)) {
            count[c]--
            count[d]--
        }
    }

    val answer = count.mapIndexed { index, l -> unionFind.size(index) + l - 1 }
        .joinToString(" ")

    println(answer)
}

private class UnionFind(initSize: Int) {
    private val parent = IntArray(initSize) { it }
    private val size = LongArray(initSize) { 1L }

    fun root(x: Int): Int {
        if (x == parent[x]) return x

        val xr = root(parent[x])
        parent[x] = xr
        return xr
    }

    fun unite(x: Int, y: Int) {
        val xr = root(x)
        val yr = root(y)
        if (xr == yr) return

        if (size[xr] >= size[yr]) {
            size[xr] += size[yr]
            parent[yr] = xr
        } else {
            size[yr] += size[xr]
            parent[xr] = yr
        }
    }

    fun isSame(x: Int, y: Int): Boolean = root(x) == root(y)

    fun size(x: Int): Long = size[root(x)]
}


Measured memory_bytes: 86920
#include <bits/stdc++.h>
using namespace std;
int D, G;
vector<pair<int, int>> PCs(10);

int f(int d, int score, int cnt, vector<bool> solved)
{
	if (score >= G)
	{
		return cnt;
	}
	else if (d == D)
	{
		int min_cnt = 100000;
		for (int d = D - 1; d >= 0; d--)
		{
			if (solved.at(d))
			{
				continue;
			}
			else if (score + 100 * (d + 1) * PCs.at(d).first >= G)
			{
				for (int i = 1; i <= PCs.at(d).first; i++)
				{
					if (score + 100 * (d + 1) * i >= G)
					{
						min_cnt = min(min_cnt, i);
						break;
					}
				}
			}
		}
		return cnt + min_cnt;
	}
	int pd = PCs.at(d).first;
	int cd = PCs.at(d).second;
	vector<bool> d_solved = solved;
	d_solved.at(d) = 1;
	int ret1 = f(d + 1, score, cnt, solved);
	int ret2 = f(d + 1, score + 100 * (d + 1) * pd + cd, cnt + pd, d_solved);
	return min(ret1, ret2);
}

int main()
{
	cin >> D >> G;
	for (int i = 0; i < D; i++)
	{
		int p, c;
		cin >> p >> c;
		pair<int, int> pc(p, c);
		PCs.at(i) = pc;
	}
	vector<bool> solved(10, 0);
	cout << f(0, 0, 0, solved) << endl;
}

Measured memory_bytes: 256