akhauriyash/Code-Regression huggingface dataset:
object Main extends App {

  val In = io.StdIn.readLine()
  val A = In.split(" ")

  val max: Long = A.max.toLong
  val min: Long = A.min.toLong

  var N: Long = 0

  if (min == 1) {
    if (max == 1) {
      N = 1
    }else {
        N = max - 2
    }
  }

  //N Mのどちらかが2の時
  if (min == 2) {
    N = 0
  }

  if (min >= 3){
    N = (A(0).toLong - 2) * (A(1).toLong - 2)
  }

  print(N)

}


Measured memory_bytes: 25404
use num::One;
use proconio::{input, marker::Bytes};
use std::{
    fmt,
    ops::{Add, AddAssign, Mul},
};

fn main() {
    input! {
        s: Bytes,
    }

    let mut counts = vec![0u64; 2019];
    let mut acc = Zm::new(0);
    for (exp, c) in s.into_iter().rev().enumerate() {
        acc += Zm::new((c - b'0').into()) * num::pow(Zm::new(10), exp);
        counts[acc.repr] += 1;
    }

    dbg!(counts
        .iter()
        .copied()
        .enumerate()
        .filter(|&(_, c)| c > 0)
        .collect::<std::collections::BTreeMap<_, _>>());

    let ans = counts[0]
        + counts
            .into_iter()
            .map(|c| c * c.saturating_sub(1) / 2)
            .sum::<u64>();
    println!("{}", ans);
}

const M: usize = 2019;

#[derive(Clone, Copy, Debug)]
struct Zm {
    repr: usize,
}

impl Zm {
    fn new(val: usize) -> Self {
        Self { repr: val % M }
    }
}

impl fmt::Display for Zm {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(&self.repr, fmt)
    }
}

impl One for Zm {
    fn one() -> Self {
        Self { repr: 1 }
    }
}

impl Add for Zm {
    type Output = Self;

    fn add(self, rhs: Self) -> Self {
        Self::new(self.repr + rhs.repr)
    }
}

impl Mul for Zm {
    type Output = Self;

    fn mul(self, rhs: Self) -> Self {
        Self::new(self.repr * rhs.repr)
    }
}

impl AddAssign for Zm {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}


Measured memory_bytes: 2396
#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define all(a) a.begin(), a.end()
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

ll s;

ll mod = 1e9+7;

static vector<ll> dp(4010,-1);

ll dfs(ll sum = 0){
    
    if(sum == s){ return 1; }
    if(sum > s) return 0;

    ll ret = 0;
    for(long long i = 3; i <= s; i++){
        if(sum + i > s) break;

        if(dp[sum+i] < 0){
            dp[sum+i] = dfs(sum + i);
            ret = ret  + dp[sum+i] % mod;
            //ret %= mod;
            
            
        }else{
            ret += dp[sum + i];
            //ret %= mod;
           
        }
        //cout << "ret:" << ret << " sum+i:" << sum+i << endl;
    }
    return ret % mod;
}

int main(){
    cin >> s;
    put(dfs());
}

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

int solve(int s, int d) {
  if (d - s < 2) {
    return d - s;
  }

  int m = 0;
  if (s % 2) {
    m++;
    s++;
  }
  if (d % 2) {
    m++;
    d--;
  }
  return m + solve(s / 2, d / 2);
}

int main() {
  int N;
  int s, d;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> s >> d;
    cout << solve(s, d) << endl;
  }
}

Measured memory_bytes: 1160
/************************************************
*Author        :  Jack
*Created Time  :  2019.10.27.20:02
*Mail          :  724033213@qq.com
*Problem       :  9X9
*Extra         :  
************************************************/
#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
//    freopen("9X9.in","r",stdin);
//    freopen("9X9.out","w",stdout);
    cin >> a >> b;
	if(a > 9 || b > 9 || a < 1 || b < 1){
		printf("-1\n");
		return 0;
	} else {
		printf("%d\n", a * b);
		return 0;
	}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  int F = 1;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
   if ((F * 2) <= (F + K)){
     F *= 2;
   }
   else {
     F += K;
   }
  }
  cout << F << endl;
}

Measured memory_bytes: 256
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, k = MI()
    al = LI()

    al.insert(0, 0)
    now = 1
    if n >= k:
        for _ in range(k):
            now = al[now]
    else:
        passed = [-1] * (n + 1)
        i = 0
        while passed[now] == -1:
            passed[now] = i
            now = al[now]
            i += 1

        loop = i - passed[now]

        for _ in range((k - passed[now]) % loop):
            now = al[now]

    print(now)


if __name__ == "__main__":
    main()


Measured memory_bytes: 90092
from sys import maxsize
from heapq import heappop, heappush


class Node:
    WHITE = 0
    GRAY = 1
    BLACK = 2

    def __init__(self):
        self.adjs = []
        self.color = Node.WHITE
        self.dist = maxsize

    def __lt__(self, other):
        return self.dist < other.dist

    def __repr__(self):
        return "Node({},{},{})".format(self.adjs, self.color, self.dist)


def read_adj():
    n = int(input())
    nodes = [Node() for _ in range(n)]

    for i in range(n):
        u, _, *rest = [int(x) for x in input().split()]
        for i in range(0, len(rest) - 1, 2):
            nodes[u].adjs.append((rest[i], rest[i+1]))

    return nodes


def shortest_path(nodes):
    h = []

    nodes[0].dist = 0
    nodes[0].color = Node.GRAY
    heappush(h, (0, 0))

    while len(h) > 0:
        min_node, min_dist = heappop(h)
        if nodes[min_node].dist < min_dist:
            continue

        nodes[min_node].color = Node.BLACK

        for adj, c in nodes[min_node].adjs:
            if nodes[min_node].dist + c < nodes[adj].dist:
                nodes[adj].dist = nodes[min_node].dist + c
                nodes[adj].color = Node.GRAY
                heappush(h, (adj, nodes[adj].dist))


def print_dist(nodes):
    for u, n in enumerate(nodes):
        print(u, n.dist)


def main():
    nodes = read_adj()
    shortest_path(nodes)
    print_dist(nodes)


if __name__ == '__main__':
    main()



Measured memory_bytes: 69140
#include <iostream>

using namespace std;
int main()
{
	int n,a,b;
	cin >>n >>a >>b;

	int sum = 0;
	for (int i = 1; i <= n; i++) {
		int tmpsum = 0;
		int tmpi = i;
		while (tmpi > 0) {
			tmpsum += tmpi % 10;
			tmpi /= 10;
		}
		if (tmpsum >= a && tmpsum <= b) {
			sum += i;
		}
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N, K = map(int, readline().split())
    h = np.array(read().split(), np.int32)
    dp = np.zeros(N, np.int32)

    for i in range(1, N):
        left = max(0, i - K)
        dp[i] = (dp[left:i] + np.abs(h[left:i] - h[i])).min()

    print(dp[-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 21408
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N; R(N);
    if((N&(N-1))==0)W("No");
    else{
        W("Yes");
        for(int i=2;i+1<=N;i+=2){
            W(1,i);
            W(i,i+1);
            W(i+1+N,1);
            W(i+N,i+N+1);
        }
        W(N+1,3);
        if(N%2==0){
            int lb=N&-N;
            W(N,lb+N+1);
            W(2*N,N-lb);
        }
    }
    return 0;
}


Measured memory_bytes: 2432
n = int(input())
a = list(map(int, input().split()))
a.sort()
maxa = max(a)
ans = -1
for i in range(len(a)-1):
   diff_ans =abs(maxa/2 - ans)
   diff = abs(maxa/2 - a[i])
   if maxa % 2 == 0 :
      diff_ans = min(diff_ans, abs(maxa/2+1-ans))
      diff = min(diff, abs(maxa/2+1-a[i]))
   if diff_ans > diff:
      ans = a[i]
print(str(maxa) + " " + str(ans))

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

using namespace std;

struct Submit {
  int minutes, teamIdx, problemIdx, judge;
};

struct Result {
  Result() : minutes(0), judge(-1) {}
  int minutes, judge;
};

struct Score {
  Score() : teamIdx(0), acceptedCount(0), minutes(0) {}
  int teamIdx;
  int acceptedCount;
  int minutes;
};
bool operator==(const Score& lhs, const Score& rhs) {
  return lhs.acceptedCount == rhs.acceptedCount && lhs.minutes == rhs.minutes;
}

std::string calc(const std::vector<Submit>& submits, int teamCount,
                 int problemCount) {
  std::vector<std::vector<Result>> results(
      teamCount, std::vector<Result>(problemCount, Result()));
  for (auto&& submit : submits) {
    auto& result = results[submit.teamIdx - 1][submit.problemIdx - 1];
    if (submit.judge) {
      result.minutes += 20;
    } else {
      result.minutes += submit.minutes;
    }
    result.judge = submit.judge;
  }
  std::vector<Score> scores(teamCount, Score());
  for (int teamIdx = 0; teamIdx < teamCount; ++teamIdx) {
    auto& score = scores[teamIdx];
    score.teamIdx = teamIdx;
    for (int problemIdx = 0; problemIdx < problemCount; ++problemIdx) {
      const auto& result = results[teamIdx][problemIdx];
      if (result.judge) {
        continue;
      }
      score.acceptedCount++;
      score.minutes += result.minutes;
    }
  }
  std::sort(scores.begin(), scores.end(),
            [](const Score& lhs, const Score& rhs) {
              if (lhs.acceptedCount != rhs.acceptedCount) {
                return lhs.acceptedCount > rhs.acceptedCount;
              }
              if (lhs.minutes != rhs.minutes) {
                return lhs.minutes < rhs.minutes;
              }
              return lhs.teamIdx > rhs.teamIdx;
            });
  std::string ret;
  Score previousScore = Score();
  for (auto&& score : scores) {
    if (ret.length() > 0) {
      if (score == previousScore) {
        ret += "=";
      } else {
        ret += ",";
      }
    }
    ret += std::to_string(score.teamIdx + 1);
    previousScore = score;
  }
  return ret;
}

int main() {
  int maxMinute, teamCount, problemCount, submitCount;
  while (std::cin) {
    std::cin >> maxMinute >> teamCount >> problemCount >> submitCount;
    if (maxMinute == 0 && teamCount == 0 && problemCount == 0 &&
        submitCount == 0) {
      break;
    }
    std::vector<Submit> submits(submitCount, Submit());
    for (int i = 0; std::cin && i < submitCount; ++i) {
      std::cin >> submits[i].minutes;
      std::cin >> submits[i].teamIdx;
      std::cin >> submits[i].problemIdx;
      std::cin >> submits[i].judge;
    }
    auto ret = calc(submits, teamCount, problemCount);
    std::cout << ret << std::endl;
  }
  return 0;
}



Measured memory_bytes: 3300
a, b = gets.split.map(&:to_i)

ans = []
b.to_s(2).size.times do |x|
  d = 2 ** x
  i = a / d
  j = b / d

  if i == j
    ans << (i.odd? ? b - a + 1 : 0)
    next
  end

  sum = 0
  if i.odd? 
    y = (a / d + 1) * d
    sum += y - a
    i += 1
  end

  if j.odd?
    y = (b / d) * d - 1
    sum += b - y
    j -= 1
  end

  sum += (j - i) / 2 * d
  ans << sum
end

p ans.reverse.map{|x| x.odd? ? "1" : "0"}.join.to_i(2)

Measured memory_bytes: 1788
import java.util.HashMap;
import java.util.Scanner;

// A - On the Way
public class Main {
	static HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
	static String[] s;
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int A = sc.nextInt();
	int B = sc.nextInt();
	int C = sc.nextInt();

	if (Math.min(A, B) <= C && Math.max(A, B) >= C) {
		System.out.println("Yes");
	} else {
		System.out.println("No");
	}
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, M, X;
        cin >> N >> M >> X;
        vll A(N);
        rep(i, 0, M) cin >> A[i];

        ll l, r;
        l = r = 0;
        rep(i, 0, M) {
                if (A[i] < X) ++l;
                else if (A[i] > X) ++r;
        }
        cout << min(l, r) << endl;
}

Measured memory_bytes: 3620
x, n = map(int, input().split())
p = set(map(int, input().split()))

minSa = 500
ans = -501

for i in range(-500, 501):
    if i in p:
        continue
    else:
        sa = abs(i - x)
        if sa < minSa:
            minSa = sa
            ans = i

print(ans)

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // AtCoder
    // template
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll sum = 0;
    rep(i, n) { sum += a[i]; }
    ll res = 0;
    rep(i, n) {
        if(!((double)sum / (double)(4 * m) > a[i]))
            res++;
    }
    if(res >= m)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
using System;

class main{
	static void Main(){
		string[] str = Console.ReadLine().Trim().Split(' ');
		int A = int.Parse(str[0]);
		int B = int.Parse(str[1]);
		int C = int.Parse(str[2]);
		if(A + B >= C){
			Console.WriteLine("Yes");
		}else{
			Console.WriteLine("No");
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    vint a(n);
    vector<P> move;
    int tmp = 0;
    int mx, id;
    rep(i,n) {
        int x; cin >> x;
        if (chmax(tmp,abs(x))) {
            mx = x; 
            id = i;
        }
        a[i] = x;
    }
    int ct = 0;
    if (mx < 0) {
        rep(i,n) {
            if (a[i] >= 0) {
                a[i] += mx;
                ct++;
                move.push_back(P(id+1,i+1));
            }
        }
        for (int i = n-1; i >= 1; i--) {
            if (a[i-1] > a[i]) {
                a[i-1] += a[i];
                ct++;
                move.push_back(P(i+1,i));
            }
        }
    }
    if (mx > 0) {
        rep(i,n) {
            if (a[i] < 0) {
                a[i] += mx;
                ct++;
                move.push_back(P(id+1,i+1));
            }
        }
        for (int i = 0; i < n-1; i++) {
            if (a[i] > a[i+1]) {
                a[i+1] += a[i];
                ct++;
                move.push_back(P(i+1,i+2));
            }
        }
    }
    cout << ct << endl;
    rep(i,move.size()) {
        cout << move[i].first << " " << move[i].second << endl;
    }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int x = cin.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = cin.nextInt();
        }

        Arrays.sort(a);

        int cnt = 0;

        for (int i = 0; i < N; i++) {
            if (x >= a[i]) {
                x -= a[i];
                cnt++;
            } else {
                break;
            }
        }

        if (cnt == N && x > 0) {
            cnt--;
        }

        System.out.println(cnt);
    }
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    vi s(3); cin >> s[0] >> s[1] >> s[2];
    sort(ALL(s));
    int ans = 0;
    while(s[1] != s[2])
    {
        ans++;
        s[0]++;
        s[1]++;
    }
    while(s[0] < s[1])
    {
        ans++;
        s[0] += 2;
    }
    if(s[0] != s[1]) ans++;
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
s = input().rstrip()
if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
elif len(s) == 26:
    s = s[::-1]
    seen = []
    for i in range(26):
        for j, item in enumerate(seen):
            if s[i] < item:
                ns = seen[j] + s[i+1:]
                print(ns[::-1])
                exit()
        seen.append(s[i])
else:
    alphabets = set(s)
    for item in "abcdefghijklmnopqrstuvwxyz":
        if item not in alphabets:
            print(s + item)
            exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //greater<T> for sorting decreasingly

#define ll         long long
#define pll        pair<ll,ll>
#define unique(a)  a.resize(unique(a.begin(), a.end()) - a.begin())
#define fill(v, p) memset(v,p,sizeof v)
#define all(x)     x.begin(), x.end()
#define at_(x,i)   x.find_by_order(i)
#define koto_(x,i) x.order_of_key(i)
#define PI         acos(-1.0)
#define EPS        0.000000001
#define INF        1LL<<62
#define MAX        300005
#define MOD        1000000007


signed int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(0);
	
	ll h, a;
	cin >> h >> a;
	
	int i=0;
	
	while(h>0) h-=a, i++;
	
	cout << i << endl;
	
	
	return 0;
}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define LINF		((ll)1 << 63 -1)
#define INF 		(1<<29)
#define MINF		-2000000007
#define MAX 		100050

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

int N;
int func(string a){
	if((ll)stoll(a) > N)return 0;
	//cout << a << endl;
	int cnt = 0,flag[3]={0,0,0};
	REP(i,a.size())if(a[i]=='3')flag[0]=1;
	REP(i,a.size())if(a[i]=='5')flag[1]=1;
	REP(i,a.size())if(a[i]=='7')flag[2]=1;
	if(flag[0]&flag[1]&flag[2])cnt=1;
	for(char i : {'3','5','7'}){
		a.push_back(i);
		cnt += func(a);
		a.pop_back();
	}
	return cnt;
}

//
int main(){
	//int N;
	cin>>N;

	cout << func("0") << endl;

	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<int(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> void read(T &x){
	int f=0; x=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) f|=(ch=='-');
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	if(f) x=-x;
}

const int N=5005,mod=1e9+7;
int f[N][N],pa[N],mark[N],sz[N],s[N];
int n,c,p,con,ans;

int power(int x,int p){
	int res=1;
	for(;p;p>>=1,x=(ll)x*x%mod)
		if(p&1) res=(ll)res*x%mod;
	return res;
}
int mul(int x,int y){
	return (ll)x*y%mod;
}
void add(int &x,int y){
	x=(x+y>=mod?x+y-mod:x+y);
}
int gp(int x){
	return pa[x]==x?x:pa[x]=gp(pa[x]);
}

int main(){
	read(n);
	rep(i,1,n){
		pa[i]=i;
		sz[i]=1;
	}
	rep(i,1,n){
		read(p);
		if(p==-1) continue;
		if(gp(i)==gp(p)){
			mark[gp(i)]=1;
		}
		else{
			sz[gp(i)]+=sz[gp(p)];
			mark[gp(i)]|=mark[gp(p)];
			pa[gp(p)]=gp(i);
		}
	}
	rep(i,1,n){
		if(pa[i]!=i) continue;
		if(!mark[i]) s[++c]=sz[i];
		con++;
	}
	ans=mul(con-c,power(n-1,c));
	f[0][0]=1;
	rep(i,1,c){
		rep(j,0,i-1){
			add(f[i][j],f[i-1][j]);
			add(f[i][j+1],mul(f[i-1][j],s[i]));
		}
	}
	rep(i,1,c){
		int res=s[i]-1;
		res=mul(res,power(n-1,c-1));
		add(ans,res);
	}
	int coef=1;
	rep(i,2,c){
		int res=f[c][i];
		res=mul(res,power(n-1,c-i));
		res=mul(res,coef);
		add(ans,res);
		coef=mul(coef,i);
	}
	ans=(mul(n,power(n-1,c))+mod-ans)%mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 70312
import math
import sys
input = sys.stdin.readline


def main():
    sc = Scan()
    s = sc.strarr()[0]
    t = sc.strarr()[0]
    count = 0
    for ss, tt in zip(s, t):
        if ss == tt:
            count += 1
    print(count)


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()


Measured memory_bytes: 3064
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = myconv(next(),2);
  var s = one[0];
  var t = one[1];
  var two = myconv(next(),4);
  var sc = two[0];
  var tc = two[1];
  var rem = next();
  if(rem == s){
     sc--;
  }else{
	tc--;
  }
  myout(sc + " " + tc);
}

Measured memory_bytes: 22080
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> L(2 * N);
    rep(i, 2 * N) { cin >> L[i]; }
    int res = 0;
    sort(All(L));
    rep(i, 2 * N) {
        if(i % 2 == 0)
            res += L[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int x,y,s;
	while(cin>>x>>y>>s && x){
		int ans = -1;
		for(int i=1;i<=s;i++){
			for(int j=1;j<=s;j++){
				int a1 = i*(x+100)/100;
				int b1 = j*(x+100)/100;
				if(a1+b1!=s) continue;
				int a2 = i*(y+100)/100;
				int b2 = j*(y+100)/100;
				ans = max(ans, a2+b2);
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll ans;
    if(d<a || b<c){
        ans=0;
    }else if(a<d && d<b){
        if(c<a){
            ans=d-a;
        }else{
            ans=d-c;
        }
    }else{
        if(c<a){
            ans=b-a;
        }else{
            ans=b-c;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3564
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys
import math 

def is_loadable(load, num_truck, w_list):

    excess = load*num_truck - sum(w_list)
    # print('Minimum Load:', load, num_truck, 'excess:', excess)
    cur_load = 0
    #truck_load = list()
    for w in w_list:
        #print(cur_load, w)
        if cur_load + w < load:
            cur_load += w
        elif cur_load + w == load:
            #truck_load.append(cur_load + w)
            cur_load = 0
            num_truck -= 1
            if num_truck < 0:
                return False
        else:
            num_truck -= 1
            if num_truck < 0:
                return False
            excess += load - cur_load
            if excess < 0:
                return False
            #print(cur_load, 'is added')
            #truck_load.append(cur_load)
            cur_load = w

    #truck_load.append(cur_load)
    if (cur_load and num_truck == 0):
        return False
    #print(truck_load)
    return True

n, num_truck = map(int, sys.stdin.readline().split())

weight = list()
for i in range(n):
    weight.append(int(sys.stdin.readline()))

ave_w = sum(weight) / num_truck
max_w = max(weight)
load = max(max_w, math.ceil(ave_w))
max_ng = load - 1

while True:
    if is_loadable(load, num_truck, weight):
        break
    min_ng = load
    load += 1024

min_ok = load
while True:
    if min_ok == max_ng + 1:
        break
    load = (max_ng + min_ok) // 2
    if is_loadable(load, num_truck, weight):
        min_ok = load
    else:
        max_ng = load

print(min_ok)



Measured memory_bytes: 9580
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
min=INF
5.times do
  a=gets.to_i
  min=min(min,a)
end
puts (N+min-1)/min+4

Measured memory_bytes: 3836
#include <cstring>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    vector<vector<bool> > e(n, vector<bool>(n, true));
    while (m--) {
        int a, b; cin >> a >> b;
        e[a-1][b-1] = e[b-1][a-1] = false;
    }
    vector<int> col(n, 0);
    function<pair<int, int>(int, int)> dfs = [&](int u, int c) {
        if (col[u] != 0 && col[u] != c) return make_pair(-1, -1);
        int v1 = 0, v2 = 0;
        if (col[u] == 0) {
            col[u] = c;
            if (c == 1) v1++; else v2++;
            for (int v = 0; v < n; v++) {
                if (u != v && e[u][v]) {
                    auto p = dfs(v, 3-c);
                    if (p.first == -1) return p;
                    v1 += p.first; v2 += p.second;
                }
            }
        }
        return make_pair(v1, v2);
    };
    vector<pair<int, int> > nums;
    for (int u = 0; u < n; u++) {
        if (col[u] == 0) {
            auto p = dfs(u, 1);
            if (p.first == -1) { cout << "-1\n"; return 0; }
            nums.push_back(p);
        }
    }
    bool dp[2][n/2+1], cur = 0, prev = 1;
    memset(dp, 0, sizeof dp);
    dp[prev][0] = true;
    for (auto p : nums) {
        memset(dp[cur], 0, sizeof dp[cur]);
        for (int s = p.first; s <= n/2; s++)
            if (dp[prev][s-p.first]) dp[cur][s] = true;
        for (int s = p.second; s <= n/2; s++)
            if (dp[prev][s-p.second]) dp[cur][s] = true;
        swap(cur, prev);
    }
    int v1 = n/2;
    while (!dp[prev][v1]) v1--;
    int v2 = n - v1;
    cout << v1 * (v1 - 1) / 2 + v2 * (v2 - 1) / 2 << endl;
}


Measured memory_bytes: 384
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	ll H, N;
	cin >> H >> N;
	ll ans = 0;
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		sum += a;
	}
	if (H <= sum)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int n, A, B, C, l[10];

int solve(int bit, int X){
	vi cand;
	int res=1e9;
	REP(i, n){
		if(bit>>i&1){
			cand.push_back(l[i]);
		}
	}
	int sz=cand.size();
	FOR(i, 1, 1<<sz){
		int tmp=0;
		REP(j, sz){
			if(i>>j&1){
				tmp+=cand[j];
			}
		}
		int mp=10*(sz-1);
		CHMIN(res, mp+abs(tmp-X));
	}
	return res;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>A>>B>>C;
	REP(i, n){
		cin>>l[i];
	}
	int ans=1e9;
	FOR(i, 1, 1<<n){
		FOR(j, 1, 1<<n){
			FOR(k, 1, 1<<n){
				if(i&j || j&k || k&i){
					continue;
				}
				CHMIN(ans, solve(i, A)+solve(j, B)+solve(k, C));
			}
		}
	}
	cout<<ans<<'\n';
	return 0;
}


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

using namespace std;

int main(){
  int h, w;
  string board[50];

  cin >> h >> w;
  
  int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
  int dy[8] = {1, 1, 1, 0, 0, -1, -1, -1};

  for(int i=0;i<h;i++) cin >> board[i];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(board[i][j] == '#') continue;
      int num = 0;
      for(int k=0;k<8;k++){
        int ni = i + dy[k];
        int nj = j + dx[k];
        if((ni < 0) || (ni >= h)) continue;
        if((nj < 0) || (nj >= w)) continue;
        if(board[ni][nj] == '#') num++;
      }
      board[i][j] = char(num+'0');
    }
  }
  for(int i=0;i<h;i++) cout << board[i] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ios>//左右揃え
#include<iomanip>//setwで幅指定

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007LL

int main(void) {
    string S;
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())

LR = []
for i in range(N):
    x, l = map(int, input().split())
    LR.append([x-l, x+l])

LR.sort(key=lambda x:x[1])
# print(LR)

cur_r = LR[0][1]
c = 1
for l, r in LR[1:]:
    if cur_r <= l:
        c += 1
        cur_r = r
print(c)

Measured memory_bytes: 21336
// OURL: https://atcoder.jp/contests/abc138/tasks/abc138_b
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));  }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v);  }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", ";  } first = false; res += to_string(x);  } res += "}"; return res;  }

string to_string(string s) { return '"' + s + '"';  }
string to_string(const char* s) { return to_string((string) s);  }
string to_string(bool b) { return (b ? "true" : "false");  }
string to_string(vector<bool>::reference b) { return to_string(bool(b));  }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";  }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res; }

void debug_out() { cerr << endl;  }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...);  }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

  int n;
  cin >> n;
  double ans = 0;
  for (int i = 0; i < n; ++i) {
    double a;
    cin >> a;
    ans += 1 / a;
  }
  debug(ans);
  cout << fixed << setprecision(6) << 1 / ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(int a,int b)
{
    if(a == 1 && b == 2 || a == 2 && b == 1)
        cout<<3;
    else if(a == 2 && b == 3 || a == 3 && b == 2)
        cout<<1;
    else
        cout<<2;
}
int main()
{
    int a,b;
    cin>>a;
    cin>>b;
    solve(a,b);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin>>s;
  if(s=="abc"||s=="bca"||s=="cab"||s=="acb"||s=="bac"||s=="cba")
  	cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main(args: Array<String>) {
    val (h, w, k) = intList()
    val lines = mutableListOf<String>()
    repeat(h) {
        lines.add(readLine() ?: return)
    }

    fun count(removeHIndex: List<Boolean>, removeWIndex: List<Boolean>): Int {
        var count = 0
        lines.forEachIndexed { i, v ->
            v.forEachIndexed { j, c ->
                if (!removeHIndex[i] && !removeWIndex[j] && c == '#') {
                    count++
                }
            }
        }
        return count
    }

    val hList = mutableSetOf<List<Boolean>>()
    val wList = mutableSetOf<List<Boolean>>()
    fun conb(i: Int, seed: List<Boolean>, list: MutableSet<List<Boolean>>) {
        repeat(i) {
            val n = seed.toMutableList()
            if (!n[it]) {
                n[it] = true
                list.add(n.toList())
            }
        }
    }
    hList.add(Array(h) { false }.toList())
    conb(h, Array(h) { false }.toList(), hList)
    repeat(h - 1) {
        hList.toList().forEach {
            conb(h, it, hList)
        }
    }
    wList.add(Array(w) { false }.toList())
    conb(w, Array(w) { false }.toList(), wList)
    repeat(w - 1) {
        wList.toList().forEach {
            conb(w, it, wList)
        }
    }
    var count = 0
    hList.forEach { hIndex ->
        wList.forEach { wIndex ->
            if (count(hIndex, wIndex) == k) {
                count++
            }
        }
    }
    println(count.toString())
}

Measured memory_bytes: 41124
#include <iostream>

int main(int argc, const char *argv[])
{
    int A, B, C;
    std::cin >> A >> B >> C;
    if (C >= A && C <= B) std::cout << "Yes" << std::endl;
    else if (C <= A && C >= B) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
}


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

using namespace std;
typedef long long ll;

void solve();
int a, b, c;
string s;

int main()
{
    cin >> a >> b >> c;
    solve();
}

void solve()
{
    if (a == b && a != c && b != c)
    {
        cout << "Yes" << endl;
    }
    else if (a == c && a != b && b != c)
    {
        cout << "Yes" << endl;
    }
    else if (b == c && a != b && a != c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

C = Counter(S).most_common()
ans = []
m = C[0][1]
for i in range(len(C)):
    if C[i][1]==m:
        ans.append(C[i][0])
    else:
        break
ans.sort()
for a in ans:
    print(a)

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }

const int MAX_N = 100000;
int n,k,q;
int p[MAX_N];

int main()
{
  fastio();

  cin >> n >> k >> q;
  fill_n(p,n,k);

  forn(i,q) {
    int a; cin >> a;
    p[a-1]++;
  }

  forn(i,n) {
    if (p[i] > q) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }

  return 0;
}


Measured memory_bytes: 1024
inf = 2**31
n,m = map(int,raw_input().split())
coins = map(int,raw_input().split())
dp = [inf]*(n+1)
dp[n] = 0
while dp[0] == inf:
    for coin in coins:
        for i in range(n,coin-1,-1):
            if dp[i] < inf:
                dp[i-coin] = min(dp[i-coin],dp[i]+1)
print dp[0]

Measured memory_bytes: 7236
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 
int main() {
  int N;; 	//length
  cin >> N;
  string S;
  bool f = 0;
  if(N % 2 == 1){
    cout << "No" << endl;
  } else {
    cin >> S;
    rep(i, N/2){
      //cout << S.at(i) << " " << S.at(i + N/2) << endl;
      if(S.at(i) == S.at(i+N/2)){
      } else {
        f = true;
        break;
      }
    }
    if(f == true){
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> x(n), y(n), sorted_x, sorted_y;
    for(int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        sorted_x.emplace_back(x[i]);
        sorted_y.emplace_back(y[i]);
    }
    sort(ALL(sorted_x));
    sort(ALL(sorted_y));
    ll ans = __LONG_LONG_MAX__;
    for(int a = 0; a < n; a++) {
        for(int b = a + 1; b < n; b++) {
            for(int c = 0; c < n; c++) {
                for(int d = c + 1; d < n; d++) {
                    int cnt = 0;
                    ll lx = sorted_x[a];
                    ll ly = sorted_y[c];
                    ll rx = sorted_x[b];
                    ll ry = sorted_y[d];
                    for(int i = 0; i < n; i++) {
                        if(lx <= x[i] && x[i] <= rx && ly <= y[i] &&
                           y[i] <= ry) {
                            cnt++;
                        }
                    }
                    if(cnt >= k) {
                        chmin(ans, (rx - lx) * (ry - ly));
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;

int main(void) {
        namespace mp = boost::multiprecision;
        using Bint = mp::cpp_int;
        unsigned long n, d;
        cin >> n >> d;
        int count = 0;
        Bint d2 = d * d;
        for (int i = 0; i < n; i++) {
                long long x, y;
                cin >> x >> y;
                Bint dist2 = x * x + y * y;
                if (dist2 <= d2)
                        count++;
        }
        cout << count << endl;
        return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)
            r=(r*a)%m;
        b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

int main(){
    ll n,k; cin>>n>>k;
    vector<double>arr(n);
    rep(i,0,n)cin>>arr[i];
    double ans =0.0,sum = 0.0;
    rep(i,0,k)
    {
        sum+=((arr[i]+1)/2.0);
    }
    ans = sum;
    for(ll i = k;i<n;i++)
    {
        sum-=((arr[i-k]+1)/2.0);
        sum+=((arr[i]+1)/2.0);
        ans = max(ans,sum);
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}
/*
5 2
. #
# #
# .
# #
. #
*/


Measured memory_bytes: 1792
fun main (args : Array<String>) {
    val (n, m) = readLine()!!.split(" ")
    val N : Int = n.toInt()
    val M : Int = m.toInt()

    var result : Int = 0

    if (N > 1) {
        for (i in 1..N - 1) {
            result += i
        }
    }

    if (M > 1) {
        for (i in 1..M - 1) {
            result += i
        }
    }

    println("${result}")

}

Measured memory_bytes: 35624
S = input()
T = input()

min_count = 10000
for i in range(len(S)):
    count = 0
    check = False
    for j in range(len(T)):
        if i + j == len(S):
            check = True
            break
        if S[i + j] == T[j]:
            continue
        else:
            count += 1
    # print(count)
    if check:
        break

    min_count = min(count, min_count)
print(min_count)


Measured memory_bytes: 9052
fun main(args : Array<String>) {
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }

    var sum = 0
    if (x == 1) sum += 300000
    if (x == 2) sum += 200000
    if (x == 3) sum += 100000

    if (y == 1) sum += 300000
    if (y == 2) sum += 200000
    if (y == 3) sum += 100000

    if (x == 1 && y == 1) sum += 400000

    println(sum)
}

Measured memory_bytes: 38076