akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int,int> m1,m2;
    vector<int> save1,save2;
    for(int i = 0; i<n; i+=2){
        if(m1[a[i]] == 0) save1.push_back(a[i]);
        m1[a[i]]++;
    }
    for(int i = 1; i<n; i+=2){
        if(m2[a[i]] == 0) save2.push_back(a[i]);
        m2[a[i]]++;
    }
    vector<pair<int,int>> p,q;
    p.push_back(make_pair(0,0));
    q.push_back(make_pair(0,0));
    for(int i: save1) p.push_back(make_pair(m1[i],i));
    for(int i: save2) q.push_back(make_pair(m2[i],i));
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    if(p[0].second != q[0].second) cout << n - p[0].first - q[0].first << endl;
    else cout << n - max(p[0].first+q[1].first, p[1].first+q[0].first) << endl;
    return 0;
}


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

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

	if ( n[n.length() -1] == '3' ){
		cout << "bon" << endl;
	}else if( n[n.length() -1] == '0' || n[n.length() -1] == '1' || n[n.length() -1] == '6' || n[n.length() -1] == '8'){
		cout << "pon" << endl;
	} else {
		cout << "hon" << endl;
	}

	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }

const int MOD = 1000000007;

int main() {
    int H, A;
    cin >> H >> A;
    double res = H;
    res /= A;
    res = ceil(res);
    cout << (int)(res) << endl;
    return 0;
}


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ACurtain {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int a, b; cin >> a >> b;
      cout << max(0, a-(b*2)) << endl;
    }
};

signed main() {
  ACurtain solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
while True:
    n=int(input())
    if n==0:break
    res={}
    li=[]
    for i in range(n):
        d=[int(num) for num in input().split(' ')]
        if d[0]-1 in res:
            res[d[0]-1]+=d[1]*d[2]
        else:
            res[d[0]-1]=d[1]*d[2]
            li.append(d[0]-1)
    flag=False
    for i in li:
        if res[i]>=1000000:
            print(i+1)
            flag=True
    if flag==False:print("NA")

Measured memory_bytes: 7756
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)

/*
bool isprime(int x){
	for(int i = 2;i*i<=x;i++){
		if(x%i == 0)return false;
	}
	return x!=1;
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    if (a == b) 
        return a; 
   
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 
void dfs(int x,int y){
		if(x == n+1){
			int tmp = 0;
			FOR(i,0,k){
				if(tmp1[mortyy[i]]-tmp1[morty[i]] == mortyyy[i])tmp+=mortyyyy[i];
			}
			rick = max(rick,tmp);
			return ;
		}
		int i;
		for(i = y;i<=n1;i++){
			tmp1[x] = i;
			dfs(x+1,i);
		}
	}
*/


//3111111111111111111111111111111


	void solve(){

		ini(n);
		ini(n1);
		if(n == 0){
			if(n1!=100)return out(n1);
			else return out(101);
		}
		if(n == 1){
			if(n1 != 100)return out(n1*100);
			else return out(10100);
		}
		if(n == 2){
			if(n1 != 100)return out(n1*10000);
			else return out(1010000);
		}











	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

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

using namespace std;


int main() {
  
    long int n;
    scanf("%ld",&n);
  set<long int > s;
  long int a[n],i,j;
  for(i=0;i<n;++i)
  {
    scanf("%ld",&a[i]);
    
  }
  
  
  for(i=0;i<n;++i)
     {
         if(s.size()==0)
             s.insert(a[i]);
             
         else
           {  
               if(s.count(a[i])==1)
                   {
                       auto it=s.find(a[i]);
                       s.erase(it);
                   }
                   
               else
                 s.insert(a[i]);
         
             }
     }
  
  cout<<s.size();
  
    	return 0;
} 

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int h;
int f(int n){
	if (n == 1) return 1;
	return 1 + 2*f(n/2);
}
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> h;
	cout << f(h) << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N, M = [int(x) for x in readline().rstrip().split()]
A = []
B = [0] * M
for _ in range(N):
    temp = [int(x) for x in readline().rstrip().split()]
    A.append(temp[1:])
for i in A:
    for j in i:
        B[j-1] += 1
B = np.array(B)
cnt = np.count_nonzero(B == N)
print(cnt)

Measured memory_bytes: 12448
#include<bits/stdc++.h>
#define LL long long
#define endl '\n'
using namespace std;
const LL MOD = 1e9+7;
const LL INF = 1e9+7;


int main(){

	int n;
	cin>>n;
	int ans = 0;
	while(n--){
		int x;
		cin>>x;
		if(x % 2 != 0)ans++;
	}
	if(ans % 2 == 0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
	
}


Measured memory_bytes: 256
n = int(input())
v = list(input().split())
from collections import Counter
x, y = list(Counter(v[::2]).most_common(3)), list(Counter(v[1::2]).most_common(3))
x.sort(key=lambda i:i[1], reverse=True)
y.sort(key=lambda i:i[1], reverse=True)
r = []
for a, b in x[:max(len(x), 3)]:
    for aa, bb in y[:max(len(y), 3)]:
        if a == aa:
            r.append(n-max(b, bb))
        else:
            r.append(n-b-bb)
print(min(r))

Measured memory_bytes: 99348
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int N,A,B,C;
int D[111];
main(){
  scanf("%d",&N);
  scanf("%d %d",&A,&B);
  scanf("%d",&C);
  for(int i=0;i<N;i++){
    scanf("%d",&D[i]);
  }
  sort(D,D+N);
  int res=C/A;
  int sum=C;
  for(int i=N-1,j=1;i>-1;i--,j++){
    sum+=D[i];
    res=max(res,sum/(A+j*B));
  }
  printf("%d\n",res);
}

Measured memory_bytes: 1040
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = 1;
        int cnt = 0;
        
        while(b > sum) {
        	
        	if(cnt >=1) {
        		sum += a-1;
        	} else {
        		sum += a;
              sum--;
        	}
        	cnt++;
        	
        }


        System.out.println(cnt);
        
        sc.close();
    }
}


Measured memory_bytes: 22996
class uf_tree:
    def __init__(self, n):
        self._size = n
        self.sizes = [1] * n
        self.par = list(range(n))
 
    def find(self, x):
        if x == self.par[x]:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]
 
    def unite(self, x, y):
        self._size -= 1
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.sizes[x] < self.sizes[y]:
            x, y = y, x
        self.par[y] = x
        self.sizes[x] += self.sizes[y]
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
    def size(self, x):
        return self.sizes[self.find(x)]


n, m = map(int, input().split())
uf = uf_tree(n+1)

for _ in range(m):
    x, y, z = map(int, input().split())
    if uf.same(x, y):
        continue
    uf.unite(x, y)

print(uf._size - 1)


Measured memory_bytes: 78168
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        int N=sc.nextInt();
        Map<Integer,Integer> count=new HashMap<>();
        for(int i=0;i<N;i++){
            int A=sc.nextInt();
            if(!count.containsKey(A)){
                count.put(A,1);
            }
            else{
                count.remove(A);
            }
        }
        System.out.println(count.size());
    }
}

Measured memory_bytes: 62132
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#include "atcoder/all"

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};

int main() {
    int n, s;
    cin >> n >> s;
    vector<int> v(n);
    rep(i, n) cin >> v[i];

    vector<vector<mint>> dp(n + 1, vector<mint>(s + 1, 0));
    dp[0][0] = 1;

    auto add = [&](int i, int j, mint value) {
        if (j > s) return;
        dp[i][j] += value;
    };

    rep(i, n) {
        rep(j, s + 1) {
            mint from = dp[i][j];
            add(i + 1, j + v[i], from);
            add(i + 1, j, from);
            add(i + 1, j, from);
        }
    }
    cout << dp[n][s] << endl;
}


Measured memory_bytes: 73676
r1, c1, r2, c2 = map(int, input().split())


mod = 10**9 + 7
fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, r2+c2+5):
    fac.append(fac[i-1] * i % mod)
    inv.append(mod - inv[mod%i] * (mod//i) % mod)
    finv.append(finv[i-1] * inv[i] % mod)

def nck(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod


def comb_sum(i, j):
    return nck(i+j+2, i+1)

print((comb_sum(c2, r2) - comb_sum(c2, r1-1) - comb_sum(c1-1, r2) + comb_sum(c1-1, r1-1)) % mod)


Measured memory_bytes: 133096
n, t = gets.split.map(&:to_i)
events = []
n.times do
  l, r = gets.split.map(&:to_i)
  events << [l, +1]
  events << [r, -1]
end
events.sort_by!(&:first)
k = 0
best = 0
until events.empty?
  t = events[0][0]
  while !events.empty? && events[0][0] == t
    _, diff = events.shift
    k += diff
  end
  best = k if k > best
end
p best


Measured memory_bytes: 25176
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	register int x=0;
	register char ch=getchar();
	while(ch<'0'||ch>'9')	ch=getchar();
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x;
}
const int N=1e6+5;
const int P=998244353;
int n,m,now,a[N],b[N],c[N],vi[N];
long long f(int T){
	int k=m/T,sum=0,ans=0;
	for(int i=1;i<=k;i++)	sum=(sum+1LL*i*a[i*T])%P;
	for(int i=1;i<=k;i++){
		sum=(sum-1LL*i*a[i*T]%P+P)%P;
		ans=(ans+1LL*sum*i%P*a[i*T]%P)%P;
	}
	return ans;
}
int main(){
	n=read(),b[1]=1;
	for(int i=1,x;i<=n;i++)
		++a[x=read()],m=max(m,x);
	for(int i=2;i<=m;i++){
		if(!vi[i])	c[++now]=i,b[i]=-1;
		for(int j=1;j<=now&&c[j]*i<=m;j++){
			vi[c[j]*i]=1;
			if(i%c[j]==0)	break;
			else	b[i*c[j]]=-b[i];
		}
	}
	for(int i=1;i<=m;i++)	c[i]=(P+b[i]*i)%P;
	for(int i=m;i;i--)
		for(int j=i*2;j<=m;j+=i)	c[j]=(c[j]+c[i])%P;
	long long ans=0;
	for(int i=1;i<=m;i++)	ans=(ans+1LL*a[i]*(a[i]-1)/2*i)%P;
	for(int i=1;i<=m;i++)	ans=(ans+i*f(i)%P*c[i])%P;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 15872
def main():

    n = int(input())
    a = []
    for i in range(2):
        aa = list(map(int,input().split()))
        a.append(aa)

    ans = [[0] * n for i in range(2)]
    for i in range(n):
        ans[0][i] = a[0][i]
        if i != 0:
            ans[0][i] += ans[0][i-1]
    ans[1][0] = ans[0][0] + a[1][0]
    for i in range(1, n):
        ans[1][i] = max(ans[0][i], ans[1][i-1]) + a[1][i]
    print(ans[1][n-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
package main

import (
	"fmt"
	"time"
)

func main() {
	var s string
	fmt.Scan(&s)

	t1,_ := time.Parse("2006/01/02",s)
	t2,_ := time.Parse("2006/01/02","2019/04/30")
	if t1.After(t2) {
		fmt.Println("TBD")
	} else {
		fmt.Println("Heisei")
	}
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <string>
#include <tuple>
#include <climits>
#include <cmath>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
const int INF = 987654321;
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};
int main(){
    int n;
    int pay = 1000;
    cin >> n;
    if(n%pay != 0)
        cout << pay-n%pay << endl;
    else
        cout << 0 << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define INF (1 << 29)
typedef long long ll;
int main(){
  int n;
  ll cost[11][11], town[11];
  int from, to, t;
  while(cin >> n, n){
    for(int i = 0 ; i < 11 ; i++){
      town[i] = 0;
      for(int j = 0 ; j < 11 ; j++){
	cost[i][j] = INF;
	if(i == j) cost[i][j] = 0;
      }
    }

    int min_town=11, max_town=0;
    
    while(n--){
      cin >> from >> to >> t;
      min_town = min(min_town, min(from, to));
      max_town = max(max_town, max(from, to));
      cost[from][to] = t;
      cost[to][from] = t;
    }

    for(int k = min_town ; k <= max_town ; k++){
      for(int i = min_town ; i <= max_town ; i++){
	for(int j = min_town ; j <= max_town ; j++){
	  cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
	}
      }
    }
	
    ll min_t = INF;
    for(int i = min_town ; i <= max_town ; i++){
      for(int j = min_town ; j <= max_town ; j++){
	town[i] += cost[i][j];
      }
      min_t = min(min_t, town[i]);
    }
  
    for(int i = min_town ; i <= max_town ; i++){
      if(town[i] == min_t){
	cout << i << ' ' << min_t << endl;
	break;
      }
    }
  }
  return 0;
}


    

Measured memory_bytes: 0
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>

int main()
{
  bool ret = true;
  char lose_cnt=0, i=0, buffer[16];

  fgets(buffer, 16, stdin);

  for(i=0; i<strlen(buffer); i++){
	if(buffer[i] == 'x'){
      lose_cnt++;
      if(lose_cnt >= 8){
        ret = false;
        break;
      }
    }
  }

  if(ret){
	printf("YES");
    return 0;
  }

  printf("NO");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<int,int> P;
const int MAX=1<<30;
class RMQ{
public:
  int n;
  P dat[555555];
  void init(int _n){
    n=1;
    while(n<_n)n*=2;
    for(int i=0; i<2*n; i++) dat[i]=P(MAX,-1);
  }
  void update(int k,P a){
    k+=n-1;dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  P query(int a,int b){return query(a,b,0,0,n);}
  P query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return P(MAX,-1);
    if(a<=l&&r<=b) return dat[k];
    P vl=query(a,b,k*2+1,l,(l+r)/2);
    P vr=query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
};
class BIT{
public:
  int n,bit[555555];
  BIT(){fill(bit,bit+555555,0);}
  void add(int i,int x){
    while(i<=n){
      bit[i]+=x;
      i+=i&-i;
    }
  }
  int sum(int i){
    int s=0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }
};
RMQ t;
BIT b=BIT();
int main() {
  string s,ans="";
  int x;
  cin >> s >> x;
  int n=s.size();
  t.init(n);
  b.n=n;
  for(int i=0; i<n; i++) t.update(i,P(s[i]-'a',i));
  for(int i=0; i<n; i++) b.add(i+1,1);
  int k=0;
  for(int i=0; i<n; i++) {
    while(t.query(k,k+1).F==MAX) k++;
    int l=k,r=n;
    while(l+1<r) {
      int m=(l+r)/2;
      if(b.sum(m)-b.sum(k+1)>=x) r=m;
      else l=m;
    }
    P p=t.query(k,r);
    ans+=(char)(p.F+'a');
    x-=b.sum(p.S+1)-b.sum(k+1);
    t.update(p.S,P(MAX,-1));
    b.add(p.S+1,-1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9984
#include "bits/stdc++.h"
using namespace std;
#define MAX 100005
int n;
int a[3*MAX];

int main()
{
    scanf("%d", &n);
    for(int i = 1 ; i <= 3*n ; i++)
    {
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + 3*n + 1);
    long long int ans = 0;
    for(int i = n + 1 ; i <= 3*n ; i+=2)
    {
        ans += a[i];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>

int main()
{
int x,n,min,max;
long w;
scanf("%d",&n);
x=min=max=NULL;
w=0;
for(int i=0;i<n;i++)
{
scanf("%d",&x);
if(i==0){max=x;min=x;}

if(x<min)min=x;
if(x>max)max=x;
w=w+(long)x;
x=0;
}
printf("%d %d %ld\n",min ,max ,w);
return 0;
}

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

int main() {
	int A, B, ans = 0;
	cin >> A >> B;

	for (int i = 0; i <= B - A; i++) {
		int Q = A + i;
		string S = to_string(Q);
		
		if (S[0] == S[4] && S[1] == S[3]) {
			ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
/*************************
author : coldbeer
2019-06-07 5:20:51 PM
*************************/
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"

typedef long long ll;
const ll inf = 1e18;
ll cache[(int)1e5 + 5];

ll solve(int i,vector<ll> &h,int n){
    if(i == n)
        return 0;
    if(i > n)
        return inf;
    if(cache[i] != -1)
        return cache[i];
    ll a = inf;
    ll b = inf;
    if(i + 1 < n)
        a = min(a,abs(h[i] - h[i + 2]) + solve(i + 2,h,n));
    if(i < n)
        b = min(b,abs(h[i] - h[i + 1]) + solve(i + 1,h,n));
    cache[i] = min(a,b);
    return cache[i];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> h(n + 1);
    for (int i = 1; i < n + 1; i++)
        cin >> h[i];
    memset(cache,-1,sizeof(cache));
    cout << solve(1,h,n) << endl;
    return 0;
}


Measured memory_bytes: 5760
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
    string[] input = Console.ReadLine().Split(' ');
    long n = long.Parse(input[0]);
    long m = long.Parse(input[1]);
    long p = long.Parse(input[2]);

    long[,] edges = new long[m,3];//ここに受け取る
    for(int i = 0; i < m; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);//１行ごとに受け取る
      edges[i,0] = nums[0]-1;
      edges[i,1] = nums[1]-1;
      edges[i,2] = -nums[2]+p;
    }

    long answer = BellmanFord(n, edges, 0, n-1);
    Console.WriteLine((answer != long.MaxValue-1)? Math.Max(0,-answer):-1);
	}

  static long BellmanFord(long vertexCount, long[,] edges, long startVertex, long goalVertex)
  {//負の有向辺があっても良い最短距離をO(頂点数*辺数)で返す。
  //引数は頂点数、辺[始点(0-index)、終点、長さ]、始点、終点
  //たどり着けない時はlong.MaxValue, 存在しない（負のループがある）時は(long.MaxValue-1)を返す。
    long n = vertexCount;
    long e = edges.GetLength(0);
    long[] distances = new long[n];//最短距離
    bool[] negatives = new bool[n];//負のループ
    long answer = 0;

    for(long i = 0; i < n; i++)
    {
      distances[i] = long.MaxValue;
    }
    distances[startVertex] = 0;

    for(long i = 0; i < n; i++)//全頂点について、最短距離の更新
    {
      for(long j = 0; j < e; j++)
      {
        if(distances[edges[j,0]] == long.MaxValue) continue;

        distances[edges[j,1]] = Math.Min(distances[edges[j,1]], distances[edges[j,0]] + edges[j,2]);
      }
    }
    answer = distances[goalVertex];

    for(long i = 0; i < n; i++)
    {
      for(long j = 0; j < e; j++)
      {
        if(distances[edges[j,0]] == long.MaxValue) continue;

        if(distances[edges[j,1]] > distances[edges[j,0]] + edges[j,2])//最短距離の更新をしたのに最短がまだ含まれる
        {
          distances[edges[j,1]] = distances[edges[j,0]] + edges[j,2];
          negatives[edges[j,1]] = true;
        }

        if(negatives[edges[j,0]] == true)//先が負のループならば
        {
          negatives[edges[j,1]] = true;//後も負のループ
        }
      }
    }

    if(negatives[goalVertex]) return (long.MaxValue-1);
    return answer;
  }
}

Measured memory_bytes: 13308
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m; cin >> n >> m;

    ll x[m], y[m], z[m];
    rep(i, m){
        cin >> x[i] >> y[i] >> z[i];
        x[i]--; y[i]--;
    }

    vector<ll> g[n];
    rep(i, m){
        g[ x[i] ].push_back(y[i]);
        g[ y[i] ].push_back(x[i]);
    }

    bool isUsed[n] = {};

    ll cnt = 0;
    rep(i, n){
        if(isUsed[i]) continue;

        cnt++;
        queue<ll> que;
        que.push(i);
        
        while(!que.empty()){
            ll now = que.front();
            que.pop();
            isUsed[now] = true;

            rep(j, g[now].size()){
                ll nxt = g[now][j];
                if(isUsed[nxt]) continue;

                que.push(nxt);
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 9844
#include<stdio.h>
 
void swap(int *x, int *y);
 
int main()
{
  while(1)
    {
      int a, b;
      scanf("%d %d",&a ,&b);
      if(a == 0 && b == 0) break;
      else if(a > b) swap(&a, &b);
      printf("%d %d\n",a,b);
    }
  return 0;
}
 
void swap(int *x,int *y)
{
  int tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}


Measured memory_bytes: 1980
#include <iostream>
#include <string>
#include <algorithm>
#include <array>
#include <vector>

int main()
{
	int h, w;
	std::cin >> h >> w;

	// false: white
	// true: black
	std::vector<bool> grid(h * w, false);
	{
		char data = ' ';
		for (size_t i = 0; i < h * w; ++i)
		{
			std::cin >> data;
			if ('#' == data)
			{
				grid[i] = true;
			}
		}
	}

	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			bool item = false;
			bool target = grid[i * w + j];
			if (target)
			{
				//up
				if ((i - 1) >= 0 && true == grid[(i - 1) * w + j])
				{
					item = true;
				}
				//down
				if (i + 1 < h && true == grid[(i + 1) * w + j])
				{
					item = true;
				}
				//left
				if ((j - 1) >= 0 && true == grid[i * w + (j - 1)])
				{
					item = true;
				}
				//right
				if ((j + 1) < w && true == grid[i * w + (j + 1)])
				{
					item = true;
				}

				if (!item)
				{
					std::cout << "No" << std::endl;
					return 0;
				}
			}
		}
	}
	std::cout << "Yes" << std::endl;
	return 0;
}

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

#define fastio std::ios::sync_with_stdio(false);
#define ll long long
#define scann(n) scanf("%d",&n)
#define scand(n) scanf("%lf",&n)
#define scans(s) scanf("%s",&s)
#define pb push_back
#define ppb pop_back
#define full v.begin(),v.end()
#define debug cout<<"Bug! Vag! Bagh!"<<endl;
#define pi acos(-1)
#define mx 10010
#define inf 10e10

int main()
{
    ll n,x,t;
    cin>>n>>x>>t;
    if(n<=x)
    {
        cout<<t<<endl;
    }
    else
    {
        if(n%x==0)
        {
            cout<<(n/x)*t<<endl;
        }
        else
        {
            cout<<((n/x)+1)*t<<endl;
        }
    }
    return 0;
}
///arBishal_2017331022


Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int N;
  int c[3][3];
  LOOP(i,3){
    LOOP(j,3){
      cin>>c[i][j];
    }
  }
  int f[3];
  LOOP(i,2){
    LOOP(j,3){
      f[j]=c[i][j]-c[i+1][j];
    }
    if((f[0]==f[1])&&(f[1]==f[2]));else{
      cout << "No" << endl;
      return 0;
    }
  }
  LOOP(i,2){
    LOOP(j,3){
      f[j]=c[j][i]-c[j][i+1];
    }
    if((f[0]==f[1])&&(f[1]==f[2]));else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

#define rep(i,n) for(int i = 0;i < (n);i++)

using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){

	unsigned long long A;
	double B;
	
	cin >> A >> B;
	
	unsigned long long D = B * 100 + 0.5;	//round
	
	unsigned long long C;
	
	C = D * A / 100;
	
	cout << C;

	return 0;
	
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

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

ll lcm(ll x, ll y){
  if(y==0) return x;
  return lcm(y, x%y);
}

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 A, B;
  IN(A,B);
  ll C = lcm(A,B);
  OUT(A*(B/C));

  return 0;
}

Measured memory_bytes: 256
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}


func solve(n int64, a int64, b int64, xs []int64) int64 {
	ret := int64(0)
	previous := int64(0)
	for i, x := range(xs) {
		if i == 0 {
			previous = x
			continue
		}

		ret += min((x - previous) * a, b)
		previous = x
	}
	return ret
}

func main() {
	defer out.Flush()

	n := nextInt()
	a := nextInt()
	b := nextInt()
	xs := nextInts(n)
	res := solve(n, a, b, xs)
	fmt.Fprintln(out, res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 4276
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
//#define DEBUG
using namespace std;

int main(){
    int A, B;
    cin >> A >> B;
    if(A == B){
        cout << A * 2 << endl;
    }else{
        if(A > B){
            cout << A* 2 - 1 << endl;
        }else{
            cout << B* 2 - 1 << endl;
        }
    }
}

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

int main(){
  int i=1;
  int a,b;
  cin>>a>>b;
  int num=0;
  for(int i=1;i<=10000;i++){
    if(i*8/100==a&&i*10/100==b){
      cout<<i<<endl;
      return 0; 
    }
  }
  cout<<-1<<endl;
}
      

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl


int main() {
    ll n ,k;
    cin >> n >> k;

    // if(n > k * 2){
    //     n = n % k;
    // }

    // while(1){
    //     if(n-k > 0){
    //         n -= k;
    //     } else {
    //         break;
    //     }
    // }

    n = n % k;
    if(n > abs(n-k)){
        cout << abs(n-k) << endl;
    } else {
        cout << n << endl;
    }


    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String num = String.valueOf(n);
        int cnt = 0;
        
        for(int i = 0;i<num.length();i++){
            cnt+=(num.charAt(i)-'0');
        }

        if(n%cnt==0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


    }
}


Measured memory_bytes: 23764
import numpy as np
N, K = map(int,input().split())
x = list(map(int,input().split()))

ans = 10**9
for i in range (N-K+1):
    front = np.array(x[i])
    end   = np.array(x[i+K-1])
    
    if np.sign(front)!= np.sign(end):
        ans_temp = min (abs(front)*2+abs(end),abs(front)+abs(end)*2)
    else:
        ans_temp = max(abs(front),abs(end))
    
    if ans_temp <= ans:
        ans = ans_temp
print(ans)

Measured memory_bytes: 23088
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

//素数判定
bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
int GetDigit(int num) {
	return log10(num) + 1;
}

int main() {
	int X, A, B;

	bool safe;
	bool delicious;

	cin >> X >> A >> B;

	int Sugita = B - A;

	if (Sugita > 0) {
		delicious = false;
	}
	else {
		delicious = true;
	}

	if (Sugita > X) {
		safe = false;
	}
	else {
		safe = true;
	}

	if (!safe) {
		cout << "dangerous" << endl;
	}
	else {
		if (delicious) {
			cout << "delicious" << endl;
		}
		else {
			cout << "safe" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
/*
AizuOnline A0201
Title Wrought Gold Master
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
#define min(x,y) (((x)<(y))?(x):(y))
//Global data section
int n,m;
struct ITEM
{
  char name[101];
  int  price;
  int  cnt;
  int  rec[100];
} item_table[100];
//
int name2index(char *s)
{
  int i;
  for(i=0;i<100;i++)
    if(0 == strcmp(item_table[i].name,s))
      return(i);
  return(-1);
}
int get_price_r(int index)
{
  int i,cntr;
  int sum_price;
  struct ITEM *itemp;

  itemp=&(item_table[index]);
  int direct_price=itemp->price;
  if((cntr=itemp->cnt)==0)
    return(direct_price);
  sum_price=0;
  for(i=0;i<cntr;i++)
    sum_price += get_price_r(itemp->rec[i]);
  return(min(direct_price,sum_price));
}
main()
{
  int i,j,c,ko,r,index,ret;
  char iname[101],itemname[101];

  while(EOF!=scanf("%d ",&n) && n)
    {
      for(i=0;i<n;i++)
	{
	  scanf("%s %d",item_table[i].name,&item_table[i].price);
	  item_table[i].cnt=0;
	}
      scanf("%d ",&m);
      for(i=0;i<m;i++)
	{
	  scanf("%s %d ",iname,&ko);
	  r=name2index(iname);
	  item_table[r].cnt=ko;
	
	  for(j=0;j<ko;j++)
	    {
	      scanf("%s ",itemname);
	      index=name2index(itemname);
	      item_table[r].rec[j]=index;
	    }
	}
	scanf("%s ",itemname);
	
	ret=get_price_r(name2index(itemname));
	printf("%d\n",ret);
	
	
    }
return(0);
}

Measured memory_bytes: 632
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    int A[n-1];
    int ans[n];
  
    for (int i = 0; i < n; i++) {
        ans[i] = 0;
    }
    for (int i = 0; i < n-1; i++) {
        cin >> A[i];
        ans[A[i]-1]++;
    }
    for (int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 1; i <= n; ++ i) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 2; i < n; ++ i) {
    if (a[i] > a[i - 1] && a[i] < a[i + 1]) {
      ans ++;
    } else
    if (a[i] < a[i - 1] && a[i] > a[i + 1]) {
      ans ++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin>>n;
    long long a[n][n];
    
    for(int i=0;i<n;i++)for(int j=0;j<n;j++){
        cin>>a[i][j];
    }

    long long ans=0;
    bool used[n][n]={};
 
    //nは頂点の数
    for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++){
        if(k==i || k==j) continue;
        if(a[i][j]>a[i][k]+a[k][j]){
            cout<<-1<<endl;
            return 0;
        }
        if(a[i][j]==a[i][k]+a[k][j]){
            used[i][j]=true;
            used[j][i]=true;
        }
    }
    
    for(int i=0;i<n;i++)for(int j=0;j<n;j++){
        if(!used[i][j]){
            ans+=a[i][j];
            //cerr<<i<<" "<<j<<" "<<ans<<endl;
            used[j][i]=true;
        }
    }
    cout<<ans<<endl;
 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
int main()
{
	int n,k;
	char a;
	set<char>S;
	string s;
	stringstream ss;
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		cin>>a;
		S.insert(a);
	}
	for(int i=n;;i++)
	{
		ss<<i;ss>>s;ss.clear();
		bool flag=true;
		for(int j=0;j<s.length();j++)
		{
			if(S.find(s[j])!=S.end())
			{
				flag=false;
				break;
			}
		}
		if(flag)
		{
			cout<<s<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 900
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();

        int count = 0;
        for (int i = 0; i < N; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            double result = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
            if (result <= D * 1.0) {
                count++;
            }
        }
        System.out.println(count);
	}
}

Measured memory_bytes: 60468
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	i64 M;
	cin >> M;
	Cout(48 - M);
}


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

int main()
{
    int n, l;
    cin >> n >> l;
    vector<string> v;
    while(n--){
        string c;
        cin >> c;
        v.push_back(c);
    }
    sort(v.begin(), v.end());
    
    for(auto c: v){
        cout << c;
    }
    return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    W, a, b = map(int, readline().split())

    if b + W < a:
        print(a - (b + W))
    elif a + W < b:
        print(b - (a + W))
    else:
        print(0)


if __name__ == '__main__':
    main()


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

if n%2==0:
    b=[]
    c=[]
    for i in range(0,n,2):
        b.append(a[i])
    for i in range(n-1,0,-2):
        c.append(a[i])
    d=c+b
    print(*d)
else:
    b=[]
    c=[]
    for i in range(n-1,-1,-2):
        b.append(a[i])
    for i in range(1,n,2):
        c.append(a[i])
    d=b+c
    print(*d)

Measured memory_bytes: 101716
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_C
text = ""
while line = gets
    text += line.chomp.downcase
end

res = {}
for c in 'a'..'z'
    res[c] = text.count(c)
end

res.each do |k,v|
    puts k + " : " + v.to_s
end

Measured memory_bytes: 6096
// B - Traveling AtCoDeer Problem
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()

int main(){
	int N; cin>>N;
	vi A(N); rp(i, N) cin>>A[i];
	auto a = minmax_element(all(A));
	cout<< *a.second - *a.first <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;

const int MOD=1000000007;
int INF=100100100100100;
int a[100010];
signed main(){
  int n;cin>>n;
  int flag=0;
  int mi=INF;
  int sum=0;
  rep(i,n){
    cin>>a[i];
    if(a[i]<0)flag=1-flag;
    sum+=abs(a[i]);
    mi=min(mi,abs(a[i]));
  }
  cout<<sum-2*flag*mi<<endl;  
  return 0;
}


Measured memory_bytes: 4372
#include <bits/stdc++.h>
#define MAX_N 100000
#define P 1000000007
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n; lnt f[MAX_N+5][2];
vector <int> G[MAX_N+5];
void DFS(int u, int fa) {
	f[u][0] = f[u][1] = 1;
	for (int v : G[u]) if (v ^ fa)
		DFS(v, u), (f[u][1] *= f[v][0]) %= P, 
		(f[u][0] *= (f[v][0]+f[v][1])%P) %= P;
}
int main() {
	read(n);
	for (int i = 1, u, v; i < n; i++)
		read(u), read(v), G[u].push_back(v), G[v].push_back(u);
	return DFS(1, 0), printf("%lld\n", (f[1][0]+f[1][1])%P), 0;
}


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

using namespace std;

int main() {
  int K; cin >> K;
  string S; cin >> S;
  if (S.size() <= K) {
    cout << S << endl;
    return 0;
  }
  string result = S.substr(0, K) + "...";
  cout << result << endl;
  return 0;
}

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

using namespace std;

int n;
vector<int> d;
int m;
vector<int> c;

int main() {

#ifdef Alex_PKZDL
    freopen(input_file, "r", stdin);
    freopen(output_file, "w", stdout);
#endif
    ios_base::sync_with_stdio(false);

    cin >> n;
    d.resize(n);
    for (int& x : d) cin >> x;
    cin >> m;
    c.resize(m);
    for (int& x : c) cin >> x;
    sort(d.begin(), d.end());
    sort(c.begin(), c.end());

    int cur = 0;
    for (int i = 0; i < c.size(); ++i) {
        while (cur < n && d[cur] < c[i]) ++cur;
        if (cur == n) {
            cout << "NO" << endl;
            return 0;
        }
        if (d[cur] != c[i]) {
            cout << "NO" << endl;
            return 0;
        }
        cur++;
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n=3;
	vi in(3);
	rep(i,n)cin>>in[i];
	sort(all(in));
	if(in[0]==5&&in[1]==5&&in[2]==7)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}







Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
	int N, cnt[8] = { 0 }, more = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (a < 3200) cnt[a / 400] = 1;
		else more++;
	}
	int sum = 0;
	for (int i = 0; i < 8; i++) sum += cnt[i];
	cout << max(1, sum) << " " << sum + more << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
#define ll long long
int main()
{
	ll w,h,x,y;
	cin>>w>>h>>x>>y;
	double s=w*h*1.0/2;
	int count=0;
	if(x*1.0==w*1.0/2)
	{
		count++;
	}
	if(y*1.0==h*1.0/2)
	{
		count++;
	}
	if(count==2)
	{
		cout<<fixed<<setprecision(6)<<s<<" ";
		cout<<"1"<<endl;
	}
	else
	{
		cout<<fixed<<setprecision(6)<<s<<" ";
		cout<<"0"<<endl;
	}
	return 0;
}

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

int main(){
    double a[3],b[3];
    double x=0,y=0;
    while(cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2]){
        x = (b[1]*a[2] - a[1]*b[2])/(a[0]*b[1] - a[1]*b[0]);
        y = (a[0]*b[2] - a[2]*b[0])/(a[0]*b[1] - a[1]*b[0]);
        x = (x<0.001 && x>-0.001) ? 0.0 : x;
        y = (y<0.001 && y>-0.001) ? 0.0 : y;
        cout << fixed << setprecision(3) <<  x << " " << y << endl;
    }
}

Measured memory_bytes: 1280
#include <stdio.h>

int main(void) {
    int n, y, flag = 0, i, j;
    scanf("%d%d", &n, &y);
    for(i = 0; i <= n; i++) {
        for(j = 0; j + i <= n; j++) {
            if(y == 10000 * i + 5000 * j + 1000 *(n - i - j) && n - i - j >= 0) {
                printf("%d %d %d\n", i, j, n - i - j);
                flag = 1;
                return 0;
            }
        }
    }
    if(flag == 0) {
        printf("-1 -1 -1\n");
    }
    return 0;
}


Measured memory_bytes: 128