akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
using namespace std; 
  
const int MAX = 1000001; 
  
// structure to store queries 
struct Query 
{ 
    int l, r, idx; 
}; 
  
// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 
  
// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 
  
// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 
  
void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
    // initialising bit array 
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
  
    // holds the rightmost index of any number 
    // as numbers of a[i] are less than or equal to 10^6 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
  
    // answer for each query 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        // If last visit is not -1 update -1 at the 
        // idx equal to last_visit[arr[i]] 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
  
        // Setting last_visit[arr[i]] as i and updating 
        // the bit array accordingly 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
  
        // If i is equal to r of any query  store answer 
        // for that query in ans[] 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                     query(queries[query_counter].r + 1, bit, n)- 
                     query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 
  
    // print answer for each query 
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 
  
// driver code 
int main() 
{ 
    int n,q;
    cin>>n>>q;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    Query *queries = new Query[q]; 
    for(int i=0;i<q;i++)
    {
        int le,ri;
        cin>>le>>ri;
        queries[i].l = le-1; 
        queries[i].r = ri-1; 
        queries[i].idx = i; 
    }
    sort(queries, queries+q, cmp); 
    answeringQueries(a, n, queries, q); 
    return 0; 
} 

Measured memory_bytes: 19304
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=998244353;         
const int N=3e3+4;

//dp[i][j] tells the no. of subset formed considering the first i eleements 
//so that their sum is j.

void add_self(int &a,int b)
{
	a+=b;

	if(a>=mod)
	a-=mod;
}

int dp[N][N];

int main()
{
	int n,s;

	scn(n); scn(s);

	//dp[0][0]=1;

	int ans=0;

	for(int i=1;i<=n;i++)
	{
		int val; scn(val);

		for(int j=0;j<=s;j++)
		{
			dp[i][j]=dp[i-1][j];

			if(j-val>=0)
			add_self(dp[i][j],dp[i-1][j-val]);
		}

		dp[i][val]+=i;

		add_self(ans,dp[i][s]);
	}

	pri(ans);

    return 0;
}

Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
  private static final long MOD = 1000_000_000 + 7;
  // Pascal's triangle.
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    if ((X + Y) % 3 != 0) {
      System.out.println(0);
      return;
    }
    // v1=(1,2) * b // Use b times.
    // v2=(2,1) * a // Use a times.
    // (x,y)=(2a+b,a+2b)
    int a = (2 * X - Y) / 3;
    int b = (2 * Y - X) / 3;
    if (a < 0 || b < 0) { // ref. Knight's tour: covers all board if negative vector is allowed.
      System.out.println(0);
      return;
    }
    // a+b C a = (a+b)!/((a+b - a)! a!) = (a+b)! / (b! a!)
    System.out.print(combi0(a, b));
  }

  private static long combi(int a, int b) {
    long ab = 1;
    int large = Math.min(a, b);
    int small = Math.max(a, b);
    for (int i = large + 1; i <= a + b; i++) {
      ab *= i;
      ab %= MOD;
    }
    long div = 1;
    for (int i = 1; i <= small; i++) {
      div *= i;
      div %= MOD;
    }
    return (ab * inv(div)) % MOD;
  }

  // Fermit's small theorem:
  // https://www.geeksforgeeks.org/compute-ncr-p-set-3-using-fermat-little-theorem/
  // http://hos.ac/slides/20130319_enumeration.pdf
  // https://discuss.codechef.com/t/best-known-algos-for-calculating-ncr-m/896/2
  private static long combi0(int a, int b) {
    long[] f = new long[a + b + 1];
    f[0] = 1; // f[N] := N!
    for (int i = 1; i <= a + b; i++) {
      f[i] = (f[i - 1] * i) % MOD;
    }

    return ((f[a + b] * inv(f[a])) % MOD) * inv(f[b]) % MOD;
  }
  // Inverse of n in modular MOD (using Fermat's small theorem).
  // returns n^(MOD-2)
  private static long inv(long n) {
    long rem = MOD - 2;
    long res = 1;
    while (rem > 0) {
      if ((rem & 1) == 1) {
        res *= n;
        res %= MOD;
      }
      rem >>= 1;
      n *= n;
      n %= MOD;
    }
    return res;
  }
}


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

#define FOR(k,m,n) for(int(k)=(m);(k)<(n);(k)++)
#define REP(k,n) FOR((k),0,(n))


struct Vertex {
    long long distance;
    int predecessor;
    vector<int> adjacencyIndices;
};

struct Edge {
    int source;
    int destination;
    int score;
};

template <typename Vertex>
bool Reachable(const Vertex& vertices, int sourceVertexIndex, int destinationVertexIndex) {
    vector<bool> visited(vertices.size(), false);
    vector<int> nextVertexIndices;

    visited[sourceVertexIndex] = true;
    nextVertexIndices.push_back(sourceVertexIndex);
    while (nextVertexIndices.size() != 0) {
        int index = nextVertexIndices.back();
        nextVertexIndices.pop_back();
        const auto& v = vertices[index];
        for (auto& adjacencyIndex : v.adjacencyIndices) {
            if (adjacencyIndex == destinationVertexIndex) {
                return true;
            }
            if (!visited[adjacencyIndex]) {
                visited[adjacencyIndex] = true;
                nextVertexIndices.push_back(adjacencyIndex);
            }
        }
    }
    return false;
}


int main() {
    int N, M, P;
    cin >> N >> M >> P;

    vector<Vertex> vertices(N + 1);
    vector<Edge> edges(M + 1);
    REP(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        edges[i + 1] = { a, b, - (c - P) };
        vertices[a].adjacencyIndices.push_back(b);
    }

    static const long long infinity = 1LL << 40;
    REP(i, N) {
        auto& v = vertices[i + 1];
        if (i == 0) {
            v.distance = 0;
        } else {
            v.distance = infinity;
        }
        v.predecessor = 0;

        // printf("vertex[%d] distance: %d, predecessor: %d\n",
        //        i + 1, vertices[i + 1].distance, vertices[i + 1].predecessor);
    }

    REP(i, N) {
        REP(j, M) {
            auto& edge = edges[j + 1];
            auto& source = vertices[edge.source];
            auto& destination = vertices[edge.destination];
            if (destination.distance > source.distance + edge.score) {
                destination.distance = source.distance + edge.score;
                destination.predecessor = j + 1;
            }
        }
        // REP(j, N) {
        //     printf("[%d] vertex[%d] distance: %d, predecessor: %d\n",
        //            i, j + 1, vertices[j + 1].distance, vertices[j + 1].predecessor);
        // }
    }

    REP(i, M) {
        auto& edge = edges[i + 1];
        auto& source = vertices[edge.source];
        auto& destination = vertices[edge.destination];
        if (source.distance + edge.score < destination.distance) {
            if (Reachable(vertices, 1, edge.source) &&
                Reachable(vertices, edge.source, N)) {
                printf("-1\n");
                return 0;
            }
        }
    }

    int score = -vertices[N].distance;
    if (score < 0) { score = 0; }
    printf("%d\n", score);

    return 0;
}

/*
 * Local Variables:
 * compile-command: "CXXFLAGS='-std=c++14' make main"
 * End:
 */


Measured memory_bytes: 512
k = int(input())
ab = input().split()
a = int(ab[0])
b = int(ab[1])
l = 0
ans = 0

while l < a:
    l += k

while l <= b:
    ans += 1
    l += k

if ans == 0:
    print("NG")
else:
    print("OK")

Measured memory_bytes: 9120
#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

int h, w, sum, mn = 2e9;
int s[55][55];
bool v[55][55];
int dr[4] = {0, 1, 0, -1};
int dc[4] = {1, 0, -1, 0};
queue<int> qr, qc, ql;

int main()
{
    scanf("%d%d", &h, &w);
    for(int i = 1; i <= h; i++)
    {
        string ss;
        cin>>ss;
        ss = ' ' + ss;
        for(int j = 1; j <= w; j++)
        {
            if(ss[j] == '.') s[i][j] = 1, sum++;
        }
    }
    v[1][1] = true;
    qr.push(1), qc.push(1), ql.push(1);
    while(!ql.empty())
    {
        int r = qr.front(), c = qc.front(), l = ql.front();
        qr.pop(), qc.pop(), ql.pop();
        if(!s[r][c]) continue;
        if(r == h && c == w)
        {
            printf("%d", sum - l);
            return 0;
        }
        for(int i = 0; i < 4; i++)
        {
            if(1 <= r + dr[i] && r + dr[i] <= h && 1 <= c + dc[i] && c + dc[i] <= w && !v[r + dr[i]][c + dc[i]])
            {
                v[r + dr[i]][c + dc[i]] = true;
                qr.push(r + dr[i]), qc.push(c + dc[i]), ql.push(l + 1);
            }
        }
    }
    printf("-1");
    return 0;
}


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

int adddig(int num)
{
    int m = 0;
    while (num > 0)
    {
        m += num % 10;
        num /= 10;
    }
    return m;
}
int main()
{
    int n, a, b;
    cin >> n;
    int num = adddig(n);

    if (num == 1)
    {
        cout << 10;
    }
    else
        cout << num;
}


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

int main(void)
{
	char instr[301];
	int i;
	int freq[126];
	int min;
	
	scanf("%s", instr);
	
	memset(freq, 0, sizeof(freq));
	
	i = 0;
	while (instr[i] != '\0'){
		freq[instr[i++]]++;
	}
	
	min = freq['K'];
	if (min > freq['U']){
		min = freq['U'];
	}
	if (min > freq['P']){
		min = freq['P'];
	}
	if (min > freq['C']){
		min = freq['C'];
	}
	
	printf("%d\n", min);

	return (0);
}

Measured memory_bytes: 536
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 6
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	cc := make([][2]int, n)
	for i := 0; i < n; i++ {
		cc[i][0] = getNextInt(scanner)
	}
	for i := 0; i < n; i++ {
		cc[i][1] = getNextInt(scanner)
	}

	// dp[すでに使った集合][すでに使った中で最後に使ったindex] = 転倒数の和
	dp := make([][]int, 1<<uint(n))
	for i := 0; i < 1<<uint(n); i++ {
		dp[i] = make([]int, n)
		for j := 0; j < n && i > 0; j++ {
			dp[i][j] = math.MaxInt32
		}
	}
	for b := 0; b < 1<<uint(n); b++ {
		for i := 0; i < n; i++ {
			if dp[b][i] == math.MaxInt32 {
				continue
			}
			used := 0
			for j := 0; j < n; j++ {
				if b>>uint(j)&1 == 0 {
					continue
				}
				used++
			}
			for j := 0; j < n; j++ {
				if b>>uint(j)&1 != 0 {
					continue
				}
				if b > 0 && cc[i][absint(i-used+1)%2] > cc[j][absint(j-used)%2] {
					continue
				}
				r := 0
				for k := j + 1; k < n; k++ {
					if b>>uint(k)&1 == 1 {
						r++
					}
				}
				if dp[b|1<<uint(j)][j] > dp[b][i]+r {
					dp[b|1<<uint(j)][j] = dp[b][i] + r
				}
			}
		}
	}

	ans := math.MaxInt32
	for i := 0; i < n; i++ {
		if ans > dp[1<<uint(n)-1][i] {
			ans = dp[1<<uint(n)-1][i]
		}
	}

	if ans == math.MaxInt32 {
		ans = -1
	}

	fmt.Fprintln(writer, ans)
}

func absint(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


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

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	
	ll n, D, A;
	cin >> n >> D >> A;

	vector<pair<ll, ll>> vec(n);
	for(auto &p : vec){
		cin >> p.X >> p.Y;
		p.Y = (p.Y + A - 1) / A;
	}

	sort(all(vec));

	ll res = 0;

	vector<ll> covered(n + 1);

	for(int i = 0; i < n; ++i){
		ll x = vec[i].X;
		ll bombs = vec[i].Y;
		ll needed = bombs - covered[i];
		if(needed > 0){
			ll rend = x + 2 * D;
			auto up = upper_bound(all(vec), make_pair(rend, (ll)1e9)) - vec.begin();
			covered[i] += needed;
			covered[up] -= needed;
			res += needed;
		}
		covered[i + 1] += covered[i];

		// cout << covered[i] << " \n"[i == n - 1];
		assert(covered[i] >= bombs);
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 4992
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {

        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };


    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(usize1, usize1); m],
    }
    let mut ab = ab;
    ab.sort_by_key(|i| i.0);
    let ab = ab;

    let ans = ab
        .iter()
        .fold((1, (0, n - 1)), |s, r| {
            if r.0 < (s.1).1 {
                (s.0, (r.0, std::cmp::min((s.1).1, r.1)))
            } else {
                (s.0 + 1, (r.0, r.1))
            }
        })
        .0;
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//sは初めの点、vは頂点size、dは最短距離を求める(初期化はINF),Gは有向グラフ
void dijkdtra(int s, int v, vector<int>& d, whei(edge)& G) {
	priority_queue<Pint, vector<Pint>, greater<Pint>> que;//firstが距離、secondが頂点
	d[s] = 0;//スタートの距離はもちろんzero
	que.push(Pint(0, s));
	while (!que.empty()) {
		Pint p = que.top();
		que.pop();
		int V = p.second;
		if (d[V] < p.first)continue;
		for (int i = 0; i < G[V].size(); i++) {
			edge e = G[V][i];
			if (d[e.to] > d[V] + e.cost) {
				d[e.to] = d[V] + e.cost;
				que.push(Pint(d[e.to], e.to));
			}
		}
	}
}



int main() {
	llint n,a,b;
	cin >> n>>a>>b;
	ll ans = modpow(2,n,mod)-1;
	ans -= c(n, a, mod);
	ans -= c(n, b, mod);
	while (ans < 0)ans += mod;
	ans %= mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    multiset<int> st;
    st.insert(A[0]);

    for (int i = 1; i < N; i++) {
        auto it = st.lower_bound(A[i]);
        if (it == st.begin()) {
            st.insert(A[i]);
        } else {
            it--;
            st.erase(it);
            st.insert(A[i]);
        }
    }

    cout << st.size() << endl;

    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#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 _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  // 連結成分の数を数えるだけ

  int N, M; cin >> N >> M;
  vi X(M), Y(M); int z;
  rep(i,M) cin >> X[i] >> Y[i] >> z;

  vector<vector<int>> G(N);
  vector<int> c(N,-1);

  rep(i,M){
    G[X[i]-1].push_back(Y[i]-1);
    G[Y[i]-1].push_back(X[i]-1);
  }

  int m=1;
  rep(i,N){
    if(c[i]>=0) continue;
    c[i] = m;
    stack<int> s;
    s.push(i);
    while(!s.empty()){
      int t = s.top(); s.pop();
      for(int p : G[t]){
        if(c[p]>=0) continue;
        c[p] = m; s.push(p);
      }
    }
    m++;
  }
  cout << m-1 << endl;
  return 0;
}


Measured memory_bytes: 7672
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,k) = get!(usize, usize);
    let s = get!(String).chars().collect::<Vec<_>>();

    let mut ans = 0;
    for i in 0..n-1 {
        if s[i] == s[i+1] {
            ans += 1;
        }
    }
    println!("{}", min!(ans+2*k, n-1));
}


Measured memory_bytes: 8572
#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;
  cin >> n;
  vector<int> a(n + 1), b(n);
  rep(i, n + 1)
    cin >> a[i];
  rep(i, n)
    cin >> b[i];
  ll ans = 0;
  rep(i, n)
  {
    ans += min(a[i], b[i]);
    if (b[i] > a[i])
    {
      ans += min(a[i+1], b[i] - a[i]);
      a[i+1] = max(0, a[i+1] - (b[i] - a[i]));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
        1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())

print(list[K-1])


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

int main(){
    long long n,cnt=0,t=-(1LL<<60);
    vector<pair<long long,long long>>arm;
    cin >> n;
    arm.resize(n);
    for(long long i=0;i<n;i++){
        long long a,b;
        cin >> a >> b;
        arm.at(i)={a+b,a-b};
    }
    sort(arm.begin(),arm.end());
    for(long long i=0;i<n;i++)
        if(t<=arm.at(i).second){
            cnt++;
            t = arm.at(i).first;
        }
    cout << cnt << endl;
}

Measured memory_bytes: 1792
n=int(input())
moji=str(input())
cnt=0
for i in range(n):
  count = 0
  temp=moji[:i+1]
  lst=[]
  for j in range(i+1):
    if temp[j] in moji[i+1:] and temp[j] not in lst:
      count+=1
      lst.append(temp[j])
  if count > cnt:
    cnt=count
print(cnt)

Measured memory_bytes: 3060
K = int(input())
import heapq
que = [i for i in range(1,10)]
heapq.heapify(que)
for i in range(K):
    now = heapq.heappop(que)
    if now%10 == 0:
        heapq.heappush(que,10*now)
        heapq.heappush(que,10*now+1)
    elif now%10 == 9:
        heapq.heappush(que,10*now+8)
        heapq.heappush(que,10*now+9)
    else:
        heapq.heappush(que,10*now+(now%10))
        heapq.heappush(que,10*now+(now%10)-1)
        heapq.heappush(que,10*now+(now%10)+1)
print(now)

Measured memory_bytes: 56284
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}


int main() {
  int N,K,d;
  cin >> N >> K;
  vector<int> D(10,0);
  rep(i,K) {
    cin >> d;
    D[d]++;}
  rep2(i,N,10000000) {
    bool f=false;
    for (auto j:to_string(i)) {
      if (D[j-'0']) {
        f=true; break;
      }
    }
    if (f) continue;
    else {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <cstdio>
main(){
    long long n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	if(n>1&&b>=a||n==1&&a==b) printf("%lld",(b-a)*(n-2)+1);
	else printf("0");
    return 0;
}

Measured memory_bytes: 128
/**
 *
 * Contest - Problema X: Nome (link)
 *
 * Abridge version.
 *
 * Solution: text
 */
#include <iostream>

#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstring>
#include <algorithm>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2000010 };
const int oo { 2000000007 };

ll xs[MAX];

void solve(int N, int K)
{
    ll ans = oo, dist;

    REP(i, K, N)
    {
        auto a = xs[i - K + 1], b = xs[i];

        if (a * b >= 0)
        {
            dist = max(llabs(a), llabs(b));
            ans = min(ans, dist);
        } else
        {
            dist = min(llabs(a) + 2*llabs(b), 2*llabs(a) + llabs(b));
            ans = min(ans, dist);
        }
//LOG(dist, ' '); LOG(a, ' '); LOG(b, ' '); LOG(ans, '\n');
    }

    cout << ans << endl;
}

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

    int N, K;
    cin >> N >> K;

    REP(i, 1, N)
        cin >> xs[i];

    solve(N, K);

    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    int n, m, a;
    while(cin >> n >> m >> a, n) {
        vector<PIP> v;
        rep(i, m) {
            int h, p, q;
            cin >> h >> p >> q;
            v.pb(PIP(h, P(p, q)));
        }
        sort(all(v), greater<PIP>());

        rep(i, m) {
            if (v[i].se.fi == a) a = v[i].se.se;
            else if (v[i].se.se == a) a = v[i].se.fi;
        }
        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int main()
{




    long long ai,t,n,a,A,b,B,c=0,k,e,f,g;



    cin >> t>> A>>B;

    while(A <= B)

    {
       if(A % t== 0)
       {
           cout << "OK" <<endl;
           return 0;
       }
       A++;
    }

    cout << "NG"<<endl;





return 0;
}

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int H,W;
  char c[60][60];
  cin >> H >> W;
  int cnt=0;
  rep(i,H+2){
    rep(j,W+2){
      if(i==0 || i==H+1 || j==0 || j==W+1){
        c[i][j] = '.';
        continue;
      }
      cin >> c[i][j];
    }
  }
  int vx[4] = {0,1,0,-1};
  int vy[4] = {1,0,-1,0};
  reps(i,1,H+1){
    reps(j,1,W+1){
      //cout << i << " " << j << endl;
      if(c[i][j] == '.')continue;
      bool b = false;
      rep(k,4){
        if(c[i+vy[k]][j+vx[k]] == '#'){
          b = true;
        }
      }
      if(!b){
        cout << "No"<< endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>
#include <numeric>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define lint long long

using namespace std;
int n,A,B,C;
int l[10];
//int a,b,c;
int a,b,c,d;

int main(){
  int ans = 1e7;
  cin >> n >> A >> B >> C;
  REP(i,n) cin >> l[i];

  REP(i,pow(4,n)){
    int id = i;
    vector<int> a,b,c;
    REP(i,n){
      int k = id%4;
      id /=4;
      if(k==0) a.push_back(l[i]);
      if(k==1) b.push_back(l[i]);
      if(k==2) c.push_back(l[i]);
    }
    if(a.size()==0||b.size()==0||c.size()==0) continue;
    ans = min(ans,(int)abs(A-accumulate(a.begin(),a.end(),0))+(int)abs(B-accumulate(b.begin(),b.end(),0))+(int)abs(C-accumulate(c.begin(),c.end(),0))+10*((int)a.size()+(int)b.size()+(int)c.size()-3));
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    map<int,int> mp;
    rep(i,N - 1) {
        cin >> A[i];
        mp[A[i] - 1]++;
    }
    rep(i,N) cout << mp[i] << endl;
    
}

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

using namespace std;

const int mxN = 2e5+5;

int n,q,a,b,x;
int aa[mxN];

bool seen[(int)1e6+1];
bool dblseen[(int)1e6+1];

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

    cin >> n;

    int cnt = 0;
    for(int i=0; i<n; ++i) {
        cin >> aa[i], dblseen[aa[i]] = seen[aa[i]], seen[aa[i]] = true;
    }

    for(int i=0; i<n; ++i) for(int j=1; j*j<=aa[i]; ++j)
        if(aa[i]%j==0) {
            int temp_one = j;
            int temp_two = aa[i]/j;
            if(aa[i]==temp_one && dblseen[temp_one]) {++cnt; break; }
            else if(aa[i]!=temp_one && seen[temp_one]) {++cnt; break; }
            if(aa[i]==temp_two && dblseen[temp_two]) {++cnt; break; }
            else if(aa[i]!=temp_two && seen[temp_two]) { ++cnt; break; }

        }

    cout << (n-cnt) << endl;

    return 0;
}


Measured memory_bytes: 6204
def inputOneLine():
	global S
	S=input()

def inputMaltiLine1():
	global S,N,lines
	N=int(input())
	for i in range(N):
		lines.append(input())

##main#######################################

X=int(input())

#100
yokin= 100
y=0
while 1:
	y+=1
	yokin = int(yokin * 1.01)
	#print(yokin)
	if(yokin >= X):
		break
print(y)

Measured memory_bytes: 9168
#include<stdio.h>
int main()
{int a,b,c,d,e,f;
scanf("%d %d %d %d",&a,&b,&c,&d);
e=a*b;
f=c*d;
if(e>=f)
{printf("%d",e);
}
else{
printf("%d",f);

}

}

Measured memory_bytes: 128
#import sys
N = input()
arr = list(map(int,raw_input().split()))
dp = [-1 for i in range(N)] #dp[i] will hold the minimum possible cost for reaching the Nth stone. Right now they are all INT_MAX

dp[N-1] = 0
dp[N-2] = abs(arr[N-1] - arr[N-2])

i = N-3

while(i>=0):
    dp[i] = min(abs(arr[i+1]-arr[i])+dp[i+1],abs(arr[i+2]-arr[i])+dp[i+2])
    #print dp
    i-=1

print dp[0]




Measured memory_bytes: 11168
# a < b + c
# b < a + C
# c < a + b

# 4 3 2 1
# a b c 

# abs(a - b) < c < a + b
# a < b < c
# b - a < b < c
# c < a + b 

from math import ceil, floor
from bisect import bisect_left, bisect_right

def solution(N, data): # O(N^2 * logN)
    data.sort()
    c = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            c += bisect_left(data, data[i] + data[j], j) - j - 1

    return c

if __name__ == '__main__':
    N = int(input())
    L_i = list(map(int, input().split()))
    a = solution(N, L_i)
    print(a)



Measured memory_bytes: 3188
from math import atan, pi
a, b, x = map(int, input().split())
if b / 2 >= x / a ** 2:
    print(atan((a * b ** 2) / (2 * x)) / pi * 180)
else:
    p = 2 * b - (2 * x) / (a ** 2)
    print(atan(p / a) / pi * 180)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>

typedef struct UnionFind{
  int *parent;
  int n;
} UnionFind;

UnionFind* newUnionFind(int n){
  UnionFind *u=(UnionFind *)calloc(1,sizeof(UnionFind));
  u->parent=(int *)calloc(n,sizeof(int));
  u->n=n;
  for(int i=0;i<n;i++) u->parent[i]=-1;
  return u;
}

void initUnionFind(UnionFind *u){
  for(int i=0;i<u->n;i++) u->parent[i]=-1;
}

int root(UnionFind *u,int x){
  int index[32];
  int len=0;
  while(u->parent[x]>=0){
    index[len++]=x;
    x=u->parent[x];
  }
  while(len--) u->parent[index[len]]=x;
  return x;
}

int same(UnionFind *u,int x,int y){
  return root(u,x)==root(u,y);
}

int getSize(UnionFind *u,int x){
  return -u->parent[root(u,x)];
}

void unite(UnionFind *u,int x,int y){
  x=root(u,x);
  y=root(u,y);
  if(x==y) return;
  if(u->parent[x]>u->parent[y]){
    int swap=x;
    x=y;
    y=swap;
  }
  u->parent[x]+=u->parent[y];
  u->parent[y]=x;
}

typedef long long int int64;

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  int *a=(int *)calloc(m,sizeof(int));
  int *b=(int *)calloc(m,sizeof(int));
  int i;
  for(i=0;i<m;i++){
    scanf("%d%d",a+i,b+i);
    a[i]--;
    b[i]--;
  }
  UnionFind *u=newUnionFind(n);
  int64 *dp=(int64 *)calloc(m,sizeof(int64));
  for(i=m-1;i>=0;i--){
    if(same(u,a[i],b[i])) continue;
    dp[i]=(int64)getSize(u,a[i])*getSize(u,b[i]);
    unite(u,a[i],b[i]);
  }
  for(i=1;i<m;i++) dp[i]+=dp[i-1];
  for(i=0;i<m;i++) printf("%lld\n",dp[i]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 3200
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()
    println(problem143c(n, s))
}

fun problem143c(n: Int, s: String): Int {
    var ans = 1
    var current = s[0]
    for (i in 0 until n) {
        if (current != s[i]) {
            ans++
            current = s[i]
        }
    }
    return ans
}

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

using namespace std;

int solve(vector<int>& v) {
  sort(v.begin(), v.end());
  auto mn = INT_MAX;
  for (auto i = 1; i < v.size(); ++i) mn = min(v[i] - v[i - 1], mn);
  return mn;
}

int main() {
  int n;
  while(cin >> n, n) {
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    cout << solve(v) << endl;
  }
}


Measured memory_bytes: 3144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		Map<Integer,Integer> map = new HashMap<>();
		for(int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if(map.containsKey(x)) {
				map.put(x, map.get(x)+1);
			}else {
				map.put(x, 1);
			}
		}
		List<Integer> list = new ArrayList<>(map.values());
		Collections.sort(list);
		int ans = 0;
		for(int i = 0; i < list.size()-k; i++) {
			ans += list.get(i);
		}
		System.out.print(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 69448
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {

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

    static class Task {


        public void solve(int testNumber, InputReader in, PrintWriter out) {

            String n = in.next();
            out.println(n.charAt(0) == n.charAt(2) ? "Yes" : "No");
        }

    }


    static class InputReader implements AutoCloseable {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

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

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return "";
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public void close() {
        }

    }
}


Measured memory_bytes: 21460
// #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
void solve(){
    ll r;
    cin>>r;
    cout << r+r*r+r*r*r << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
} 

Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}







int main(){
    int N, M, S;
    const int m(100000);
    //dp[i][j] := iこの数字で総和j
    while(1){
        std::cin >> N >> M >> S;
        if(!N) break; 
        std::vector<std::vector<int>> dp(N*N+1 ,std::vector<int>(S+1));
        dp[0][0] = 1;
        for(int i(1), i_len(N*N); i <= i_len; ++i){
            for(int j(0); j <= S; ++j){
                if(i <= j) dp[i][j] += dp[i][j-i] + dp[i-1][j-i];
                if(j-M-1 >= 0) dp[i][j] -= dp[i-1][j-M-1];
                dp[i][j] %= m;
                if(dp[i][j] < 0) dp[i][j] += m;
            }
        }
        std::cout << dp[N*N][S] << "\n";
    }
    return 0;
}



Measured memory_bytes: 3320
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    Num[] a = new Num[N];
    for (int i = 0; i < N; i++) a[i] = new Num(i, scanner.nextInt());

    Arrays.sort(a, Comparator.comparingInt(num -> num.val));
    int cnt = 0;
    for (int i = 0; i < N; i++) {
      cnt += Math.abs(a[i].pos - i) % 2;
    }
    System.out.println(cnt / 2);
  }

  private static class Num {
    private final int pos;
    private final int val;

    private Num(int pos, int val) {
      this.pos = pos;
      this.val = val;
    }
  }
}


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

int main(){
int d,n;

cin >> d >> n;

if(d==0) {
if(n==100) cout << n+1;
else cout << n;
}

else if(d==1) {
if(n==100) cout << n*100+100;
else cout << n*100;
}
else{
if(n==100) cout << n*10000+10000;
else cout << n*10000;
}

}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#define INF 1e8
#define MAX_N 110
using namespace std;
int t[MAX_N];
int start[MAX_N];
int dp[MAX_N][MAX_N];
int max_day, T, N;
int solve(int i, int j)
{
    if(i == max_day + 1) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    int ret = INF;
    for(int k = 0; k < T; k++)
    {
        if(t[j] <= start[i])
        {
            ret = min(ret, solve(i + 1, (j + 1) % T));
        }
        ret = min(ret, solve(i + 1, 1) + 1);
    }
    return dp[i][j] = ret;
}
int main()
{
    while(cin >> T, T)
    {
        for(int i = 0; i < T; i++) cin >> t[i];
        memset(dp, -1, sizeof(dp));
        cin >> N;
        int d, m;
        for(int i = 0; i < MAX_N; i++) start[i] = INF;
        for(int i = 0; i < N; i++)
        {
            cin >> d >> m;
            d--;
            start[d] = min(start[d], m);
            max_day = max(d, max_day);
        }
        int ans = solve(0, 0);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3136
#include <stdio.h>

int count(int n, int s, int i, int sum){
	if(n == 0 && sum == s){
		return 1;
	}else if(i > 9){
		return 0;
	}
	return count(n-1, s, i+1, sum+i) + count(n, s, i+1, sum);
}

int main(void){
	int n, s;
	bool use[10];
	while(true){
		scanf("%d %d", &n, &s);
		if(n==0 && s==0){ break; }
		printf("%d\n", count(n, s, 0, 0));
	}
	return 0;
}

Measured memory_bytes: 0