akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int INF=1001001001;

int main(){
  int n;cin>>n;
  vector<int>b(n+1);
  b[0]=INF;
  b[n]=INF;
  for(int i=1; i<n; i++){
    cin >> b[i];
  }
  int ans = 0;
  for(int i=0; i<n;i++){
    ans += min(b[i], b[i+1]);
  }
  
  cout << ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n, i;
	cin >> n;
	dbl c, d;
	c = 0;
	d = 0;
	for(i = 1; i <= n; i++)
	{
		if (i%2 != 0)
			c += 1;
		d+=1;
	}
	cout << fixed << setprecision(10) << (c/d);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <map>
#include <limits>
using namespace std;
typedef long long ll;

float inf = std::numeric_limits<float>::infinity();

/* 二次元配列の宣言
  vector<vector<int>> tb;
  tb.resize(H);
  for (size_t i = 0; i < H; i++) {
    tb[i].resize(W);
  }
*/
/*
  A.resize(N);
  for (int i = 0; i < N; i++) {scanf("%d",&A[i]);}
*/

int main(void) {
  ll a,b;
  char op;
  cin >> a >> op >> b;

  if (op=='+'){
    std::cout << a+b << '\n';
  }else{
    std::cout << a-b << '\n';
  }
}


Measured memory_bytes: 256
N,K =  map(int,input().split())
RST = list(map(int,input().split()))
#r:0 s:1 p:2
# a mod K != b mod Kならばaとbは独立に選ぶことができる。
# よってN個の手をmod KによるK個のグループに分け、各グループにおける最大値を求め、最終的にK個のグループの和が答え
T = [0 if i=="r" else 1 if i=="s" else 2 for i in input()]

dp = [[0]*3 for i in range(N)]

#直後の手を見て決める
for i in range(N):
    if i<K:
        for j in range(3):
            # j:1,2,0
            # j==0 -> RST[0]
            #初期値は勝つ手を出し続ける
            if (j+1)%3==T[i]:
                dp[i][j]=RST[j]
    else:
        #現在の出す手
        for j in range(3):
            #K回前に出した手
            for l in range(3):
                if j!=l:
                    if (j+1)%3 == T[i]:
                        dp[i][j] = max(dp[i][j],RST[j]+dp[i-K][l])
                    else:
                        dp[i][j] = max(dp[i][j],dp[i-K][l])

ans = 0
for i in range(N-K,N):
    ans += max(dp[i])

print(ans)

Measured memory_bytes: 90224
c=(0..18).map{[0]*19}
p`sed 1d`.split.sum{|a|a=(a.to_r*10**9).to_i
i=j=0
i+=1while a[i]<1&&i<18
(j+=1;a/=5)while a%5<1&&j<18
s=c[~i..].sum{_1[~j..].sum}
c[i][j]+=1
s}

Measured memory_bytes: 33608
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = N % 1000;
        if(res == 0){
            System.out.println(0);
        }else{
            System.out.println(1000-res);
        }
    }
}

Measured memory_bytes: 35724
#include <stdio.h>
#include <string.h>

int main(){
    char s[201];
    int len;
    int i,j;

    scanf("%s",s);

    len = strlen(s);

    s[len - 1] = '\0';

    for(j = len;j > 0;j--){
        s[j] = '\0';
        
        if((len = strlen(s)) % 2 != 0){
            continue;
        };

        for(i = 0;i < (len / 2);i++){
            if(s[i] == s[i + (len / 2)]){
                if(i == ((len / 2) - 1)){
                    printf("%d\n",len);
                    return 0;
                }
            }
            else{
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 128
def main():
    import sys
    import math
    import collections
    import itertools

    input = sys.stdin.readline().rstrip

    x = int(input())
    i = 1
    while i * (i + 1) < 2 * x:
        i += 1

    # i -= 2
    # print(x - i * (i + 1) // 2)
    print(i)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#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

H,W,D=get_i
num=Array.new(H*W+1)
H.times do|i|
  a=get_i
  W.times do|j|
    num[a[j]]=[j,i]
  end
end
cost=array(H*W+2,0)
(D+1).upto(H*W) do|x|
    cost[x]=cost[x-D]+(num[x][0]-num[x-D][0]).abs+(num[x][1]-num[x-D][1]).abs
end
Q=gets.to_i
Q.times do
    l,r=get_i
    puts cost[r]-cost[l]
end

Measured memory_bytes: 22464
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll ;

void solve(long long X){
ll a=100;
int ans=0;
while(X>a){
    a=a*1.01;
    a=(ll)a;
    ans++;
}
cout<< ans <<endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


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


def solve(sx: int, sy: int, tx: int, ty: int):
    ans = []
    ans.append("R"*(tx-sx))
    ans.append("U"*(ty-sy))
    ans.append("L"*(tx-sx))
    ans.append("D"*(ty-sy+1))
    ans.append("R"*(tx-sx+1))
    ans.append("U"*(ty-sy+1))
    ans.append("L")
    ans.append("U")
    ans.append("L"*(tx-sx+1))
    ans.append("D"*(ty-sy+1))
    ans.append("R")
    return "".join(ans)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    sx = int(next(tokens))  # type: int
    sy = int(next(tokens))  # type: int
    tx = int(next(tokens))  # type: int
    ty = int(next(tokens))  # type: int
    print(solve(sx, sy, tx, ty))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n, c;
	cin >> n >> c;

	int d[c][c];
	rep(i, c) rep(j, c) cin >> d[i][j];

	int a[n][n];
	rep(i, n) rep(j, n){
		cin >> a[i][j];
		a[i][j]--;
	} 

	int bascol[3][c];
	rep(i, 3) rep(j, c) bascol[i][j] = 0;
	rep(i, n) rep(j, n)	bascol[(i+j)%3][a[i][j]]++;

	// rep(i, 3) rep(j, c) cout << bascol[i][j] << (j == c-1 ? "\n" : ",");
	// cout << endl;

	vector<int> v;
	rep(i, c) v.push_back(i);

	int ans = 1e9;
	for(int i0 = 0; i0 < c; i0++){
		for(int i1 = 0; i1 < c; i1++){
			for(int i2 = 0; i2 < c; i2++){
				if(i0 == i1 || i1 == i2 || i2 == i0) continue;

				int tmp = 0;
				for(int j = 0; j < c; j++){
					tmp += d[j][i0] * bascol[0][j];
					tmp += d[j][i1] * bascol[1][j];
					tmp += d[j][i2] * bascol[2][j];
				}
				ans = min(ans, tmp);
			}
		}
	}

	cout << ans << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define pb push_back

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

void solve() {

}

int main() {
  int n;
  string s;
  cin >> n >> s;
  set<string> S;
  int tmp[3];
  rep(i,10) {
    tmp[0] = i;
    rep(j,10) {
      tmp[1] = j;
      rep(k,10) {
	tmp[2] = k;
	int cur = 0;
	rep(a,n) {
	  if( tmp[cur] == ( s[a]-'0' ) ) {
	    ++cur;
	    if( cur >= 3 ) break;
	  }
	}
	if( cur >= 3 ) {
	  S.insert(to_string(i)+to_string(j)+to_string(k));
	}
      }
    }
  }
  cout << S.size() << endl;
  return 0;
}


Measured memory_bytes: 384
N = int(input())
abc=[[int(i) for i in input().split()] for j in range(N)]
dp = [[0]*3 for i in range(N)]
#print(dp)
dp[0] = abc[0]
for i, h in enumerate(abc[1:], 1):
  #print(i,h)
  dp[i][0] = h[0] + max(dp[i-1][1], dp[i-1][2])
  dp[i][1] = h[1] + max(dp[i-1][2], dp[i-1][0])
  dp[i][2] = h[2] + max(dp[i-1][0], dp[i-1][1])
  #print(dp)
print(max(dp[-1]))

Measured memory_bytes: 44916
n = int(input())
dp = [[0] * 4 for i in range(n + 2)]
for i in range(4):
    dp[2][i] = 1
mod = 10**9 + 7
for i in range(3, n + 2):
    for j in range(4):
        for k in range(4):
            dp[i][j] += dp[i - 1][k]
    dp[i][2] -= dp[i - 2][0]
    dp[i][2] -= dp[i - 2][1]
    dp[i][1] -= dp[i - 2][0] - dp[i - 3][1]
    dp[i][2] -= 3 * dp[i - 3][0]
print(sum(dp[-1]) % mod)


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

int main() {
  int n; cin >> n;
  vector<int> sites(n + 2, 0);
  for (int i = 1; i < n + 1; i++) cin >> sites.at(i);
  
  int budget = 0;
  for (int i = 0; i < n + 1; i++) budget += abs(sites.at(i) - sites.at(i + 1));
  
  for (int i = 1; i < n + 1; i++) {
    int answer = budget - abs(sites.at(i - 1) - sites.at(i)) - abs(sites.at(i) - sites.at(i + 1));
    answer += abs(sites.at(i - 1) - sites.at(i + 1));
    cout << answer << endl;
  }
}

Measured memory_bytes: 1664
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,x;cin>>n>>x;
  vector<int> a(n);
  rep(i, n) {
    cin>>a[i];
  }
  dump(a);

  vector<int> cnt(10001, 0);
  cnt[0] += 1;
  int d = 0;
  rep(i, 1, n+1){
    d += a[i-1];
    cnt[d] += 1;
  }
  dump_1d(cnt, 20);

  int res=0;
  rep(i, 0, x+1){
    if (cnt[i]) res++;
  }
  cout << res << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

int main() {
  int n, k; cin >> n >> k;
  vector<int> h(n); REP(i, n) cin >> h[i];
  sort(h.begin(), h.end());
  
  int ans = 1e9;
  REP(i, n - k + 1) ans = min(ans, h[i + k - 1] - h[i]);
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 640
from math import factorial

n, k = map(int, input().split(' '))

def binom_fac(n,k):
    return factorial(n) // (factorial(n-k) * factorial(k))

def f(n,k):
    if n < k:
        return 0
    if n == 0 & k == 0:
        return 1
    if k < 1:
        return 0
    
    return binom_fac(n-1, k-1)

for i in range(1,k+1):
    S = f(n-k, i-1) + 2 * f(n-k, i) + f(n-k, i+1)
    out = int(f(k, i) * S)
    
    print(out % (10**9 + 7))
    

Measured memory_bytes: 3316
from collections import deque
q = int(input())
ans = deque()
for i in range(q):
    a = list(map(int, input().split()))
    if a[0] == 0:
        if a[1] == 0:
            ans.appendleft(a[2])
        else:
            ans.append(a[2])
    elif a[0] == 1:
        print(ans[a[1]])
    else:
        if a[1] == 0:
            ans.popleft()
        else:
            ans.pop()



Measured memory_bytes: 21976
#include <iostream>
#include <vector>
#include <ios>
using namespace std;

int cnt = 0;
void insertionSort(vector<long>& A, int n, int g){
	long i, j, v;
	for (i = g; i < n; ++i){
		v = A[i];
		j = i - g;
		while ( j >= 0 && A[j] > v){
			A[j + g] = A[j];
			j = j - g;
			++cnt;
		}
		A[j + g] = v;
	}
}

int main()
{
	ios::sync_with_stdio(false);

	long n, i, j = 13;
	vector<long> A;

	cin >> n;
	A.resize(n, 0);
	for (i = 0; i < n; ++i)
		cin >> A[i];

	long G[13] = { 1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161 };
	for (i = 12; i >= 0; --i){
		if (G[i] >= n){
			j = i;
			continue;
		}

		insertionSort(A, n, G[i]);
	}
	if (0 == j)
		j = 1;

	cout << j << "\n";
	for (i = j - 1; i >= 0; --i){
		cout << G[i];
		if (i != 0)
			cout << " ";
	}
	cout << "\n" << cnt << "\n";

	for (i = 0; i < n; ++i)
		cout << A[i] << "\n";

	return 0;
}

Measured memory_bytes: 8984
a=list(map(int,input().split()))
x=[]
for i in input().split():
  x.append(abs(int(i)-a[1]))
def ucl(a,b):
  if a%b==0:
    return b
  else:
    return ucl(b,a%b)
while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(len(x)):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
print(x[0])  

Measured memory_bytes: 14248
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

long long gcd(long long a, long long b) {
	long long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(a - x) > abs(b - x)) {
		cout << "B" << endl;
	}
	else {
		cout << "A" << endl;
	}
}

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

using namespace std;

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

	string s;
	cin >> s;
	int cnt[26] = {0}, n = s.size();
	for (int i = 0; i < n; ++i)
		++cnt[s[i] - 'a'];
	
	string s2;
	for (int i = 0; i < n; ++i) {
		if (s[i] != 'x') {
			s2.push_back(s[i]);
		}
	}
	bool palin = true;
	int m = s2.size();
	for (int i = 0; i < m / 2; ++i) {
		if (s2[i] != s2[m - i - 1]) {
			palin = false;
		}
	}
	if (!palin) {
		cout << -1 << "\n";
		return 0;
	}

	string res1, res2;
	for (int i = 0, j = s.size() - 1; i <= j; ++i, --j) {
		while (s[i] != s[j]) {
			res1.push_back('x');
			res2.push_back('x');
			if (s[i] == 'x') {
				++i;
			} else {
				--j;
			}
		}
		res1.push_back(s[i]);
		if (i != j) res2.push_back(s[j]);
	}	
	reverse(res2.begin(), res2.end());
	string res = res1 + res2;
	cout << res.size() - s.size() << "\n";
}

Measured memory_bytes: 976
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define Mod 1000000007
inline int read(){
	int ret=0,p=1;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') p=-1;
	for (;isdigit(ch);ch=getchar()) ret=ret*10+ch-'0';
	return ret*p;
}
using namespace std;
int n;
int a[100000+3],s[100000+3];
LL fac[100000+3],ny[100000+3];
LL quickexp(LL a,int n){
	LL ret=1,tmp=a;
	while (n){
		if (n&1) ret=ret*tmp%Mod;
		tmp=tmp*tmp%Mod;
		n>>=1;
	}
	return ret%Mod;
}
LL C(int n,int m){
	if (n<1) return 0;
	if (m<0) return 0;
	if (n<m) return 0;
	LL ret=fac[n];
	ret=ret*ny[m]%Mod;
	ret=ret*ny[n-m]%Mod;
	return ret%Mod;
}
int main(){
	fac[0]=1;
	for (int i=1;i<=100002;i++) fac[i]=fac[i-1]*i%Mod;
	for (int i=0;i<=100002;i++) ny[i]=quickexp(fac[i],Mod-2);
	n=read();
	for (int i=1;i<=n+1;i++) a[i]=read(),s[a[i]]++;
	int f,w;
	for (int i=1;i<=n+1;i++) if (s[i]>1) f=i;
	for (int i=1;i<=n+1;i++){
		if (a[i]==f){
			w=i-1;break;
		}
	}
	for (int i=w+2;i<=n+1;i++){
		if (a[i]==f){
			w+=n+1-i;break;
		}
	}
	printf("%d\n",n);
	for (int i=2;i<=n+1;i++){
		LL ans=C(n+1,i);
		ans=(ans-C(w,i-1)+Mod)%Mod;
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
	int A,B,C;
    cin>>A>>B>>C;

    if(A<=C&&C<=B){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
n = int(input())
dp = [[0, 0, 0] for _ in range(n)]
a, b, c = map(int, input().split())
dp[0] = [a, b, c]
for i in range(1, n):
    a, b, c = map(int, input().split())
    dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2])
    dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2])
    dp[i][2] = c + max(dp[i - 1][0], dp[i - 1][1])

print(max(dp[-1]))

Measured memory_bytes: 22772
n, k = map(int, input().split())

a = [int(i) for i in input().split()]

ans = float('inf')
for i in range(1 << n):
    res = 0
    cnt = 0
    m = 0
    for j in range(n):
        if i >> j & 1:
            cnt += 1
            res += max(m-a[j] + 1, 0)
            m = max(m+1, a[j])
        else:
            m = max(m, a[j])

    if cnt >= k:
        ans = min(ans, res)

print(ans)


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

int main()
{
    int maxNum = 0;
    vector<int> A(3);
    for(int i = 0; i < 3; i++)
    {
        cin >> A.at(i);
        maxNum = max(A.at(i), maxNum);
    }

    int d = 0;

    for(int i = 0; i < 3; i++)
    {
        if(A.at(i) != maxNum)
        {
            d += maxNum - A.at(i);
        }
    }

    int ans;

    if(d % 2 == 0)ans = d/2;
    else ans = (d+1)/2 + 1;

    cout << ans <<endl;
    return 0;


}

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

int main() {
  int A,B;
  cin >> A >> B;
  if (A <= 12 && A >= 6){
    cout << B/2 << endl;
  }
  else if (A >= 13){
    cout << B << endl;
  }
  else  {
    cout << 0 <<endl;
  }
}


Measured memory_bytes: 256
numListA = []
numListB = []

x = -1
y = -1
num = 0

while x != 0 or y != 0: 
    if x == -1:
        x, y = (int(a) for a in input().split())

    else:
        numListA = numListA + [x]
        numListB = numListB + [y]
        x, y = (int(a) for a in input().split())
        num += 1

for i in range(num):
    if(numListA[i] > numListB[i]):
        print("%d %d" % (numListB[i], numListA[i]))
    else:
        print("%d %d" % (numListA[i], numListB[i]))



Measured memory_bytes: 5904
a,b = map(int,input().split())
s = list(str(input()))

arr = list(range(10))
arr = list(map(str,arr))

x = s.pop(a)

flag = True
for i in range(len(s)):
    if s[i] in arr:
        pass
    else:
        flag = False

if x == '-' and flag == True:
    print('Yes')
else:
    print('No')


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

const long long mod = 1e9 + 7;

long long modpow(long long a, long long b) {
	if (b == 0) return 1;
	return modpow(a * a % mod, b / 2) * (b & 1 ? a : 1) % mod;
}

long long modinv(long long a) {
	return modpow(a, mod - 2);
}

vector<long long> fact, inv_fact;

void init_fact(int n) {
	fact.resize(n);
	fact[0] = 1;
	for (int i = 1; i < n; i++) {
		fact[i] = i * fact[i - 1] % mod;
	}
	inv_fact.resize(n);
	inv_fact[n - 1] = modinv(fact[n - 1]);
	for (int i = n - 2; i >= 0; i--) {
		inv_fact[i] = (i + 1) * inv_fact[i + 1] % mod;
	}
}

long long nPr(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return fact[n] * inv_fact[n - r] % mod;
}

long long nCr(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return fact[n] * inv_fact[r] % mod * inv_fact[n - r] % mod;
}

long long nHr(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return nCr(n + r - 1, r);
}

int main() {
	init_fact(1010101);

	int H, W, A, B;
	cin >> H >> W >> A >> B;

	long long res = 0;
	for (int i = 0; i < H - A; i++) {
		long long way = nCr(i + B - 1, i) * nCr(W - B - 1 + H - i - 1, W - B - 1) % mod;
		res += way;
	}
	cout << res % mod << endl;
}

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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

int main() {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int w;
    cin >> w;

    string ans = "";
    for(int i = 0; i < (int) s.size(); i += w) {
        ans += s[i];
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;
static const long long INF = 1000000000;

int n;
ll ans = 1, k, d[100005];
vector<int> g[100005];

void bfs() {
    queue<int> q;
    rep(i, 1, 100005) d[i] = INF;
    d[1] = k;
    int c = k-1;
    for (int x : g[1]) {
        d[x] = c--;
        q.push(x);
    }

    while (!q.empty()) {
        int u = q.front(); q.pop();
        int c = k-2;
        for (int v : g[u]) {
            if (d[v]==INF) {
                d[v] = c--;
                q.push(v);
            }
        }
    }


}

int main(void) {
    cin >> n >> k;
    rep(i, 0, n-1) {
        int a, b;
        scanf("%d %d", &a, &b);
        g[a].pb(b);
        g[b].pb(a);
    }
    bfs();

    rep(i, 1, n+1) {
        ans *= d[i];
        ans %= MOD;
    }

    cout << ans % MOD << endl;

	return 0;
}


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

int main(){
  string s;
  cin >> s;
  
  int ans = 1;
  int n = s.size();
  int half = (n-1)/2;
  for (int i=0 ; i<half ; i++){
    if (s.at(i) != s.at(n-1-i)){
      ans = 0;
      break;
    }
  }
  if (ans == 1){
    if (half%2 == 0){
      for (int i=0 ; i<half/2 ; i++){
        if (s.at(i) != s.at(half-1-i)){
          ans = 0;
          break;
        }
      }
    }
    else{
      for (int i=0 ; i<(half-1)/2 ; i++){
        if (s.at(i) != s.at(half-1-i)){
          ans = 0;
          break;
        }
      }
    }
  }
  
  if (ans == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	
	void prog()
	{
		cin = new Scanner();

		int s = cin.nextInt();

		Console.WriteLine("{0}:{1}:{2}", s / 3600, (s % 3600) / 60, s % 60);
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 9180
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count = 0;
		double p = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 == 1) {
				count++;
			}
		}
		p = (double)count / N;
		System.out.println(p);
		sc.close();
	}

}


Measured memory_bytes: 23892
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999


int main(){
    int pass[110][110];
    rep(i,110)rep(j,110)pass[i][j]=INF;
    rep(i,110)pass[i][i]=0;
    
    int n,m;
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        for(int j=a;j<=b;j++)pass[j][b+1]=1;
    }
    
    rep(k,n+1){
        rep(i,n+1){
            rep(j,n+1){
                pass[i][j] = min(pass[i][j],pass[i][k]+pass[k][j]);
            }
        }
    }

    if(pass[0][n]>=10000)cout<<"Impossible"<<endl;
    else cout<<pass[0][n]<<endl;
}

Measured memory_bytes: 3140
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef vector<int> vi;
typedef long long int ll;
vector<vector<int>> adj;

class TaskA {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n; in>>n;
        ll cx = 0, cy = 0, ct=0;
        f(i, n){
            ll t, x, y; in>>t>>x>>y;
            ll remain = (t-ct) - (abs(cx-x)+abs(cy-y));
            cx = x, cy=y, ct=t;
            if(remain>=0 and remain%2==0) continue;
            out<<"No";
            return;
        }
        out<<"Yes";
	}
    void inG(int m, istream& in){ int u,v; adj = vector<vi>(200005);f(i, m){ in>>u>>v; adj[u].push_back(v); adj[v].push_back(u); }}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	TaskA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int M;
int a[7];
int s, g;
int N[301];

bool isChecked[301];
vector<int> milestone[301];  //そのマスで出せばゴールにたどり着ける目を格納する

int iabs(int x){ return x >= 0 ? x : -x; }

bool search(int now){
	if (isChecked[now]) return false;
	else if (now == g)  return true;

	isChecked[now] = true;
	for (int dice = 1; dice <= 6; dice++){
		if (now + a[dice] <= M && search(now + a[dice] + N[now + a[dice]])){
			milestone[now].push_back(a[dice]);
		}
		if (now - a[dice] >= 1 && search(now - a[dice] + N[now - a[dice]])){
			milestone[now].push_back(-a[dice]);
		}
	}

	return milestone[now].size() > 0 ? true : false;
}

int main(){
	cin >> M;
	for (int i = 1; i <= 6; i++){
		cin >> a[i];
	}
	cin >> s >> g;
	for (int i = 1; i <= M; i++){
		cin >> N[i];
	}
	bool canGoal = search(s);

	int now = s; //自分が今いるマスの番号
	for (;;){
		int dice;
		cin >> dice;

		bool found = false;
		for (vector<int>::iterator it = milestone[now].begin(); it != milestone[now].end(); it++){
			if (iabs(*it) == a[dice]){
				if (*it > 0){
					now += a[dice] + N[now + a[dice]];
					cout << 1 << endl;
				}
				else{
					now += -a[dice] + N[now - a[dice]];
					cout << -1 << endl;
				}
				found = true;
				break;
			}
		}
		if(!found) cout << 0 << endl;
		cout.flush();

		if (now == g) return 0;
	}
	
	return 0;
}

Measured memory_bytes: 1304
// B - Counting Roads
#include <bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<(n);++i)

int main(){
	int N, M; cin>>N>>M;
	vector<int> A(M), B(M); rp(i,M) cin>>A[i]>>B[i];
	rp(i,N){//全ての都市について
		int count = 0;
		rp(j,M){//全ての道を調べて各都市の道の数を知る
			if(i+1==A[j]) count++;
			if(i+1==B[j]) count++;
		}
		cout<< count <<endl;
	}
}

Measured memory_bytes: 256
def read_input():
    n = int(input())
    k = int(input())
    xlist = list(map(int, input().split()))

    return n, k, xlist


def submit():
    n, k, xlist = read_input()

    dist = 0
    for x in xlist:
        adist = 2 * x
        bdist = 2 * (k - x)

        dist += min(adist, bdist)

    print(dist)

if __name__ == '__main__':
    submit()

Measured memory_bytes: 38256
N,Q=map(int,input().split())
S=input()
data=[0]
for i in range(1,N):
    x=data[-1]
    if S[i]=='C' and S[i-1]=='A':
        data.append(x+1)
    else:
        data.append(x)

for i in range(0,Q):
    l,r=map(int,input().split())
    ans=data[r-1]-data[l-1]
    print(ans)

Measured memory_bytes: 51404
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <bitset>
#include <cmath>

int main(){
   int N;
   std::cin >> N;
   std::vector<int> V(N);
   std::vector<int> C(N);
   for (int i=0; i<N; i++){
      std::cin >> V.at(i);
   }
   for (int i=0; i<N; i++){
      std::cin >> C.at(i);
   }
   int max = 0;
   int nmax = std::pow(2, N);
   for (int i=0; i<nmax; i++){
      std::stringstream i_ss;
      i_ss << std::bitset<20>(i);
      std::string i_s = i_ss.str();
      if (i<10){
         std::cerr << i_s << std::endl;
      }
      int Y = 0, X = 0;
      for (int j=0; j<N; j++){
         if (i_s.at(19-j) == '1'){
            Y = Y + C.at(j);
            X = X + V.at(j);
            max = std::max(max, X-Y);
         }
      }
   }
   std::cout << max << std::endl;
}



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

// 根付き木の各頂点の親, 深さ, 高さを求める
int root;
#define MAX_N 200001
vector<int> graph[MAX_N];
int par[MAX_N], depth[MAX_N], height[MAX_N]; // 0で初期化
void tree_init(int r){
    root = r;
    par[root] = -1;
    stack<int> st_op, st_cl;
    st_op.push(root);
    while (! st_op.empty()) {
        int t = st_op.top(); st_op.pop();
        st_cl.push(t);
        for (int x: graph[t]) {
            if (x == par[t]) continue;
            depth[x] = depth[t] + 1;
            par[x] = t;
            st_op.push(x);
        }
    }
    while (! st_cl.empty()) {
        int t = st_cl.top(); st_cl.pop();
        for (int x: graph[t]) {
            if (x == par[t]) continue;
            height[t] = max(height[t], height[x] + 1);
        }
    }
}

int main() {
    int N, u, v;
    cin >> N >> u >> v;
    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    tree_init(v);
    int cnt = (depth[u] - 1) / 2;
    for (int i = 0; i < cnt; ++i) {
        u = par[u];
    }
    // 鬼は必ず高さ1の頂点で捕まえる
    int ans = depth[u] + height[u] - 1;
    cout << ans << "\n";
    return 0;
}

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

void solve(){
    int n; cin>>n;
    double ans;
    while(n--){
        int a;
        cin>>a;
        ans+=1.0/a;
    }
    ans = 1.0/ans;
    cout << setprecision(15) << ans << endl;
    

}


int main(){
   solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    map<char,int>mp;
    vector<int>sp(n,1);
    mp[s[0]]=1;
    for(int i=1;i<n;++i){
        sp[i]=sp[i-1];
        if(mp[s[i]]==0){
            sp[i]++;
            mp[s[i]]=1;
        }
    }
    reverse(s.begin(),s.end());
    map<char,int>rmp;
    vector<int>rsp(n,1);
    rmp[s[0]]=1;
    for(int i=1;i<n;++i){
        rsp[i]=rsp[i-1];
        if(rmp[s[i]]==0){
            rsp[i]++;
            rmp[s[i]]=1;
        }
    }/*
    for(auto x:rsp){
        cout<<x<<endl;
    }*/
    int ans=0;
    vector<pair<int,int>>m(10,{0,0});
    reverse(s.begin(),s.end());
    for(int i=1;i<n-1;++i){
        ans+=sp[i-1]*rsp[n-2-i];
        ans-=m[s[i]-'0'].first*rsp[n-2-i];
        m[s[i]-'0']={sp[i-1],rsp[n-2-i]};
        //if(i==1)cout<<rsp[n-2-i];
    }
    cout<<ans;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll X, L;
  vector<pair<ll, ll> > robot(N);
  for(int i=0;i<N;++i) {
    cin>>X>>L;
    robot[i] = mp(X+L, X-L);
  }
  sort(robot.begin(), robot.end());
  int ans = 1;
  int haji = robot[0].fi;
  for(int i=1;i<N;++i) {
    if(robot[i].se<haji) continue;
    haji = robot[i].fi;
    ans++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  map<int, int> mp;
  mp[a]++;
  mp[b]++;
  mp[c]++;

  for (auto e : mp) {
    if (e.second == 1) cout << e.first << endl;
  }

  return 0;
}

Measured memory_bytes: 256
//
// Created on 2019-01-27.
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }

#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

#define PB push_back
#define INF 1e9
#define MOD 1e9+7
#define EPS 1e-9

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    ll takahashi = 0, aoki = 0;

    int N, t;
    cin >> N;
    vector<ll> a(N), b(N);
    vector<pair<ll,ll>> e(N);

    REP(i,N) {
        cin >> t; a[i] = t;
        cin >> t; b[i] = t;
        e[i].first = a[i] + b[i];
        e[i].second = i;
    }

    sort(ALL(e), [](const pair<ll,ll> &r, const pair<ll,ll> &l) {return r.first > l.first;});

    int tarn = 1;
    REP(i,N){
        if (tarn == 1)takahashi += a[e[i].second];
        else aoki += b[e[i].second];
        tarn *= -1;
    }

    cout << takahashi-aoki << endl;

}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
void solve(){
    int m,n,len=0;
    string s,t,ans="";
    cin>>s>>t;
    m=s.size(); n=t.size();
    vector<vector<int>> dp(m+1,vector<int>(n+1));
    for(int i=0;i<=m;i++){
        for(int j=0;j<=n;j++)
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(s[i-1]==t[j-1])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
    int i=m,j=n;
    while(i>0 && j>0){
        if(s[i-1]==t[j-1]){
            ans=s[i-1]+ans;
            i--; j--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
            i--;
        else
            j--;
    }
    cout<<ans;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    solve(); cout<<endl;
    return 0;
}

Measured memory_bytes: 38860
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline void putll(ll x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}

int main(){
  int h = getint(), a = getint();
  putint((h + a - 1) / a,'\n');
  bufo.flush();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C, X;
  cin >>A>>B>>C>>X;
  int ans = 0;
  for(int a=0; a<=A; ++a){
    for(int b=0; b<=B; ++b){
      for(int c=0; c<=C; ++c){
        int total = 500*a + 100*b + 50*c;
        if(total == X) ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import math

def f(a, b, x):
    return math.floor(a*x/b) - 5 * math.floor(x/b)

a, b, n  = map(int, input().split())
max = 0

if b <= n:
    print(f(a, b, b-1))
else:
    print(f(a, b, n))

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi = acos(-1);
#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    ll n; cin >> n;
    vector<ll> A(n);
    vector<pair<ll, ll>> v(n);
    REP(i, n) {
        cin >> A[i];
        v[i] = {A[i], i};
    }
    sort(v.begin(), v.end());
    REP(i, n) {
        A[v[i].second] = i;
    }
    ll cnt = 0;
    REP(i, n) {
        if (i % 2 != A[i] % 2) {
            ++cnt;
        }
    }
    cout << cnt/2 << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define R register int
#define AC 201000

int n, l, r;
int s[AC], ans[AC];

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

void pre()
{
	n = read(), l = 1, r = n;
	for(R i = 1; i <= n; i ++) s[i] = read();
}

void work()
{
	int now = 0;
	for(R i = n; i; i --)
	{
		if(!now) ans[l ++] = s[i];
		else ans[r --] = s[i];
		now ^= 1;
	}
	for(R i = 1; i <= n; i ++) printf("%d ", ans[i]);
}

int main()
{
	//freopen("in.in", "r", stdin);
	pre();
	work();
	//fclose(stdin);
	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T> 
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.ss<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
const int inf = 1e9+10;
const ll INF = 1e18+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;

void solve()
{
	// int n;
	ll n, k, s;
	cin>>n>>k>>s;
	int ans[MAXN];
	if(s == (int)(1e9)){
		int i = 0;
		while(i<k){
			ans[i++] = s;
		}
		while(i<n){
			ans[i++] = 1;
		}
	}	
	else{
		int i = 0;
		while(i < k){
			ans[i++] = s;
		}
		while(i < n){
			ans[i++] = 1e9;
		}
	}
	rep(i,n){
		cout<<ans[i]<<" ";
	}
	cout<<endl;
}
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;

}
    

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
ll x[101];
int main(){
    cin>>N;
    for(ll i=0;i<N;i++){
        cin>>x[i];
    }
    ll ans=INF;
    for(ll i=1;i<=100;i++){
        ll sum=0;
        for(ll j=0;j<N;j++){
            sum+=(x[j]-i)*(x[j]-i);
        }
        ans=min(ans,sum);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
// acdart
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <numeric>
#include <utility>
#include <queue>
#include <memory>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cstdlib>
#include <list>
#include <limits.h>
#include <utility>
#include <functional>
#include <iterator>
#include <deque>
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second
#define F first
#define S second
#define MOD9 1000000009ll
#define MOD7 1000000007ll
#define MOD
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define SZ(x) ((int)(x).size())
#define MAXN 10010
#define MAXM
#define ALL(x) ((x).begin()),((x).end())
#define RESET(a,b) memset(a,b, sizeof a)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define LEN(X) strlen(X)
#define FI(a,b,c) for(int a=b; a<c; a++)
#define FD(a,b,c) for(int a=b; a>c; a--)
using namespace std;
typedef long long ll;
typedef long long LL;
typedef double db;
typedef double D;
typedef long double ld;
typedef long double LD;
/*********default*********/
int a[100010];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a, a + n);
    int loc = a[n - 1], fg = 0;
    long long ans = 1;
    for (int i = n - 2; i >= 0; i--) {
        if (a[i] == a[i + 1]) {
            ans *= a[i];
            i--;
            fg++;
            if (fg == 2) break;
        }
    }
    if (fg != 2) ans = 0;
    printf("%lld\n", ans);
}



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

const int N = 1000 + 10;

int h[N];

int main() {
    h[1] = 1;
    for (int i = 2; i <= 1000; i++) h[i] = h[i - 1] + i;
    int a, b;
    cin >> a >> b;
    int diff = b - a;
    cout << h[diff] - b << '\n';
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(0) cerr << "TR: " << (#X) << " = " << (X) << endl; })

string s;
vvl adj;

struct info {
	ll num_tokens = 0;
	ll min_sum_dist = 0;
	ll max_sum_dist = 0;
};

info dfs(ll i, ll p = -1) {
	vector<info> ch;
	for (ll j: adj[i]) if (j != p) {
		info cur = dfs(j,i);
		cur.min_sum_dist += cur.num_tokens;
		cur.max_sum_dist += cur.num_tokens;
		ch.pb(cur);
	}
	
	info res;
	res.num_tokens = s[i]-'0';
	for (info cur: ch) {
		res.num_tokens += cur.num_tokens;
		res.max_sum_dist += cur.max_sum_dist;
	}
	
	if (sz(ch)) {
		ll k = 0;
		FOR(j,1,sz(ch)) if (ch[j].min_sum_dist > ch[k].min_sum_dist) k = j;
		
		ll sum = ch[k].min_sum_dist;
		FOR(j,0,sz(ch)) if (j != k) sum -= ch[j].max_sum_dist;
		
		if (sum < 0) sum = abs(sum)%2;

		res.min_sum_dist = sum;
	}
	TR(i);
	TR(res.num_tokens);
	TR(res.min_sum_dist);
	TR(res.max_sum_dist);
//	cerr << endl;
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	cin >> s;

	adj.resize(n);
	FOR(i,1,n) {
		ll a, b;
		cin >> a >> b;
		a--, b--;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	ll res = oo;
	FOR(i,0,n) {
		info cur = dfs(i);
		if (cur.min_sum_dist == 0) {
			res = min(res, cur.max_sum_dist / 2);
		}
		//cerr << "---------------------------------------" << endl;
	}
	if (res == oo) res = -1;
	cout << res << endl;
}



Measured memory_bytes: 640
from collections import Counter


n = int(input())
m = list(map(int, input().split()))
a = Counter(m[0::2]).most_common()
b = Counter(m[1::2]).most_common()
a.append([0, 0])
b.append([0, 0])
if a[0][0] != b[0][0]:
  print(n - (a[0][1] + b[0][1]))
else:
  print(min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1])))

Measured memory_bytes: 20700