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

typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define int ll
#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;



void solve() {
	int n,m,k;
	cin >> n >> m >> k;
	int c[n];
	int a[n][m];

	F0R(i, n) {
		int yen; cin >> yen; c[i] = yen;
		F0R(j, m) cin >> a[i][j];
	}

	int minn = INF;
	
	vector<int> v;
	int ok = 0;
	for (int b = 0; b < (1<<n); b++) {
		vector<int> v;
		for (int i = 0; i < n; i++) {
			if (b&(1<<i)) v.push_back(i);
		}
		int skill[m];
		memset(skill, 0, sizeof(skill));
		int cur = 0;
		
		for(auto x: v) {
			cur += c[x];
			F0R(i, m) skill[i] += a[x][i];
		}

		int got = 1;

		F0R(i, m) if(skill[i] < k) got = 0;
		if(got) {
			minn = min(minn, cur);
			ok = 1;
		}
		
	}
	if(ok) cout << minn;
	else cout << "-1";
	
}

int32_t main() {_
	//tc(t)
		solve();
}



Measured memory_bytes: 3656
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int visited[10];
int x[10], y[10];
int n;
long double ans = 0.0;

long double Length(int x1, int y1, int x2, int y2)
{
  return sqrtl((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

void dfs(int now, int rem, long double kyori)
{
  if (rem == 0)
  {
    ans += kyori;
    return;
  }
  rep(i, 1, n + 1)
  {
    if (visited[i])
      continue;
    visited[i] = 1;
    long double add = (now == 0) ? 0 : Length(x[i], y[i], x[now], y[now]);
    dfs(i, rem - 1, kyori + add);
    visited[i] = 0;
  }
  return;
}

int main(void)
{
  scanf("%d", &n);

  rep(i, 1, n + 1)
      scanf("%d %d", &x[i], &y[i]);

  dfs(0, n, 0);

  long double div = 1.0;
  rep(i, 1, n + 1) div *= (long double)i;

  printf("%.10Lf\n", ans / div);
  return 0;
}


Measured memory_bytes: 128
require 'prime'

MOD = 10**9 + 7

def factorial (x)
	(1..x).inject(1, :*)
end

def fact_n (x, n)
	((x-n+1)..x).inject(1, :*)
end

n,m = gets.split.map &:to_i

x = Prime.prime_division(m)

arr = []

result = 1

x.each{ |x_el|
	count = x_el[1]
	sum = fact_n(n + count - 1, count) / factorial(count)
	result = (result * sum) % MOD
}

puts result

Measured memory_bytes: 2300
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

void solve(){
	ll n,m;
	cin>>n>>m;
	ll ans = 0;
	if(n*2 > m){
		cout<<m/2<<endl;
		return;
	}
	ans += n;
	m = m-n*2;
	ans += m/4;
	cout<<ans<<endl;

}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}
	

Measured memory_bytes: 256
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 100005
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	//  WF("output.txt");
	DF("err.txt");

	char s[MAX_N];
	scanf("%s", s);
	int64 sum = 1ll;
	int64 dp3 = 0ll;
	for (int i = 0; s[i]; i++) {
		if (s[i] == '0') {
			dp3 = dp3 * 3ll % MOD;
		}
		else {
			dp3 = (dp3 * 3ll + sum) % MOD;
			sum = (sum << 1) % MOD;
		}
	}
	printf("%lld\n", (sum + dp3) % MOD);
	return 0;
}

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

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> s,c;

    for(int i = 0; i < M; i++)
    {
        bool flagc = false;
        int tmp1,tmp2;
        cin >> tmp1 >> tmp2;
        
        if(tmp1 == 1 && tmp2 == 0 && N != 1)
        {
            cout << "-1" << endl;
            return 0;
        }
        if(i > 0)
        {
            for(int j = 0; j < i; j++)
            {
                if(tmp1 == s[j] && c[j] != tmp2)
                {
                    cout << "-1" << endl;
                    return 0;
                }
                else if(tmp1 == s[j] && c[j] == tmp2)
                {
                    flagc = true;
                }
            }
        }
        if(flagc) continue;

        s.push_back(tmp1);
        c.push_back(tmp2); 
    }

    int ans = 0;

    
    for(int i = 0; i < s.size(); i++)
    {
        ans += pow(10,N-s[i])*c[i];
    }

    if(N == 3 && ans < 100)ans += 100;
    if(N == 2 && ans < 10)ans += 10;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		Map<String,Integer> list = new HashMap<String,Integer>();
		String object = "MARCH";
		int num = sc.nextInt();
		String a[] = {"M","A","R"};
		String b[] = {"M","A","C"};
		String c[] = {"M","A","H"};
		String d[] = {"M","R","C"};
		String e[] = {"M","R","H"};
		String f[] = {"M","C","H"};
		String g[] = {"A","R","C"};
		String h[] = {"A","R","H"};
		String j[] = {"A","C","H"};
		String k[] = {"R","C","H"};
		
		ArrayList<String[]> com = new ArrayList<String[]>();
		com.add(a);
		com.add(b);
		com.add(c);
		com.add(d);
		com.add(e);
		com.add(f);
		com.add(g);
		com.add(h);
		com.add(j);
		com.add(k);
		
		for(int i=0;i<num;i++){
			String value = sc.next();
			String first = value.substring(0,1);
			if(object.contains(first)){
				if(!list.containsKey(first)){
					list.put(first, 0);
				}
				list.put(first , list.get(first) + 1);
			}
		}
		
		if(list.size() < 3){
			System.out.println(0);
		}else{
			long comb = 0;
			for(String[] obj : com){
				 long co = 1;
				for(String ob : obj){
					if(list.containsKey(ob)){
					co = co * list.get(ob);
					}else{
						co = 0;
					}
				}
				comb = comb + co;
			}
			System.out.println(comb);
		}
	}
}

Measured memory_bytes: 45876
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
int main(){
    int a, b;
    cin >> a >> b;
    if(b-a < 0){
        cout << a-1 << endl;
    }else{
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
s = list(input())
nai = 0
gai = 0

for i in s:
  if i == "c":
    print("No")
  elif i == "a":
    if nai+gai < a+b:
      print("Yes")
      nai += 1
    else:
      print("No")
  else:
    if (nai+gai < a+b) and gai < b:
      print("Yes")
      gai += 1
    else:
      print("No")
    

Measured memory_bytes: 56184
c = Array.new(3){Array.new(3)}
3.times do |i|
  c[i] = gets.chomp.split(" ").map(&:to_i)
end
a = []
b = []
a[0] = 0
b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][1] - b[1]
a[2] = c[2][2] - b[2]
equal_c = true
3.times do |i|
  3.times do |j|
    equal_c = false if a[i] + b[j] != c[i][j]
  end
end
if equal_c
  puts "Yes"
else
  puts "No"
end

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

int selectionSort(vector<int>& A, int N){
    int sw = 0;
    int minj;
    for(int i = 0; i < N-1; i++){
        minj = i;
        for (int j = i; j < N; j++){
            if(A.at(j) < A.at(minj)){
                minj = j;
            }
        }
        swap(A.at(i), A.at(minj));
        if (i != minj) sw++;
    }
    return sw;
}

int main() {
    vector<int> A(100);
    int N, sw;
    cin >> N;
    
    for (int i = 0; i < N; i++) cin >> A.at(i);
    sw = selectionSort(A, N);
    for (int j = 0; j < N; j++){
        if (j > 0)  cout << " ";
        cout << A.at(j);
    }
    cout << endl;
    cout << sw << endl;
    
    return 0;
}


Measured memory_bytes: 3100
N, K = list(map(int,input().split()))
r, s, p = list(map(int,input().split()))
T = input()

ans = 0

def sc(st):
    if st == "p":  return s
    elif st == "r":  return p
    return r

for i in range(K):
    pre = T[i]
    cnt = i
    ans += sc(T[i])
    while(1):
        cnt += K
        if cnt >= N: break 
        if T[cnt] == pre:  pre = "#"
        else:  
            ans += sc(T[cnt])
            pre = T[cnt]
print(ans)

Measured memory_bytes: 68332
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};




int main(){
  ll n; cin >> n; 
  ll ans = 0; 
  
  for(ll i=1; i <= n; i++){
    ll a = n/i;
    
    ans += i*a*(a+1)/2;
  }
  
  cout << ans << endl;
  
  
}

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


int main(){
    string str;
    int m,h;
    cin >> str;
    while(str!="-"){
        cin >> m;
        for(int i=0; i<m; i++){
            cin >> h;
            str=str.substr(h,str.size()-h)+str.substr(0,h);         
        }
        cout << str << endl;
        cin >> str;

    }


}


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

using namespace std;
using llint = long long;
using pint = pair<int,int>;

#define LOG(x) cout << "# " << #x <<" => "<< (x) <<endl

const int INF = 1<<28;
const llint LLINF = 1LL<<60;

int h, w, ans=0;
vector<string> s;

int main() {
    // Input
    cin >> h >> w;
     s.resize(h);
     for (int i = 0; i < h; ++i) {
         cin >> s.at(i);
     }

     vector<vector<pint> > c(h, vector<pint>(w, make_pair(1, 1)));

     for (int i = 0; i < h; ++i)
     {
         for (int j = 0; j < w; ++j)
         {
             if (s.at(i).at(j)=='#')
             {
                 c.at(i).at(j) = make_pair(0, 0);
             }
         }
     }

    // Solve
     for (int cx = 0; cx < h; ++cx) {
        for (int cy = 1; cy < w; ++cy)
        {
            if (s.at(cx).at(cy) == '#') continue;

            c.at(cx).at(cy).first += c.at(cx).at(cy-1).first;
        }
     }

     for (int cy = 0; cy < w; ++cy) {
        for (int cx = 1; cx < h; ++cx)
        {
            if (s.at(cx).at(cy) == '#') continue;

            c.at(cx).at(cy).second += c.at(cx-1).at(cy).second;
        }
     }

     for (int cx = 0; cx < h; ++cx) {
        for (int cy = w-2; cy >= 0; --cy)
        {
            if (s.at(cx).at(cy) == '#') continue;

            c.at(cx).at(cy).first = max(c.at(cx).at(cy).first, c.at(cx).at(cy+1).first);
        }
     }

     for (int cy = 0; cy < w; ++cy) {
        for (int cx = h-2; cx >= 0; --cx)
        {
            if (s.at(cx).at(cy) == '#') continue;

            c.at(cx).at(cy).second = max(c.at(cx).at(cy).second, c.at(cx+1).at(cy).second);
        }
     }

     for (int i = 0; i < h; ++i)
     {
         for (int j = 0; j < w; ++j)
         {
            if (s.at(i).at(j) == '#') continue;

            ans = max(ans, c.at(i).at(j).first + c.at(i).at(j).second - 1);
         }
     }

    // Output

     // for (int i = 0; i < h; ++i)
     // {
     //     for (int j = 0; j < w; ++j)
     //     {
     //         cout << "[" << c.at(i).at(j).first << " "  << c.at(i).at(j).second  << "]";
     //     }
     //     cout << endl;
     // }

    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    bool fl = false;
    char c;
    cin >> n;

    for (int i = 0; i < n; i++){
        cin >> c;
        if(c == 'Y'){
            fl = true;
            break;
        }
    }
    if (fl) cout << "Four" << endl;
    else cout << "Three" << endl;
}

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

int main(){
  int n, m, sum, a;
  cin >> n >> m;
  sum = 0;
  for(int i = 0; i < m; i++){
    cin >> a;
    sum += a;
  }
  if(sum > n) cout << -1 << endl;
  else cout << n - sum << endl;
  return 0;
}

Measured memory_bytes: 3672
import sys

ERROR_INPUT = 'input is invalid'


def main():
    n = get_length()
    arr = get_array(length=n)
    print(*arr)

    insetionSort(li=arr, length=n)
    return 0


def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums]


def str2int(string):
    n = int(string)
    if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def insetionSort(li, length):
    for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li)


main()

Measured memory_bytes: 6036
unittest
{
	assert( [ "5", "1 2 1", "1 3 1", "2 4 1", "3 5 1", "3 1", "2 4", "2 3", "4 5" ].parse.expand.solve == "3\n2\n4" );
	assert( [ "7", "1 2 1", "1 3 3", "1 4 5", "1 5 7", "1 6 9", "1 7 11", "3 2", "1 3", "4 5", "6 7" ].parse.expand.solve == "5\n14\n22" );
	assert( [ "10", "1 2 1000000000", "2 3 1000000000", "3 4 1000000000", "4 5 1000000000", "5 6 1000000000", "6 7 1000000000", "7 8 1000000000", "8 9 1000000000", "9 10 1000000000", "1 1", "9 10" ].parse.expand.solve == "17000000000" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto abcs = new long[ 3 ][ n - 1 ];
	foreach( ref abc; abcs )
	{
		input.popFront;
		abc = input.front.split.to!( long[] );
	}
	input.popFront;
	auto qk = input.front.split.to!( long[] );
	auto xys = new long[ 2 ][ qk[ 0 ] ];
	foreach( ref xy; xys )
	{
		input.popFront;
		xy = input.front.split.to!( long[] );
	}
	return tuple( n, abcs, qk[ 1 ], xys );
}

auto solve( long n, long[ 3 ][] abcs, long k, long[ 2 ][] xys )
{
	auto ds = dijkstra( n + 1, abcs, k );
	auto anss = new long[ xys.length ];
	foreach( ref ans, xy; lockstep( anss, xys ) )
	{
		ans = ds[ xy[ 0 ] ] + ds[ xy[ 1 ] ];
	}
	return anss.to!( string[] ).join( "\n" );
}

auto dijkstra( bool directed = false )( long n, long[ 3 ][] es, long s )
{
	import std.container.binaryheap;
	
	auto tss = new Tuple!( long, long )[][ n ];
	foreach( e; es )
	{
		tss[ e[ 0 ] ] ~= tuple( e[ 1 ], e[ 2 ] );
		static if( !directed ) tss[ e[ 1 ] ] ~= tuple( e[ 0 ], e[ 2 ] );
	}
	
	auto ds = new long[ n ];
	ds[] = long.max;
	ds[ s ] = 0;
	auto dc = n;
	auto queue = heapify!( ( a, b ) => b[ 1 ] < a[ 1 ] )( new Tuple!( long, long )[ es.length ], 0 );
	queue.insert( tuple( s, 0L ) );
	while( !queue.empty )
	{
		auto fi = queue.front[ 0 ];
		auto fd = queue.front[ 1 ];
		queue.popFront();
		if( ds[ fi ] < fd ) continue;
		dc--;
		if( dc == 0 ) break;
		foreach( t; tss[ fi ] )
		{
			auto td = fd + t[ 1 ];
			if( ds[ t[ 0 ] ] < td ) continue;
			ds[ t[ 0 ] ] = td;
			queue.insert( tuple( t[ 0 ], td ) );
		}
	}
	return ds;
}


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

int n;

int main(void){
	cin >> n;
	vector<lli> r(n+1);
	r[0] = 2;
	r[1] = 1;
	for(int i = 2; i <= n; i++) r[i] = r[i-1]+r[i-2];
	cout << r[n] << endl;
	return 0;
}


Measured memory_bytes: 3604
#include <vector>
#include <cstring>
#include <map>
#include <algorithm>
#include <cstdio>
using namespace std;

struct data{
	int id,a,p,b;
	data(){}
	data(int idd,int aa,int pp,int bb){
		id=idd;
		a=aa;
		p=pp;
		b=bb;
	}
	bool operator<(const data& d1)const{
		if(a!=d1.a)return a>d1.a;
		if(p!=d1.p)return p<d1.p;
		return id<d1.id;
	}
};

int n;
data dat[301];
int cnt[1001];
int win[28];
int main(void){
	while(1){
		memset(cnt,0,sizeof(cnt));
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%d %d %d %d",&dat[i].id,&dat[i].b,&dat[i].a,&dat[i].p);
		}
		sort(dat,dat+n);
		int wcnt=0;
		for(int i=0;i<n;i++){
			if(wcnt<10 && cnt[dat[i].b]<3){
				cnt[dat[i].b]++;
				win[wcnt++]=dat[i].id;
			}else if(wcnt<20 && cnt[dat[i].b]<2){
				cnt[dat[i].b]++;
				win[wcnt++]=dat[i].id;
			}else if(wcnt<26 && cnt[dat[i].b]<1){
				cnt[dat[i].b]++;
				win[wcnt++]=dat[i].id;
			}
		}
		for(int i=0;i<wcnt;i++){
			printf("%d\n",win[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 1032
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int main()
{
    string s,t,u;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    cin>>u;
    if(u==s)a--;
    else if(u==t)b--;
    cout<<a<<' '<<b<<endl;
    return 0;
}


















Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int x;
  cin >> x;
  
  int ans = 0;
  int a = x / 500;
    
  ans += a * 1000;
  x -= a * 500;
  
  int b = x / 5;
  
  ans += b * 5;
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
string str;
int main()
{
    cin >> str;
    int len = str.length();
    len = len - 8;
    for (int i = 0;i <= len-1;i++)
    {
        cout << str[i];
    }
    cout << endl;
    return 0;
}

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

template <typename T, typename U>
vector<pair<T, U>> prime_factorization(T x)
{
    vector<pair<T, U>> ret;
    for (T i = 2; i * i <= x; i++)
    {
        U count = 0;
        while (x % i == 0)
        {
            count++;
            x /= i;
        }
        if (count > 0)
        {
            ret.push_back(make_pair(i, count));
        }
    }
    if (x != 1)
    {
        ret.push_back(make_pair(x, 1));
    }
    return ret;
}

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

    int ans = 0;
    for (pair<long long, int> p : prime_factorization<long long, int>(N))
    {
        int current = 1;
        while (current <= p.second)
        {
            ans++;
            p.second -= current;
            current++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
##
## a 秒ごとに b 枚のビスケットを生産する。
## t+0.5 秒後のビスケットの枚数を出力する。
## 

(a, b, t) = [ int(v) for v in input().split() ]
if t > 20: raise("limit over")
biscuit = int(((t + 0.5) // a) * b)
print(biscuit)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <map>
#include <set>

using namespace std;

int main(void){
  map<string, set<int> > Index;
  int page;
  string name;
  
  while(cin >> name >> page){
    Index[name].insert(page);
  }
  
  for(map<string, set<int> >::iterator it = Index.begin() ; it != Index.end() ; it++){
    cout << (*it).first << endl;
    
    int i = 0;
    
    for(set<int>::iterator it2 = it->second.begin() ; it2 != it->second.end() ;
	it2++){
      if(it->second.size()-1 != i) cout << *it2 << " ";
      else cout << *it2 << endl;
      i++;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n;

void init(){
	cin>>n;
}

int main(void){
	init();
	cout<<pow(n,3)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		while(in.hasNext())
		{
			int a=in.nextInt(),b=in.nextInt();
			int gcd=gcd(a,b);
			int lcm=a/gcd*b;
			System.out.println(gcd+" "+lcm);
		}
	}
	static int gcd(int a,int b)
	{
		return b==0 ? a : gcd(b,a%b);
	}
}

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

#define rep(i, x, n) for(int i=(x);i<(n);i++)
#define reps(i, x, n) for(int i=(x);i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

//最大公約数
lol gcd(lol x, lol y){ return (y != 0 ? gcd(y, x % y) : x); }
//最小公倍数
lol lcm(lol x, lol y){ return ((x * y) / gcd(max(x, y), min(x, y))); }

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  lol x, sum = 0;
  cin >> x;
  reps(i, 1, x){
    sum += i;
    if(sum >= x){
      cout << i << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3552
using System;
using System.IO;

namespace DefaultNamespace
{
	
	public class Class1
	{
		static int n;//????????°
	static 	int quantum;
	static	int head=0;
	static	int tail;
static		string[] name;
	static	int[] time;
	static	string[] results;
static		int totalTime=0;
	static	int r=0;//results??¨??????????????????
				
		public static void Main(string[] args)
		{
			string nQ=Console.ReadLine();
			string[] nQua=nQ.Split();
			
			n=int.Parse(nQua[0]);
			quantum=int.Parse(nQua[1]);
			
			name=new string[n+1];
			time=new int[n+1];
			results=new string[n];
			tail=n;
			for(int i=0;i<n;i++)//????????????
			{
				string nT=Console.ReadLine();
				string[] nameTime=nT.Split();
				name[i]=nameTime[0];
				time[i]=int.Parse(nameTime[1]);			
				
			}
			//dequeue??§head???tail??¨????????£??????????????????
			while(tail!=head)
			{
				if(time[head]-quantum<=0)
				{
					dequeue(time[head]);
				}
				else enqueue(time[head]-quantum);
			}
			
			var sw = new StreamWriter(Console.OpenStandardOutput())
			{AutoFlush = false};
			Console.SetOut(sw);
			//output??????
			for(int j=0;j<results.Length;j++)
			{
				Console.WriteLine(results[j]);
				
			}
			//???????????§?????? 
			Console.Out.Flush();
		}
		//?????\??????????????????????????¨?????????????????¨???????????????????????????????¨???????????????????
		//head ++
		public static void  dequeue(int time)
		{
			totalTime+=time;
			result(totalTime);
			
			head=isFull(head);
		}
		//?????\?????????????°??????\?????????
		//head ++ tail++
		public static  void enqueue(int remain)
		{
			totalTime+=quantum;
			time[tail]=remain;
			name[tail]=name[head];
			head=isFull(head);
			tail=isFull(tail);
		}
		public static  int isFull(int a)//head tail????¢?????????????????????°???????????????????????????
		{
			if(a==n)
			{
				return 0;
			}
			else 
				return a+1;
		}
		
		public static void result(int total)
		{
			results[r]=name[head]+" "+total.ToString();
			r++;
		}
		
	}
	
}

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

using namespace std;

typedef vector<int> Vec;
typedef vector<Vec> Mat;

int main()
{
    int H,W;
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(cin>>H>>W)
    {
        Mat mat(H,Vec(W)),dp(H,Vec(W));
        for(int i=0;i<H;i++)
        {
            for(int j=0;j<W;j++)
            {
                cin>>mat[i][j];
            }
        }
        int maxW=0;
        for(int i=0;i<H;i++)
        {
            for(int j=0;j<W;j++)
            {
                dp[i][j]=(mat[i][j]+1)%2;
                maxW|=dp[i][j];
            }
        }
        for(int i=1;i<H;i++)
        {
            for(int j=1;j<W;j++)
            {
                if(mat[i][j])
                {
                    dp[i][j]=0;
                }else
                {
                    dp[i][j]=min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1]))+1;
                    maxW=max(maxW,dp[i][j]);
                }
            }
        }
        cout<<maxW*maxW<<endl;
    }

    return 0;
}



Measured memory_bytes: 18332
#include <iostream>

using namespace std;
const int N=1e6+10;
int a[N];
int c0,c1,c2;
int c[100][100];
int C(int n,int m)
{
    // if(n<m)return 1;
    return c[n][m];
}
int lucas(int n,int m)
{
    if(n<2&&m<2){
        return C(n,m)%2;
    }else{
        return C(n%2,m%2)*lucas(n/2,m/2)%2;
    }
}
int main()
{
    int n;
    cin>>n;
    c[0][0]=1;
    for(int i=1;i<=2;i++)
    {
        for(int j=0;j<=i;j++)
        {
            c[i][j]=c[i-1][j-1]+c[i-1][j];
        }
    }
    // for(int i=1;i<=20;i++)
    // {
    //     for(int j=1;j<=i;j++)
    //     {
    //         cout<<(c[i][j]%2==lucas(i,j))<<endl;
    //     }
    // }
    // cout<<l
    // cout<<c[2][1]<<endl;
    char ch;
    scanf("%c",&ch);
    for(int i=0;i<n;i++)
    {
        scanf("%c",&ch);
        a[i]=ch-'1';
        if(a[i]==0)c0++;
        else if(a[i]==1)c1++;
        else c2++;
    }
    // cout<<c0<<' '<<c1<<' '<<c2<<endl;
    int cnt=0;
    for(int i=0;i<n;i++)if(a[i]==1)cnt^=lucas(n-1,i);
    if(cnt){
        cout<<1<<endl;
    }else{
        if(c1){
            cout<<0<<endl;
        }else{
            cnt=0;
            for(int i=0;i<n;i++)if(a[i]==2)cnt^=lucas(n-1,i);
            if(cnt){
                cout<<2<<endl;
            }else{
                cout<<0<<endl;
            }
        }
    }
}

Measured memory_bytes: 4096
from sys import stdin

S = list(stdin.readline().rstrip())
T = list(stdin.readline().rstrip())

result_array = []
count = 0

for i in range(len(S)-len(T)+1):
    count = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            count += 1
    result_array.append(len(T)-count)


print(min(result_array))
    



Measured memory_bytes: 9048
N = int(input())
s = []
temp_sum = 0
A_or_B_count = [0,0]
AB_count = 0
for i in range(N):
	aaa = input()
	temp_sum += aaa.count("AB")
	if aaa[0] == "B" and aaa[-1] == "A":
		AB_count += 1
	elif aaa[-1] == "A":
		A_or_B_count[0] += 1
	elif aaa[0] == "B":
		A_or_B_count[1] += 1
A_or_B_count.sort()
if A_or_B_count[0] + AB_count > A_or_B_count[1]:
	if A_or_B_count[1] == 0:
		print(temp_sum + min(N-1,AB_count - 1))
	else:
		AB_count -= (A_or_B_count[1] - A_or_B_count[0])
		print(temp_sum + min(N-1,AB_count + A_or_B_count[1]))
else:
	print(temp_sum + min(N - 1,A_or_B_count[0] + AB_count))


	

	

Measured memory_bytes: 3064
#pragma optimize("", off)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:36777216")
#include <bits/stdc++.h>

#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define all(v) v.begin(),v.end()
#define pb push_back
#define sz(i) (int)(i.size())
#define setto(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define ld long double
#define inf LONG_MAX
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int mod = 1e9 + 7;
using namespace std;

#ifndef ONLINE_JUDGE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}
template<class T> void smax(T& a, T val) {if (a < val) a = val;}
template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}

//Check N size twiceeeeeeeeeeeeeeeeee, and verify it
const int N = 1e5 + 10;

#define y1 acjdmmc
int n, m;
int p[N], y[N];
std::vector<pair<pii, int> > v;
int rank2[N];
string ans[2*N];
std::vector<int> vec[N];

int32_t main(){_
	
	cin>>n>>m;
	for (int i = 0; i < m; ++i)
	{
		cin>>p[i]>>y[i];
		v.pb({{y[i], p[i]}, i});
	}

	sort(all(v));

	for (int i = 0; i < m; ++i)
	{
		++rank2[v[i].fi.se];
		string y1 = to_string(v[i].fi.se);

		assert(sz(y1) <= 6);
		while(sz(y1) != 6){
			y1 = '0' + y1;
		}
		assert(sz(y1) == 6);

		string x2 = to_string(rank2[v[i].fi.se]);

		assert(sz(x2) <= 6);
		while(sz(x2) != 6){
			x2 = '0' + x2;
		}
		assert(sz(x2) == 6);

		string tt = y1 + x2;
		assert(sz(tt) == 12);
		ans[v[i].se] = (y1 + x2);
	}

	for (int i = 0; i < m; ++i)
	{
		cout<<ans[i]<<endl;
	}

	return 0;
}

Measured memory_bytes: 15472
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(ll key, ll value){
      this->key = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

void knapsack_search(const ll pos, const ll W, const vll& w, const vll& v, vvll& dp){
  if(pos>=v.size()) return;
  if(pos==v.size()-1){
    for(ll i=0; i<min(w[pos], W+1); ++i){
      dp[pos][i] = 0;
    }
    for(ll i=w[pos]; i<=W; ++i){
      dp[pos][i] = v[pos];
    }
    return;
  }
  knapsack_search(pos+1, W, w, v, dp);
  for(ll i=0; i<min(w[pos], W+1); ++i){
    dp[pos][i] = dp[pos+1][i];
  }
  for(ll i=w[pos]; i<=W; ++i){
    dp[pos][i] = max(dp[pos+1][i-w[pos]] + v[pos], dp[pos+1][i]);
  }

  return;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, W;
  cin >> N >> W;
  vll w(N), v(N);
  rep(i, 0, N){
    cin >> w[i] >> v[i];
  }

  vvll dp(N, vll(W+1, 0));

  knapsack_search(0, W, w, v, dp);

  cout << dp[0][W] << "\n";

  return 0;
}

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

vector<int> a[100001];
vector<int> b(100001,-1);
int visited[100001]={0};

void dfs(int node)
{
    visited[node]=1;
    if(a[node].size()==0)
    {
        b[node]=0;
    }
    for(int i=0;i<a[node].size();i++)
    {
        if(b[a[node][i]]>-1)
        {
            if(b[node]<b[a[node][i]]+1)
                b[node]=b[a[node][i]]+1;
        }
        else
        {
            dfs(a[node][i]);
            if(b[node]<b[a[node][i]]+1)
                b[node]=b[a[node][i]]+1;
        }
    }
    
}

int main()
{
    int n,m,i,x,y;
    cin >> n >> m;
    for(i=0;i<m;i++)
    {
        cin >> x >> y;
        a[x].push_back(y);
    }
    for(i=1;i<=n;i++)
    {
        if(visited[i]==0)
            dfs(i);
    }
    cout << *max_element(b.begin(),b.end());
}

Measured memory_bytes: 8576
#include<stdio.h>
#include<string.h>
int main()
{
	char a[52][52];
	int h,w,i,j,p,q,count;
	while(scanf("%d%d",&h,&w)!=EOF)
	{

		for(i=1;i<=h;i++)
        {
            getchar();
            for(j=1;j<=w;j++)
                scanf("%c",&a[i][j]);
        }

		for(i=1;i<=h;i++)
		    for(j=1;j<=w;j++)
		    {
		    	count=48;
		    	if(a[i][j]=='.')
		    	{
		    	    for(p=i-1;p<=i+1;p++)
		                for(q=j-1;q<=j+1;q++)
		                {
		            	    if(a[p][q]=='#') count++;
		                }
                        a[i][j]=count;
		    	}
		    }
		for(i=1;i<=h;i++)
        {
            for(j=1;j<=w;j++)
                putchar(a[i][j]);
            printf("\n");
        }

	}
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int ans=0;
    string S;
    cin>>S;
    int arr[S.size()];
    REP(i,S.size()){
        arr[i] = S[i] - '0';
    }
    for(int i=1;i<S.size();i++){
        if(arr[i]==arr[i-1]){
            if(arr[i]==0){
                arr[i]=1;
                ans++;
            }else{
                arr[i]=0;
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    if (n == m)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

using ll = long long;
const ll amari = 1e9+7;
#define ben(a) a.begin(),a.end()
#define pb(a) a.push_back()

int main(){
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;
	if(e - a > k || e - b > k || e - c > k || e - d > k){
		cout << ":(" << endl;
	}
	else{
		cout << "Yay!" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>

#define PB push_back
#define MP make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1<<60)
#define MOD 1000000007
#define REP(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    if (b - a + 1 > k*2) {
        for (int i = a; i <= a + k - 1; i++)cout << i << endl;
        for (int i = b - k + 1; i <= b; i++)cout << i << endl;
    }
    else {
        for (int i = a; i <= b; i++)cout << i << endl;
    }
    return 0;
}


Measured memory_bytes: 256
s = input()

if (s == "RRR"):
    print(3)
elif (s[0] == s[1] == 'R' or s[1] == s[2] == 'R'):
    print(2)
elif (s[0] == 'R' or s[1] == 'R' or s[2] == 'R'):
    print(1)
else:
    print(0)


Measured memory_bytes: 61092
#include <iostream>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;

const int M = 998244353;
vector<int> to[2000005];

long long dfs(int v) {
  long long res = 1;
  for(int u : to[v]) {
    res = res * dfs(u) % M;
  }
  return (res + 1) % M;
}


int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> p(n);
  for (int i = 0; i < n; ++i) cin >> p[i].first >> p[i].second;
  sort(p.begin(), p.end()); 
  set<pair<int, int>> s;
  
  for (int i = n-1; i >= 0; --i) {
    int x = p[i].first, d = p[i].second;
    while (s.size() && s.begin()->first < x + d) {
      to[i].push_back(s.begin()->second);
      s.erase(s.begin());
    }
    s.emplace(x, i);
  }

  long long ans = 1;
  for (auto r : s) {
    int v = r.second;
    ans = ans * dfs(v) % M;
  }
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 64256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
queue = []
# 山を探す
for i in range(N):
    if B[i] > B[(i+1)%N] + B[(i-1)%N] and B[i] > A[i]:
        queue.append(i)
# 山を崩す
while queue != []:
    p = queue.pop(-1)
    hoge = (B[p] - A[p])//(B[(p+1)%N]+B[(p-1)%N])
    B[p] -= (B[(p+1)%N]+B[(p-1)%N])*hoge
    ans += hoge
    if B[(p+1)%N] > B[p] + B[(p+2)%N] and B[(p+1)%N] > A[(p+1)%N]:
        queue.append((p+1)%N)
    if B[(p-1)%N] > B[p] + B[(p-2)%N] and B[(p-1)%N] > A[(p-1)%N]:
        queue.append((p-1)%N)
if A == B:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 119032
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head


int n;

vi G[100010];
int sz[100010];

vi v;

pi dfs1(int x, int p){
  pi res = pi(0, x);
  YYS(w, G[x]){
    if(w != p){
      pi ret = dfs1(w, x);
      ret.fi++;
      chmax(res, ret);
    }
  }
  return res;
}

int dfs2(int x, int p){
  sz[x] = 1;
  YYS(w, G[x]){
    if(w != p){
      sz[x] += dfs2(w, x);
    }
  }
  return sz[x];
}

void dfs3(int x, int p){
  int chs = -1;
  int cnt = 0;
  YYS(w, G[x]){
    if(w != p){
      if(sz[w] != 1){
        if(chs == -1){
          chs = w;
        } else {
          puts("-1");
          exit(0);
        }
      } else {
        cnt++;
      }
    }
  }
  v.pb(cnt);
  if(chs != -1){
    dfs3(chs, x);
  }
}

int main(){

  n = in();
  REP(i, n-1){
    int a = in() - 1;
    int b = in() - 1;
    G[a].pb(b);
    G[b].pb(a);
  }

  int x = dfs1(0, -1).se;

  dfs2(x, -1);

  v.clear();
  dfs3(x, -1);
  v.back()--;
  v.pb(0);
  
  vi u = v;
  REVERSE(u);

  assert(v[0] == 0);
  assert(u[0] == 0);

  v = min(v, u);

  vi ans(0);
  int cnt = 1;
  YYS(w, v){
    int cur = cnt++;
    REP(i, w){
      ans.pb(cnt++);
    }
    ans.pb(cur);
  }

  // assert(SZ(ans) == n);
  
  REP(i, n){
    if(i != 0){
      printf(" ");
    }
    printf("%d", ans[i]);
  }
  printf("\n");
  
  return 0;
}


Measured memory_bytes: 12664
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
vector<int> compress1(int* v, int n, vector<int> def) {
	vector<int> dic(all(def));
	rep(i, 0, n) dic.push_back(v[i]);
	sort(all(dic));
	dic.erase(unique(all(dic)), dic.end());
	rep(i, 0, n) v[i] = lower_bound(all(dic), v[i]) - dic.begin();
	return dic;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/








int N, K, H[301];
ll dp[301][301][301];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> H[i];

	auto dic = compress1(H, N, { 0 });
	int M = dic.size();

	rep(i, 0, N + 1) rep(k, 0, K + 1) rep(h, 0, M) dp[i][k][h] = infl;
	dp[0][0][0] = 0;

	rep(i, 0, N) {
		rep(k, 0, K) rep(h, 1, M) chmin(dp[i + 1][k + 1][h], min(dp[i][k][h - 1], dp[i + 1][k + 1][h - 1]) + dic[h] - dic[h - 1]);
		rep(k, 0, K) {
			ll mi = infl;
			rrep(h, M - 1, 0) {
				chmin(mi, dp[i][k][h]);
				chmin(dp[i + 1][k + 1][h], mi);
			}
		}
		rep(k, 0, K + 1) rep(h, 0, M) chmin(dp[i + 1][k][H[i]], dp[i][k][h] + max(0, dic[H[i]] - dic[h]));
	}

	ll ans = infl;
	rep(k, 0, K + 1) rep(h, 0, M) chmin(ans, dp[N][k][h]);
	cout << ans << endl;
}







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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long

int main(){
  ll n, t, sa;
  cin >> n >> t;
  ll human[n], result = t;
  list_input(human, n)
  FOR(i, 1, n){
    sa = human[i] - human[i-1];
    if (sa >= t) { //離れてる
      result += t;
    }else{
      result += sa;
    }
  }
  puts(result)
}


Measured memory_bytes: 1792
# ABC094B - Toll Gates
n, m, x = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
lst.append(x)
lst = sorted(lst)
print(min(len(lst[: lst.index(x)]), len(lst[lst.index(x) + 1 :])))

Measured memory_bytes: 3060