akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) 
{
	int n = 1;
	int val = 0;
	int a[100];
	int i = 0;

	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &val);
		a[i] = val;
	}
	for(i = n; i > 0; i--)
	{
		if(i == n)
		{
			printf("%d", a[i - 1]);
		}
		else
		{
			printf(" %d", a[i - 1]);
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int a[505050],b[505050];
int dp[505050];
int main()
{
    int h,n;
    cin >> h >> n;
    dp[0]=0;
    for(int i=1; i<=1e4; i++)
    {
        dp[i]=0x3f3f3f3f;
    }
    for(int i=1; i<=n; i++)
    {
        cin >> a[i] >> b[i];
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=a[i]; j<=10000; j++)
        {
            dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
        }
    }
    int mine=0x3f3f3f3f;
    for(int i=h; i<=10000; i++)
    {
        mine=min(mine,dp[i]);
    }
    printf("%d\n",mine);
}


Measured memory_bytes: 2304
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>

#define rep(i, n) for (int i = 0; i < n; i++) 
#define rrep(i, n) for(int i = n-1; i>=0; i--)
#define range(i, n, m) for (int i = n; i < m; i++) 
#define rrange(i, n, m) for (int i = n - 1; i => m; i--) 
#define MOD 1000000007
#define MAX 20000000000

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


using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

vector<ll> A(1001, MAX), B(1001, MAX), C(1001, MAX);
ll a, b, c;
ll X, Y, Z, K;

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



	cin >> X >> Y >> Z >> K;


	rep(i, X) {
		cin >> A[i];
	}
	rep(i, Y) {
		cin >> B[i];
	}
	rep(i, Z) {
		cin >> C[i];
	}


	sort(A.begin(), A.begin() + X, greater<ll>());
	sort(B.begin(), B.begin() + Y, greater<ll>());
	sort(C.begin(), C.begin() + Z, greater<ll>());



	ll a, b, c;
	a = b = c = 1;

	vector<ll> ret;

	//while ((a) * (b) * (c) < K) {
	//	ll m = std::min({ abs(A[a-1] - A[a]),abs(B[b-1] - B[b]),abs(C[c-1] - C[c]) });

	//	if (m == (A[a-1] - A[a]))a++;
	//	else if (m == (B[b-1] - B[b]))b++;
	//	else c++;
	//}

	//if (X > 100)X = 100;
	//if (Y > 100)Y = 100;
	//if (Z > 100)Z = 100;

	rep(aa, X) {
		rep(bb, Y) {
			rep(cc, Z) {
				ret.push_back(A[aa] + B[bb] + C[cc]);
				if ((aa + 1) * (bb + 1) * (cc + 1) > K)break;
			}
		}
	}

	
	sort(ret.begin(), ret.end(), greater<ll>());

	rep(i, K) {
		cout << ret[i] << endl;
	}






	
	return 0;
}


Measured memory_bytes: 18664
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    
    int N, A;
    cin>>N>>A;
    
    V nums(N);
    rep(i,N) cin>>nums[i];
    
    ll cnt=0;
    rep1(n,N){
        int tgt=n*A;
        ll dp[n+1][tgt+9];
        mem(dp,0); dp[0][0]=1;
        rep(i,N){
            int w=nums[i];
            for(int k=n;k>=1;k--){
                for(int j=0;j+w<=tgt;j++){
                    if(dp[k-1][j]>0) dp[k][j+w]+=dp[k-1][j];
                }
            }
        }
        cnt+=dp[n][tgt];
    }
    cout1(cnt);
}

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

#define ll long int


int main() {
	// your code goes here
string str;
cin>>str;
ll i;
for(i=0;i<str.length();i++)
 {
   if(i%2==0)
    {
       cout<<str[i];
    }
 }
	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			float[] x = new float[4];
			float[] y = new float[4];
			for(int i=0; i<4; i++)
			{
				x[i] = scanner.nextFloat();
				y[i] = scanner.nextFloat();
			}
			
			float ax = x[1] - x[0];
			float ay = y[1] - y[0];
			float bx = x[3] - x[2];
			float by = y[3] - y[2];
			float inner = ax*bx  + ay*by;
			
			String output;
			if(inner == 0)
			{
				output = "YES";
			}
			else
			{
				output ="NO";
			}
			
			System.out.println(output);
		}
	}
}

Measured memory_bytes: 31364
import itertools
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
a = [i for i in range(1,N+1)]
cnt = 0
ans_a, ans_b = 0, 0
for target in itertools.permutations(a):
    cnt += 1
    if list(target) == P:
        ans_a = cnt
    if list(target) == Q:
        ans_b = cnt
print(abs(ans_a-ans_b))

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

	cout << max(a*b, c*d) << endl;

	return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,a,b) for (int i = a; i < b; i++)
using namespace std;
typedef long long ll;
// 


ll dp[30][2][2];

ll solve(const string &s) {
    // reset 
    REP(i, 0, 30) REP(j, 0, 2) REP(k, 0, 2) dp[i][j][k] = 0;

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

    for (int i = 0; i < s.length(); i++) {
        int D = s[i] - '0';

        REP(j, 0, 2) REP(k, 0, 2) {
            for (int d = 0; d <= (j ? 9 : D); d++) {
                dp[i + 1][j || (d < D)][k || d == 4 || d == 9] += dp[i][j][k];
            }
        }
    }

    return dp[s.length()][0][1] + dp[s.length()][1][1];
}

vector<int> v;

int main(void) {
    int N;
    cin >> N;
    priority_queue<double, vector<double>, greater<double> > que;
    REP(i, 0, N) {
        int tmp;
        cin >> tmp; 
        que.push(tmp);
    }

    REP(i, 0, N - 1) {
        double v1 = que.top();
        que.pop();
        double v2 = que.top();
        que.pop();
        double nv = (v1 + v2) / 2;
        que.push(nv);
    }

    cout << que.top() << endl;
    
}

Measured memory_bytes: 256
import java.lang.Math;
import java.util.ArrayList;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sn = new Scanner(System.in);
        int a = sn.nextInt();
        int b = sn.nextInt();
        int c = sn.nextInt();
        System.out.println((a < b && b < c) ? "Yes" : "No");
    }
}

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


int main()
{
  int n,k;
  cin >> n >> k;
  int a[100000];
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  bool flag = true;
  int r = k - 1;
  int cnt = 0;
  while(flag){
    cnt++;
    if(n <= k) flag = false;
    k += r;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 998244353;
constexpr bool debug = 0;
//---------------------------------//

template<int M>
struct ModInt {
public:
	using value_type = long long;
	
	ModInt(value_type val = 0) : val(val < 0 ? (M - (-val % M)) % M : val % M) {}
	
	explicit operator bool() const noexcept { return val; }
	bool operator ==(const ModInt & rhs) const noexcept { return val == rhs.val; }
	bool operator !=(const ModInt & rhs) const noexcept { return !(*this == rhs); }
	ModInt operator +() const noexcept { return ModInt(*this); }
	ModInt operator -() const noexcept { return ModInt(0) -= *this; }
	ModInt operator +(const ModInt & rhs) const noexcept { return ModInt(*this) += rhs; }
	ModInt operator -(const ModInt & rhs) const noexcept { return ModInt(*this) -= rhs; }
	ModInt operator *(const ModInt & rhs) const noexcept { return ModInt(*this) *= rhs; }
	ModInt operator /(const ModInt & rhs) const noexcept { return ModInt(*this) /= rhs; }
	
	ModInt & operator +=(const ModInt & rhs) noexcept {
		val += rhs.val;
		if (val >= M) val -= M;
		return *this;
	}
	ModInt & operator -=(const ModInt & rhs) noexcept {
		if (val < rhs.val) val += M;
		val -= rhs.val;
		return *this;
	}
	ModInt & operator *=(const ModInt & rhs) noexcept {
		val = val * rhs.val % M;
		return *this;
	}
	ModInt & operator /=(const ModInt & rhs) noexcept {
		*this *= rhs.inverse();
		return *this;
	}
	
	ModInt pow(value_type n) const {
		ModInt res = 1, x = val;
		if (n < 0) { x = x.inverse(); n = -n; }
		while (n) { if (n & 1) res *= x; x *= x; n >>= 1; }
		return res;
	}
	
	ModInt inverse() const {
		long long a = val, a1 = 1, a2 = 0, b = M, b1 = 0, b2 = 1;
		while (b > 0) {
			value_type q = a / b, r = a % b;
			value_type nb1 = a1 - q * b1, nb2 = a2 - q * b2;
			a = b; b = r;
			a1 = b1; b1 = nb1;
			a2 = b2; b2 = nb2;
		}
		assert(a == 1);
		return a1;
	}
	
	const value_type & get() const noexcept { return val; }
	static decltype(M) get_mod() noexcept { return M; }
	
	friend std::ostream & operator <<(std::ostream & os, const ModInt & rhs) { return os << rhs.val; }
	friend std::istream & operator >>(std::istream & is, ModInt & rhs) {
		value_type x;
		is >> x;
		rhs = ModInt(x);
		return is;
	}
private:
	value_type val;
};
using mint = ModInt<MOD>;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	
	vector<vector<mint>> dp(C + 1, vector<mint>(D + 1));
	dp[A][B] = 1;
	
	FOR(i, A, C + 1) FOR(j, B, D + 1) {
		dp[i][j] += dp[i - 1][j] * j;
		dp[i][j] += dp[i][j - 1] * i;
		dp[i][j] -= dp[i - 1][j - 1] * (i - 1) * (j - 1);
	}
	
	cout << dp[C][D] << endl;
	
	return 0;
}


Measured memory_bytes: 73620
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 1000000;

typedef long long int ll;

using namespace std;

int memo[N];

bool f(int obj){
    if(obj < 100){
        if(obj!=0){
            return false;
        }else{
            return true;
        }
    }
    if(memo[obj] != -1)return memo[obj];
    bool ok = false;
    for(int i = 0; i<6 && !ok; i++){
        ok = f(obj-100-i);
    }
    memo[obj] = ok;
    return ok;
}

int main(){
    std::fill_n(memo,N,-1);
    int n;cin>>n;
    bool ok = f(n);
    if(ok){
        cout<<"1";
    }else{
        cout<<"0";
    }
	return 0;
}



Measured memory_bytes: 4224
#include <math.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
int main() { int K;
    cin >> K;
    string ACL = "ACL";
    for (int i = 1; i < K; i++) {
        ACL += "ACL";
    }
    cout << ACL;
}

Measured memory_bytes: 3624
while (n, m, k = gets.split.map(&:to_i)).inject(:+) != 0 do
  answer = 0.0
  denominator = m**n
  dp = Array.new(n){Array.new(m*n + 1, 0)}
  dp[0][1, m] = Array.new(m, 1)
  for i in 1...n do
    for j in 1..m*n do
      for x in 1..m do
        break if j+x > m*n
        dp[i][j+x] += dp[i-1][j]
      end
    end
  end
  for i in 1..n*m do
    answer += [i - k, 1].max.to_f * dp[n - 1][i].to_f / denominator
  end
  p answer
end

Measured memory_bytes: 6380
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

int main(void) {
  int64_t N;
  cin >> N;
  for (int64_t b = 1; b <= 3500; b++) {
    for (int64_t c = 1; c <= 3500; c++) {
      if ((4 * b * c - N * c - N * b) > 0 &&
          (N * b * c) % (4 * b * c - N * c - N * b) == 0) {
        cout << (N * b * c) / (4 * b * c - N * c - N * b) << ' ' << b << ' '
             << c << endl;
        return 0;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 256
import scala.io.Source.stdin

object Main {
  def main(args:Array[String]) =  {
    val (r,l) = stdin.getLines.foldLeft((0,0)){ (x,y) =>
      val z = y.split(",").map(_.toInt)
      if(z(0)==z(1)) (x._1,x._2+1)
      else if(z(0)*z(0)+z(1)*z(1)==z(2)*z(2)) (x._1+1,x._2)
      else x
    }
    println(r)
    println(l)
  }
}

Measured memory_bytes: 43908
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

int main() { cin.tie(0); ios::sync_with_stdio(false);
    const lint INF = 1e15;

    int A = in, B = in, Q = in;

    vector<lint> S(A+2);
    S[0] = -INF; S[A+1] = INF;
    rep( i, A ) S[i+1] = in;

    vector<lint> T(B+2);
    T[0] = -INF; T[B+1] = INF;
    rep( i, B ) T[i+1] = in;

    rep( _, Q ) {
        lint x = in;
        auto s = lower_bound( all(S), x );
        auto t = lower_bound( all(T), x );

        lint rs = *s-x, rt = *t-x, ls = x-*(s-1), lt = x-*(t-1);
        lint ans = min({
            max( rs, rt ),
            max( ls, lt ),
            ls*2+rt,
            lt*2+rs,
            rs*2+lt,
            rt*2+ls
        });
        cout << ans << "\n";
    }
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
    using BS = bitset<64>;
    int n;
    cin>>n;
    vector<BS> ms(n);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int x;
            cin>>x;
            ms[i].set(x);
        }
    }

    BS b(0);

    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        int t,x;
        cin>>t>>x;
        if(t==0) cout<<b[x]<<endl;
        if(t==1) b|= ms[x];
        if(t==2) b&=~ms[x];
        if(t==3) b^= ms[x];
        if(t==4) cout<<((b&ms[x])==ms[x])<<endl;
        if(t==5) cout<<(b&ms[x]).any()<<endl;
        if(t==6) cout<<(b&ms[x]).none()<<endl;
        if(t==7) cout<<(b&ms[x]).count()<<endl;
        if(t==8) cout<<(b&ms[x]).to_ullong()<<endl;
    }

    return 0;
}




Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    if(n == 1)cout << "Hello World";
    else cout << a + b;
}

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

int main() {
  // Input
  int r, D, x;
  cin >> r >> D >> x;
  int x_i;
    
  // Compute
  for (int i = 0; i < 10; i++) {
    x_i = r * x - D;
    cout << x_i << endl;
    x = x_i;
  }
}


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

int main() {
	string s;
	cin >> s;
	int l = -1, r = -1;
	for (int i = 0;i + 1 < s.size();i++) {
		if (s[i] == s[i + 1]) {
			l = i, r = i + 1;
			cout << l+1 << " " << r+1 << endl;
			return 0;
		}
	}
	for (int i = 0;i + 2 < s.size();i++) {
		if (s[i] == s[i + 2]) {
			l = i, r = i + 2;
			cout << l+1 << " " << r+1 << endl;
			return 0;
		}
	}
	cout << l << " " << r << endl;
}

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

#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 

int main () {
    int N, M;
    cin >> N >> M;
    if(N == M) cout << "Yes" << endl;
    else cout <<"No" << endl;



}




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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> nl(N + 1);
    rep(i, M) {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        nl[X].push_back(Y);
        nl[Y].push_back(X);
    }

    int ans = 0;
    unordered_set<int> seen;
    deque<int> stack;
    rep2(i, 1, N + 1) {
        if (seen.find(i) == seen.end()) {
            ans++;
            stack.push_back(i);
            while (stack.size() > 0) {
                int v = stack.back();
                stack.pop_back();
                for (int &next_v : nl[v]) {
                    seen.insert(v);
                    if (seen.find(next_v) == seen.end()) {
                        stack.push_back(next_v);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 10256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N, M;
    cin >> N >> M;
    vint x(M), y(M);
    int ans = 0;
    unordered_set<int> s;
    s.insert(0);
    vint num(N, 1);
    for (int i = 0; i < M; i++)
    {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    for (size_t i = 0; i < M; i++)
    {
        if (s.count(x[i]))
        {
            s.insert(y[i]);
            if (num[x[i]] == 1)
                s.erase(x[i]);
        }
        num[x[i]]--;
        num[y[i]]++;
    }
    cout << s.size();
    return 0;
}

Measured memory_bytes: 5540
n, m = map(int, input().split())
com = []
for i in range(m):
    c = list(map(int, input().split()))
    com.append(c)

com.sort(key=lambda x:x[1])

count = 1
start = com[0][0]
end = com[0][1]

for i in range(m):
    if com[i][0]>= end:
        end = com[i][1]
        count += 1

print(count)

Measured memory_bytes: 29568
#include<iostream>

using namespace std ;
int main()
{
    int d;
    cin>>d;
    
    if(d==25){
        cout<<"Christmas"<<endl;
    }
    else if(d==24){
        cout<<"Christmas Eve"<<endl;
    }
    else if(d==23){
        cout<<"Christmas Eve Eve"<<endl;
    }
    else if(d==22){
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
        

    return 0;
}

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

using namespace std;
 
int main(){
    int H, W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i+j)%2 == 0) printf("#");
                else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
  return 0;
}
           



Measured memory_bytes: 2612
A,B = map(str,input().split())
dic = {'A':1,'B':2,'C':3,'D':4,'E':5,'F':6}
An = dic[A]
Bn = dic[B]
if An == Bn:
  print('=')
if An < Bn:
  print('<')
if An > Bn:
  print('>')

Measured memory_bytes: 8960
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

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

fn main() {
    let v = read_vec::<String>();
    let v = v.into_iter()
        .map(|x| x.chars().collect::<Vec<_>>())
        .collect::<Vec<_>>();
    if v[0][v[0].len() - 1] == v[1][0] && v[1][v[1].len() - 1] == v[2][0] {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll n;
char c[4200];
ll a[4200];
ll sumB[4200][4200];
ll sumW[4200][4200];
vl idxB(4200),idxW(4200);
ll dp[2200][2200];
ll f(ll b,ll w){
    if(b==n&&w==n)return 0;
    if(0<=dp[b][w])return dp[b][w];
    ll res=INF;
    if(b!=n){
        ll cnt=0;
        if(0<=idxB[b+1]-1) cnt+=sumB[b+1][idxB[b+1]-1];
        if(0<=idxB[b+1]-1) cnt+=sumW[w+1][idxB[b+1]-1];
        chmin(res,f(b+1,w)+cnt);
    }
    if(w!=n){
        ll cnt=0;
        if(0<=idxW[w+1]-1) cnt+=sumB[b+1][idxW[w+1]-1];
        if(0<=idxW[w+1]-1) cnt+=sumW[w+1][idxW[w+1]-1];
        chmin(res,f(b,w+1)+cnt);
    }
    return dp[b][w]=res;
}
int main(){
    cin>>n;
    rep(i,2*n)cin>>c[i]>>a[i];
    rep(i,2*n){
        if(c[i]=='B')sumB[a[i]][i]++;
        else sumW[a[i]][i]++;
    }
    for(int i=1;i<=2*n;i++){
        for(int j=1;j<2*n;j++)sumB[i][j]+=sumB[i][j-1];
        for(int j=1;j<2*n;j++)sumW[i][j]+=sumW[i][j-1];
    }
    for(int j=0;j<2*n;j++){
        for(int i=n;i>=1;i--)sumB[i][j]+=sumB[i+1][j];
        for(int i=n;i>=1;i--)sumW[i][j]+=sumW[i+1][j];
    }
    rep(i,2*n){
        if(c[i]=='B')idxB[a[i]]=i;
        else idxW[a[i]]=i;
    }
    rep(i,2200){
        rep(j,2200){
            dp[i][j]=-1;
        }
    }   
    cout<<f(0,0)<<endl;
    return 0;
}

Measured memory_bytes: 303616
#include<iostream>

using namespace std;

const int N(1e5 + 9);
int n, m, ans;
int a[N], f[N];

int main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	f[2] = abs(a[1] - a[2]);
	for (int i=3;i<=n;i++)
	{
		f[i] = f[i - 1] + abs(a[i] - a[i - 1]);
		for (int j=2;j<=m;j++)
		{
			if (j >= i) continue;
			f[i] = min(f[i], f[i - j] + abs(a[i] - a[i - j]));
		}
	}
	cout<<f[n]<<endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int N_=0;
		ArrayList<Integer> a = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			a.add(sc.nextInt());
		}

		if(a.indexOf(1)==-1){
			System.out.println(-1);
			return;
		}
		for(int i = 0;i<N;i++){
			if(a.get(i) == N_+1){
				N_++;
			}
		}
		sc.close();
		System.out.println(N-N_);
	}
}


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

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

    ll ans = pow(2, M) * (1900 * M + 100 * (N - M));
    cout << ans << endl;
}

Measured memory_bytes: 4104
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(void){
    string s,t;
    cin >> s >> t;
    string stemp,ttemp;
    int flag=1;
    for(int i=0; i<s.length()-1; i++){
        stemp=s[i],ttemp=t[i];
        if(s.find(stemp,i+1)!=t.find(ttemp,i+1)){
            flag=0;
            break;
        }
    }
    if(s.find(s[s.length()-1])!=t.find(t[t.length()-1]))flag=0;
    cout << (flag?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 776
n,W = map(int,input().split())
w = []
v = []
dp = [[0]*(W+1) for _ in range(n+1)]
for _ in range(n):
    w1,v1 = map(int,input().split())
    w.append(w1)
    v.append(v1)
    
for i in range(n):
    for sumw in range(W+1):
        if sumw -w[i]>=0:
            dp[i+1][sumw] = max(dp[i+1][sumw],dp[i][sumw-w[i]]+v[i])
        dp[i+1][sumw] = max(dp[i][sumw],dp[i+1][sumw])
print(dp[n][W])

Measured memory_bytes: 120684
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	rep(i, n) scanf("%d", &a[i]);
	int count = 0;
	bool change = true;
	while (change)
	{
		rep(i, n)
		{
			if (a[i] % 2 != 0)
				change = false;
		}
		if (change)
		{
			count++;
			rep(i, n) a[i] /= 2;
		}
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int x;
	for (int i = 0; i < 5; i++) {
		cin >> x;
		if (x == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n, d;
    cin >> n >> d;
    int ans = (n+2*d)/(2*d + 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()

if S[0] == 'A':
    S = S[1:]
    count = 0
    for i in range(len(S)-2, 0, -1):
        if S[i] == 'C':
            S = S[:i] + S[i+1:]
            count += 1
    if count == 1:
        if S.islower():
            print('AC')
            quit()
print('WA')


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#define endl "\n"
#define PI 3.14159265358979323846264338327950L
typedef long long int ll;
typedef unsigned long long int ull;
typedef float f;
using namespace std;

void solve()
{   int a,b,h,m,s,ma; cin >> a >> b >> h >> m; long double ha,da;
    s=60*h+m; ha=((long double)s/2);ma=((long double)6*s);
    if (ha>=ma) da=ha-ma; else da=ma-ha;
    long double dar=(long double)(da*PI)/180;
    long double ans=sqrt((long double)(a*a+b*b)-(long double)2*a*b*cos(dar));
    cout.setf(ios::fixed); cout.precision(20);
    cout << ans;
}

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


Measured memory_bytes: 4124
using System;
using System.Linq;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
      int N=int.Parse(str[0]);
      int X=int.Parse(str[1]);
      int[] arr=new int[N];
      int sum=0;
      for(int i=0;i<N;i++){
        arr[i]=int.Parse(Console.ReadLine());
        sum+=arr[i];
      }
      int Y=X-sum;
      Array.Sort(arr);
      int ans=N;
        ans+=(Y/arr[0]);
      Console.WriteLine(ans);
    }
    
  }

}


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

int main()
{
  string S[10000];
  int n;

  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++)cin>>S[i];
    for(int i=1;i<n;i++){
      for(int j=0;j<S[i].length();j++){
	if(S[i][j+1]!='.'){
	  S[i][j]='+';
          for(int k=i-1;k>=0;k--){
            if(S[k][j]==' ')S[k][j]='|';
	    else break;
	  }
	  break;
	}
	else S[i][j]=' ';
      }
    }
    for(int i=0;i<n;i++)cout<<S[i]<<endl;
  }
  return 0;
}

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

using namespace std;


int sumdigits(int n)
{

	int sum=0,r;
	while(n!=0)
	{
        r=n%10;
        sum+=r;
        n=n/10;
	}
	return sum;
}
int main()

{
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    int n,ans=100010,i;
    cin>>n;
    for(i=1;i<n;i++)
    {
    	ans=min(ans,sumdigits(i)+sumdigits(n-i));
    }
    cout<<ans;



    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <queue>
#include <cstdio>
#include <algorithm>

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

using namespace std;

typedef long long ll;

const ll INF=1LL<<61;

struct edge{
	int v;
	ll cost;
	int type; // 0: normal edge, 1: magical edge
};

struct point{ double x,y; };

// y=a1*x+b1, y=a2*x+b2 の交点
point crosspoint(ll a1,ll b1,ll a2,ll b2){
	double x=(double)(b2-b1)/(a1-a2);
	double y=a1*x+b1;
	return (point){x,y};
}

// y = 0*x+d[0]
// y = 1*x+d[1]
// y = 2*x+d[2]
//   :
// y = k*x+d[k]
// で定まる下側エンベロープの x での値を求める
ll eval(int k,const ll *d,ll x){
	ll res=INF;
	rep(i,k+1) res=min(res,i*x+d[i]);
	return res;
}

int main(){
	for(int n,m,s1,s2,t;scanf("%d%d%d%d%d",&n,&m,&s1,&s2,&t),n;){
		s1--; s2--; t--;
		vector<edge> G[1000];
		int k=0; // magical edge の本数
		rep(i,m){
			int u,v;
			char cost[16]; scanf("%d%d%s",&u,&v,cost); u--; v--;
			if(cost[0]!='x'){
				int c=atoi(cost);
				G[u].push_back((edge){v,c,0});
				G[v].push_back((edge){u,c,0});
			}
			else{
				G[u].push_back((edge){v,0,1});
				G[v].push_back((edge){u,0,1});
				k++;
			}
		}

		static ll d[1000][101];
		rep(u,n) rep(i,k+1) d[u][i]=INF;
		d[t][0]=0;
		priority_queue< pair< ll,pair<int,int> > > Q; Q.push(make_pair(0,make_pair(t,0)));
		while(!Q.empty()){
			ll d_now=-Q.top().first;
			int u=Q.top().second.first,i=Q.top().second.second; Q.pop();

			if(d_now>d[u][i]) continue;

			rep(j,G[u].size()){
				int v=G[u][j].v,type=G[u][j].type;
				ll cost=G[u][j].cost;
				int i2=i+type;
				if(i2<=k && d[v][i2]>d[u][i]+cost){
					d[v][i2]=d[u][i]+cost;
					Q.push(make_pair(-d[v][i2],make_pair(v,i2)));
				}
			}
		}

		vector<ll> cand(1,0);
		rep(i,k+1) rep(j,k+1) if(i!=j) {
			double x1=0,x2=0,x3=0;
			if(d[s1][i]<INF && d[s1][j]<INF) x1=crosspoint(i,d[s1][i],j,d[s1][j]).x;
			if(d[s1][i]<INF && d[s2][j]<INF) x2=crosspoint(i,d[s1][i],j,d[s2][j]).x;
			if(d[s2][i]<INF && d[s2][j]<INF) x3=crosspoint(i,d[s2][i],j,d[s2][j]).x;
			for(int k=-1;k<=1;k++){
				cand.push_back((ll)x1+k);
				cand.push_back((ll)x2+k);
				cand.push_back((ll)x3+k);
			}
		}
		sort(cand.begin(),cand.end());
		cand.erase(unique(cand.begin(),cand.end()),cand.end());

		ll ans=INF;
		rep(i,cand.size()) if(cand[i]>=0) {
			ll val1=eval(k,d[s1],cand[i]);
			ll val2=eval(k,d[s2],cand[i]);
			ans=min<ll>(ans,abs(val1-val2));
		}
		printf("%lld\n",ans);
	}

	return 0;
}

Measured memory_bytes: 4512
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,b,re1=0,k,w,count=0,count2=0;
    vint a;
    cin>>n;
    vint ans(n,0);
    rep(i,n){
        cin>>b;
        ans[b-1]=i+1;
    }
    rep(i,n){
        cout<<ans[i]<<" \n"[i==n-1];
    }
    return(0);
}


Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int N, L;
  cin >> N >> L;
  string S[N];
  for (int i = 0; i < N; i++)
    cin >> S[i];
  sort(S, S + N);
  string ans = "";
  for (int i = 0; i < N; i++)
    ans += S[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
class Simple {
    private int N;
    private int[] a;
    void Solve() {
        //input
        N = io.Int;
        a = new int[N];
        for(int i = 0; i < N; ++i) a[i] = io.Int;
        //cal
        var ave = (int)a.Average();
        int ta = 0, tb = 0;
        for(int i = 0; i < N; ++i) ta += (a[i] - ave) * (a[i] - ave);
        ave++;
        for(int i = 0; i < N; ++i) tb += (a[i] - ave) * (a[i] - ave);
        //ret
        Console.WriteLine(Math.Min(ta, tb));
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] {' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 13268
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        a: usize, b: usize, c: usize,
    }

    println!("{}", vec![a+b, b+c ,c+a].iter().min().unwrap());
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
typedef long double ld;
#define int ll
int TC,N,K;

ll qexp(ll x, ll y) { 
ll res = 1; 
while (y > 0){
if (y & 1){
res = res*x; 
        		}
        		y = y>>1;
        		x = x*x; 
} 
    return res; 
}


int32_t main(){
	fast;
	
	K = 26;
	cin>>N;
	
	N--;
	int L = log10(ld(N * K - N + K)) / ld(log10(ld(K))) - 1;
	//cout<<L<<' ';
	N -= (qexp(K,L+1) - K) / (K - 1);
	
	string ans = "";
	FOR(i,0,L){
		int cur = qexp(K,L - i);
		//cout<<N / cur<<' ';
		int amt = min(N / cur, K);
		ans += char(amt + 97);
		N -= amt * cur;
		
	}
	//reverse(all(ans));
	cout<<ans<<'\n';
		
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  double a,s,x=0;
  for (int i=0; i<n; i++){
    cin >> x;
    a += x;
    s += x*x;
  }
  int p = round(a/n);
  cout << s-2*a*p+n*p*p;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int H = sc.nextInt();
        int W = sc.nextInt();
        int N = sc.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; ++i) {
            a[i] = sc.nextInt();
        }

        int[][] c = new int[H][W];
        int h = 0;
        int w = 0;
        int dh = 0;
        int dw = 1;
        for (int i = 0; i < N; ++i) {
            for (int cnt = 0; cnt < a[i]; ++cnt) {
                c[h][w] = i + 1;
                if (w + dw >= W) {
                    dw = 0;
                    dh = 1;
                } else if (h + dh >= H) {
                    dw = -1;
                    dh = 0;
                } else if (w + dw < 0) {
                    dh = -1;
                    dw = 0;
                } else if (h + dh < 0) {
                    dw = 1;
                    dh = 0;
                } else if (c[h + dh][w + dw] != 0) {
                    if (dw > 0) {
                        dw = 0;
                        dh = 1;
                    } else if (dh > 0) {
                        dw = -1;
                        dh = 0;
                    } else if (dw < 0) {
                        dh = -1;
                        dw = 0;
                    } else if (dh < 0) {
                        dw = 1;
                        dh = 0;
                    }
                }
                h += dh;
                w += dw;
            }
        }

        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (j > 0) {
                    _out.print(" ");
                }
                _out.print(c[i][j]);
            }
            _out.println();
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 30416
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[10];
		for (int i = 0; i < k; i++) {
			a[sc.nextInt()] = 1;
		}

		L: for (int i = n; ; i++) {
			char[] c = ("" + i).toCharArray();
			for (int j = 0; j < c.length; j++) {
				if (a[c[j] - '0'] == 1) {
					continue L;
				}
			}
			System.out.println(i);
			return;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 17236
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(n) for ( int i =0; i < n ; i ++)
int N, M, X;
int P[100000], Y[100000];
vector<int> x, d;
int main()
{
	scanf("%d %d ", &N, &M);
	rep(M) scanf("%d", &X), x.push_back(X);
	sort(x.begin(), x.end());
	rep(M - 1)d.push_back(x[i + 1] - x[i]);
	sort(d.begin(), d.end());
	int sum = 0;
	rep(M - N)sum += d[i];
	printf("%d", sum);
}

Measured memory_bytes: 1400
var a,b:byte;
f1:text;
begin
        readln(a,b);
        if (a=1)and(b=2)then write('3') else
        if (a=1)and(b=3)then write('2') else
        if (a=2)and(b=3)then write('1') else
        if(a=3)and(b=2)then write('1') else
        if(a=2)and(b=1)then write('3') else
        if(a=3)and(b=1)then write('2'); 
end.


Measured memory_bytes: 128
package main

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

func main() {
	N, K := sc.nextInt(), sc.nextInt()
	// if N < K {
	// 	fmt.Println(N)
	// 	return
	// }
	tmp := N % K
	tmp2 := abs(tmp - K)
	if tmp > tmp2 {
		fmt.Println(tmp2)
	} else {
		fmt.Println(tmp)
	}
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
#include<stdio.h>
int main(){
	int N, max = 0, freq[1000010] = {};
	scanf("%d", &N);
	for(int i = 1; i <= N; i++){
		int temp;
		scanf("%d", &temp);
		freq[temp]++;
		if(temp > max)
			max = temp;
	}
	int ans = 0;
	for(int i = 1; i <= max; i++){
		if(freq[i] == 0)
			continue;
		if(freq[i] == 1)
			ans++;
		for(int j = 2; j * i <= max; j++)
				freq[j * i] = 0;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 5612
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>


using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1.0);
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define all(v) v.begin(), v.end()

char alfa[] = { 'A','B' ,'C','D' ,'E' ,'F' ,'G' ,'H' ,'I' ,'J' ,'K' ,'L' ,'M' ,'N' ,'O' ,'P' ,'Q' ,'R' ,'S' ,'T' ,'U' ,'V' ,'W' ,'X' ,'Y','Z' };

inline void finish() {
	cout << -1 << endl;
	exit(0);
}

unsigned GetDigit(unsigned num) {
	return log10(num) + 1;
}

template <typename T>
inline void debug(vector<T> v) {
	cout << "[";
	for (ll i = 0; i < v.size() - 1; ++i) {
		cout << v[i] << ", ";
	}
	cout << v[v.size() - 1] << "]" << endl;
}

void Main();
inline void DebugMain() {
	while (true) {
		Main();
	}
}

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

	bool debug = false;
	if (debug) {
		cout << "\x1b[41m" << "Debug Mode " << endl;
	}
	(debug) ? DebugMain() : Main();
	return 0;
}


ll calcC(ld lastNum, ld calcNum, ll A, ll B, ll X) {
	if (calcNum < 1) {
		return 0;
	}

	ll ans;

	ans = A * calcNum + B * GetDigit(calcNum);

	if (calcNum == lastNum) {
		return calcNum;
	}

	if (ans > X) {
		return calcC(calcNum, calcNum - (fabs(calcNum - lastNum) / 2), A, B, X);
	}
	else {
		return calcC(calcNum, calcNum + (fabs(calcNum - lastNum) / 2), A, B, X);
	}

}

inline void Main() {
	ll X, Y, N;
	ll A, B;
	ll A1, A2, A3;
	ll M1, D1, M2, D2;
	ll ans;
	ll sum=0;
	string S;
	string S2;
	bool flag = false;

	

	cin >> A1>>A2>>A3;
	
	
	if (A1 + A2 + A3 <= 21) {
		cout << "win";
	}
	else {
		cout << "bust";
	}
	
	
}




Measured memory_bytes: 256
N,M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]

cs = [[] for i in range(N+1)]
for i,(p,y) in enumerate(src):
    cs[p].append((y,i))

ans = [None]*M
for pi,cities in enumerate(cs):
    for order,(y,i) in enumerate(sorted(cities)):
        ans[i] = str(pi).zfill(6) + str(order+1).zfill(6)
print(*ans, sep='\n')

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

int main(){
    int n, x, y;
    cin >> n >> x >> y;

    int ans[n - 1];
    for(int i = 0; i < n - 1; i++){
        ans[i] = 0;
    }

    for(int i = 1; i  < n; i++){
        for(int j = i + 1; j <= n; j++){
            int k = j - i;
            int l = abs(x - i) + 1 + abs(y - j);
            int m = abs(x - j) + 1 + abs(y - i);

            if(k > l){
                k = l;
            }
            if(k > m){
                k = m;
            }

            ans[k - 1]++;
        }
    }

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

Measured memory_bytes: 256