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

// @@ !! LIM(mod)
// --> f:gcd mod
// ---- inserted function gcd from util.cc
// g = eGCD(a, b, s, t)  --->  sa + tb = g
constexpr ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u = 0;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

constexpr ll gcd(ll a, ll b) {
  ll dummy1 = 0;
  ll dummy2 = 0;
  return eGCD(a, b, dummy1, dummy2);
}
// ---- end gcd
// ---- inserted library file mod.cc

ll MOD = 1e9 + 7;
// ll MOD = 998244353;

struct Fp {
  ll val;

  Fp(ll t = 0) :
    val(t < 0 ? MOD + t % MOD : t >= MOD ? t % MOD : t) {}

  Fp& operator +=(const Fp& t) {
    val += t.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }

  Fp& operator -=(const Fp& t) {
    val -= t.val;
    if (val < 0) val += MOD;
    return *this;
  }

  Fp& operator *=(const Fp& t) {
    val = (val * t.val) % MOD;
    return *this;
  }

  Fp inv() const {
    if (val == 0) {
      cerr << "inv() is called for zero." << endl;
      exit(1);
    }
    ll u = 0;
    ll v = 0;
    eGCD(val, MOD, u, v);
    return Fp(u);
  }

  Fp& operator /=(const Fp& t) {
    return (*this) *= t.inv();
  }

  Fp operator +(const Fp& t) const { return Fp(val) += t; }
  Fp operator -(const Fp& t) const { return Fp(val) -= t; }
  Fp operator *(const Fp& t) const { return Fp(val) *= t; }
  Fp operator /(const Fp& t) const { return Fp(val) /= t; }
  Fp operator -() const { return Fp(-val); }

  bool operator ==(const Fp& t) const { return val == t.val; }
  bool operator !=(const Fp& t) const { return val != t.val; }
  
  operator ll() const { return val; }

};

class Comb {
  int nMax;
  vector<Fp> vFact;
  vector<Fp> vInvFact;
public:
  Comb(int nm) : nMax(nm), vFact(nm+1), vInvFact(nm+1) {
    vFact.at(0) = 1;
    for (int i = 1; i <= nMax; i++) vFact.at(i) = i * vFact.at(i-1);
    vInvFact.at(nMax) = vFact.at(nMax).inv();
    for (int i = nMax; i >= 1; i--) vInvFact.at(i-1) = i * vInvFact.at(i);
  }
  Fp fact(int n) { return vFact.at(n); }
  Fp comb(int n, int r) {
    return vFact.at(n) * vInvFact.at(r) * vInvFact.at(n-r);
  }
  // The number of permutation extracting r from n.
  Fp perm(int n, int r) {
    return vFact.at(n) * vInvFact.at(n-r);
  }
};

// ---- end mod.cc
// @@ !! LIM  -- end mark --

Fp myf(ll r, ll c) {
  Comb cb(r+c);
  if (r < c) swap(r, c);
  // Thus, we have r >= c.
  Fp tot = 1;
  Fp cur = 1;
  for (ll i = 0; i < r+c; i++) {
    if (i < c) {
      cur *= Fp(2);
      tot += cur;
    }else if (i < r) {
      cur = cur * Fp(2) - cb.comb(i, c);
      tot += cur;
    }else {
      cur = cur * Fp(2) - cb.comb(i, c) - cb.comb(i, r);
      tot += cur;
    }
  }
  return tot;
}

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
  Fp u1 = myf(r2,     c2);
  Fp u2 = myf(r1 - 1, c2);
  Fp u3 = myf(r2,     c1 - 1);
  Fp u4 = myf(r1 - 1, c1 - 1);

  Fp ans = u1 - u2 - u3 + u4;
  cout << (ll)ans << endl;

  return 0;
}



Measured memory_bytes: 31572
#include <iostream> //cout
#include <vector> //vector
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


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

    vector<int> H(N);
    vector<int> H_score(N, 0);
    for(int i = 0; i < N; i++){
        cin >> H.at(i);
    }

    vector<int> A(M);
    vector<int> B(M);
    for(int i = 0; i < M; i++){
        cin >> A.at(i) >> B.at(i);
        A.at(i)--;
        B.at(i)--;

        if(H.at(A.at(i)) > H.at(B.at(i))){
            H_score.at(B.at(i))--;
        }
        else if(H.at(A.at(i)) < H.at(B.at(i))){
            H_score.at(A.at(i))--;
        }
        else if(H.at(A.at(i)) == H.at(B.at(i))){
            H_score.at(A.at(i))--;
            H_score.at(B.at(i))--;
        }
    }

    int sum = 0;
    for (int i = 0; i < N; i++){
        // cout << H_score.at(i) << endl;
        if(H_score.at(i) == 0){
            sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int n[4];
    for(int i=0;i<4;++i) n[i]=s[i]-'0';
    if(n[0]+n[1]+n[2]+n[3]==7) cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    else if(n[0]+n[1]+n[2]-n[3]==7) cout<<n[0]<<"+"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    else if(n[0]+n[1]-n[2]+n[3]==7) cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    else if(n[0]-n[1]+n[2]+n[3]==7) cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
    else if(n[0]+n[1]-n[2]-n[3]==7) cout<<n[0]<<"+"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    else if(n[0]-n[1]+n[2]-n[3]==7) cout<<n[0]<<"-"<<n[1]<<"+"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    else if(n[0]-n[1]-n[2]-n[3]==7) cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"-"<<n[3]<<"=7"<<endl;
    else if(n[0]-n[1]-n[2]+n[3]==7) cout<<n[0]<<"-"<<n[1]<<"-"<<n[2]<<"+"<<n[3]<<"=7"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
	scanf("%d", &n);
	if (n == (n & -n)){
		printf("No"); return 0;
	}
	puts("Yes");
	printf("%d %d\n", 1, 2);
	printf("%d %d\n", 2, 3);
	printf("%d %d\n", 3, n + 1);
	printf("%d %d\n", n + 1, n + 2);
	printf("%d %d\n", n + 2, n + 3);
	for (int i = 4; i + 1 <= n; i += 2) {
		printf("%d %d\n", i, i + 1);
		printf("%d %d\n", i + n, i + n + 1);
		printf("%d %d\n", n + 1, i + 1);
		printf("%d %d\n", n + 1, i + n);
	}
	if (~n & 1) {
		for (int i = 2; i < n; ++i) {
			int x = i, y = n ^ i ^ 1;
			if (y >= 2 && y < n && x != y) {
				printf("%d %d\n", n, x & 1 ? x : x + n);
				printf("%d %d\n", n + n, y & 1 ? y : y + n);
				break;
			}
		}
	}
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
  string s;
  cin >> s;
  int day = 0;
  rep(i, s.size()) {
    if(i==4 || i==7) continue;
    day = day*10 + (s[i]-'0');
  }

  if(day<=20190430) cout << "Heisei" << endl;
  else cout << "TBD" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

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

    int n, m;
    cin >> n >> m;
    int a[n];
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    int count = 0;
    double minm = sum / (double)(4 * m);
    for(int i = 0; i < n; i++)
        if(a[i] >= minm)
            count++;
    if(count >= m)
        cout << "Yes";
    else
        cout << "No";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
// スマホから提出
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll gcd(ll m,ll n)
{
  if(n==0) return m;
  return gcd(n, m%n); 
}
ll x[100100];
int main(void)
{
  ll N, X;
  ll g;
  cin >> N >> X;
  for(ll i=0;i<N;i++){
    cin >> x[i];
    x[i]=abs(x[i]-X);
  }
  g = x[0];
  for(ll i=1;i<N;i++){
    g=gcd(x[i],g);
  }
  cout << g << endl;
}
             
             
             
             
             
             
             

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;

template<typename T>
class hashmap64 {
	std::vector<std::pair<uint64, T>> map;
	uint64 mask, count, temp;
	uint64 hash64(uint64 key) {
		key = 0xFFFFFFFFFFFFFFFF & (key ^ (key << 13));
		key = key ^ (key >> 19);
		return 0xFFFFFFFFFFFFFFFF & (key ^ (key << 17));
	}
public:
	hashmap64() :map(1024, std::make_pair(~static_cast<std::uint_fast64_t>(0), T())) {
		mask = 1023; count = 0;
	}
	T &operator[](uint64 suf) {
		temp = mask&hash64(suf);
		while (~map[temp].first) {
			if (map[temp].first == suf) {
				return map[temp].second;
			}
			temp = mask&(temp + 1);
		}
		std::cerr << "?????¨????????????????????§????????????\n";
		std::abort();
	}
	void insert(uint64 key, const T &value) {
		temp = mask&hash64(key);
		while (~map[temp].first) {
			if (map[temp].first == key) {
				map[temp].second = value;
				return;
			}
			temp = mask&(temp + 1);
		}
		map[temp] = std::make_pair(key, value);
		++count;
		if ((count << 1) > mask) {
			std::pair<uint64, T> mkey;
			mask = mask << 1 | 1;
			map.resize(mask + 1, std::make_pair(~static_cast<std::uint_fast64_t>(0), T()));
			for (uint64 t = 0;t <= mask >> 1;++t) {
				if (!~map[t].first) {
					mkey = map[t];
					map[t].first = ~0;
					temp = mask&hash64(mkey.first);
					while (~map[temp].first) {
						temp = mask&(temp + 1);
					}
					map[temp] = mkey;
				}
			}
		}
		return;
	}
	bool find(uint64 key) {
		temp = mask&hash64(key);
		while (~map[temp].first) {
			if (map[temp].first == key) {
				return true;
			}
			temp = mask&(temp + 1);
		}
		return false;
	}
	bool empty(void) {
		return !count;
	}
	size_t size(void) {
		return count;
	}
};
int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	hashmap64<uint32> map;
	uint32 n;
	std::cin >> n;
	int64 a,sum = 0;
	uint32 ans = 0;
	map.insert(1e15, 0);
	rep(i, 0, n) {
		std::cin >> a;
		sum += a;
		if (map.find(sum + 1e15)) {
			ans = std::max(ans,i+1-map[sum + 1e15]);
		}
		else {
			map.insert(sum + 1e15, i + 1);
		}
	}
	std::cout << ans << "\n";
	return 0;
}

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

bool nottrue(bool a[], int n) {
    for (int i = 0; i < n; i++) {
        if (a[i] == false) {
            return true;
        }
    }
    return false;
}

int main() {
    int count[26];
    for (int i = 0; i < 26; i++) {
        count[i] = 0;
    }
    int h, w;
    cin >> h >> w;
    string a[h];
    for (int i = 0; i < h; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            count[a[i][j] - 'a']++;
        }
    }

    sort(count, count + 26);

    vector<int> res;
    int hsho = h / 2;
    int hamari = h % 2;
    int wsho = w / 2;
    int wamari = w % 2;
    for (int i = 0; i < hsho * wsho; i++) {
        res.push_back(4);
    }
    for (int i = 0; i < hamari * wsho + hsho * wamari; i++) {
        res.push_back(2);
    }
    for (int i = 0; i < hamari * wamari; i++) {
        res.push_back(1);
    }
//    for (int i = 0; i < res.size(); i++) {
//        cout << res[i] << " ";
//    }
//    cout << endl;
    
    bool flag[res.size()];
    for (int i = 0; i < res.size(); i++) {
        flag[i] = false;
    }
    int p = 0;
    while (nottrue(flag, res.size())) {
        sort(count, count + 26);
        for (int i = 25; i >= 0; i--) {
//            cout << "i = " << i << endl;
            if (count[i] == 0) break;
            int j;
            for (j = 0; j < res.size(); j++) {
                if (flag[j]) continue;
                if (count[i] >= res[j]) {
                    count[i] -= res[j];
//                    cout << "count: " << count[i] << endl;
                    flag[j] = true;
                    break;
                }
            }
            if (j == res.size()) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (int i = 0; i < 26; i++) {
        if (count[i] > 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return 1; 
    if (n <= 3) 
        return 2; 

    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return 1; 

    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return 1; 

    return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll A[n],k=0;
        for(ll i=0;i<n;i++)
        {
            cin>>A[i];
            
        }
        for(ll i=0;i<n;i++)
        {
            if(A[i]==i+1)
            {
               k++;
               i++;
                

            }
        }
        cout<<k;
    }       
    return 0;
}


Measured memory_bytes: 4420
ABC = sorted(map(int, input().split()))


q1,mod1 = divmod((ABC[2] - ABC[0]), 2)
q2,mod2 = divmod((ABC[2] - ABC[1]), 2)

cnt = q1 + q2

if mod1 == mod2 == 0:
    print(cnt)
elif mod1 == mod2 == 1:
    print(cnt + 1)
else:
    print(cnt + 2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
int a[55];
int main() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>a[i];
    }
    sort(a,a+n);
    double till = a[0];
    for(int i=1;i<n;i++) {
        int ele = a[i];
        double tt = 1.0*a[i];
        till = (tt+till)/2;
    }
    cout<<fixed<<setprecision(10)<<till<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String[] input = new String[2];
		String line = in.readLine();

		input = line.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);

		if((a % 2) * (b % 2) % 2 == 0)
			System.out.println("Even");
		else
			System.out.println("Odd");

	}
}

Measured memory_bytes: 21076
#include <iostream>
using namespace std;
   
int main() {
  int n, m, l, A[100][100], B[100][100];
  long sum = 0 ;
  for (int i = 0; i < 100; i++ ){
    for (int j = 0; j < 100; j++ ){
      A[i][j]=0; B[i][j]=0;
    }
  }
   
  cin >> n >> m >> l;
  for (int i = 0; i < n; i++ ){
    for (int j = 0; j < m; j++ ){
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < m; i++ ){
    for (int j = 0; j < l; j++ ){
      cin >> B[i][j];
    }
  }
   
  for (int i = 0; i < n; i++ ){
    for (int j = 0; j < l; j++ ){
      sum = 0;
      for (int k = 0; k < m; k++ ){
        sum += A[i][k] * B[k][j];
      }
      cout << sum;
      if (j == l-1 ) { cout << endl;}
      else {cout << " ";}
    }
  }
   
  return 0;
}


Measured memory_bytes: 3180
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:268435456")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#endif
#ifndef _MSC_VER
#pragma GCC target ("sse4.2")
#endif
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <random>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <array>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
#define ar array

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef pair<ll, ll> pll;
typedef vector< pii > vpii;
typedef vector< pll > vpll;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;


int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	long long n, d;
	cin >> n >> d;
	d = d * d;
	int res = 0;
	for (int i = 0; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		if (x * x + y * y <= d)
			res++;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 3552
n = int(input())
a = [i for i in map(int,input().split())]
count = 0
aim = 1
for i in range(n):
    if a[i] != aim:
        count+=1
    elif a[i] == aim:
        aim +=1
if count ==n:
    print(-1)
else:        
    print(count)

Measured memory_bytes: 26268
#include<stdio.h>
int main(void){
  char s[4];
  int i,j;
  int cnt=0;
  
  scanf("%s",s);
  
  for(i=0;i<4;i++){
    for(j=i+1;j<4;j++){
      if(s[i]==s[j]){
        cnt++;
      }
    }
  }
    
   if(cnt==0){
     printf("Yes\n");
   }
    else{
     printf("No\n");
    }
    return 0;
  }

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

import static java.lang.Integer.parseInt;

/**
 * Princess's Gamble
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int N, M;
			N = parseInt(line.substring(0, line.indexOf(' ')));
			M = parseInt(line.substring(line.indexOf(' ') + 1));
			if ((N | M) == 0) break;

			int[][] dp = new int[N][3];
			int expected = 0;

			for (int i = 0; i < N; i++) {
				line = br.readLine();
				dp[i][0] = parseInt(line.substring(0, line.indexOf(' ')));
				dp[i][1] = parseInt(line.substring(line.indexOf(' ') + 1));
				dp[i][2] = dp[i][0] * dp[i][1];
				expected += dp[i][2];
			}

			Arrays.sort(dp, new Comparator<int[]>() {
				@Override
				public int compare(int[] o1, int[] o2) {
					return Integer.compare(o1[1], o2[1]);
				}
			});

			for (int i = N - 1; i >= 0; i--) {
				if (dp[i][0] <= M) {
					expected -= dp[i][2];
					M -= dp[i][0];
				} else if (dp[i][0] > M) {
					expected -= M * dp[i][1];
					M = 0;
				}
				if (M == 0) break;
			}

			System.out.println(expected);

		} //end while
	} //end main
}

Measured memory_bytes: 49392
#include <stdio.h>

int main() {
	char n[3], i;

	scanf("%s", n);
	for (i = 0; i < 3; i++) {
		if (n[i] == '1') {
			printf("9");
		}
		else {
			printf("1");
		}
	}

	return 0;
}

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

int main() {
  string s;
  int k;
  cin >> s >> k;
  
  int count = 1;
  vector<int> x;
  for(int i = 1; i < s.size(); i++){
    if(s.at(i - 1) == s.at(i)) count++;
    else{
      x.push_back(count);
      count = 1;
    }
  }
  x.push_back(count);
  
  long long ans = 0;
  if(s.at(0) != s.at(s.size() - 1)){
    for(int i = 0; i < x.size(); i++){
      ans += x.at(i) / 2;
    }
    ans *= k;
  }
  else{
    if(x.size() == 1){
      ans = (s.size() * k) / 2;
    }
    else{
      ans += x.at(0) / 2;
      ans += x.at(x.size() - 1) / 2;
      
      long long keep = 0;
      x.at(0) += x.at(x.size() - 1);
      x.pop_back();
      for(int i = 0; i < x.size(); i++){
        keep += x.at(i) / 2;
      }
      keep *= k - 1;
      for(int i = 1; i < x.size(); i++){
        keep += x.at(i) / 2;
      }
      ans += keep;
    }
  }
  
  cout << ans << endl;
}


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

using namespace std;

int n, k, c;
string s;

int main()
{
	cin>>n>>k>>c>>s;
	vector<int> b(n, -1);
	int i = 0;
	for(int t = 0; t < k; t++)
	{
		while(s[i] == 'x') i++;
		b[i] = t;
		i += c + 1;
	}
	vector<int> dp(3 * n);
	for(int i = n; i--;)
	{
		dp[i] = dp[i + 1];
		if(s[i] == 'o') dp[i] = max(dp[i], dp[i + c + 1] + 1); 
	}
	for(int i = 0; i < n; i++) if(b[i] != -1 and b[i] + dp[i + 1] < k) cout<<i + 1<<endl;
	return 0;
}

Measured memory_bytes: 4996
#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
	int q=0;char ch=' ';
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
	return q;
}
typedef long long LL;
const int N=100005;
LL a[N];int n,ans;
int main()
{
	n=read();
	for(RI i=1;i<=n;++i) a[i]=read();
	sort(a+1,a+1+n);
	for(RI i=1;i<=n;++i) {
		a[i]+=a[i-1],++ans;
		if(a[i]+a[i]<a[i+1]) ans=0;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
	int a,b;
  	cin >> a >>b;
  int saidai = a +b;
  saidai = max(saidai,a-b);
  saidai = max(saidai,a*b);
  cout<< saidai <<endl;
}


Measured memory_bytes: 256
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
li.insert(0,[0,0,0])
ans="Yes"
for i in range(N):
  if li[i+1][0]-li[i][0]<abs(li[i+1][1]-li[i][1])+abs(li[i+1][2]-li[i][2]) or (li[i+1][0]-li[i][0])%2!=abs(li[i+1][1]-li[i][1]+li[i+1][2]-li[i][2])%2:
    ans="No"
print(ans)

Measured memory_bytes: 27300
n = int(input())
l = []

def each_sum(x):
    y = str(x)
    ans = 0
    for i in range(len(y)):
        ans += int(y[i])
    return ans

for a in range(1, n):
    b = n - a
    l.append(each_sum(a) + each_sum(b))

print(min(l))

Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >>N >>K;
  long long ans=0, temp=1;
  if(K%2!=0){
    for(int i=0; i<3; i++){
      temp*=N/K;
    }
    ans=temp;
  }
  else if(K==2){
    for(int i=0; i<3; i++){
      temp*=N/2;
    }
    ans+=temp, temp=1;
    if(N%2!=0){
      for(int i=0; i<3; i++){
        temp*=(N+1)/2;
      }
      ans+=temp;
    }
    else ans*=2;
  }
  else{
    for(int i=0; i<3; i++){
      temp*=N/K;
    }
    ans+=temp,temp=1;
    for(int i=0; i<3; i++){
      temp*=(N/(K/2)-N/K);
    }
    ans+=temp;
  }
  cout <<ans <<endl;
}

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

int main(){
    string a;

    cin >> a;
    if(a[0] == a[1] && a[1] == a[2])
        cout << "Yes" << endl;
    else if (a[2] == a[1] && a[3] == a[2])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}

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

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

	vector<string> data(N);

	for (int i = 0; i < N; i++) {
		cin >> data[i];
	}

	cout << endl;

	sort(data.begin(), data.end());


	int num = 1;	//現要素数
	int max = 1;	//最大要素数
	int j = 0;	//出力配列数
	vector<string> out(N);

	
		

	for (int i = 0; i < N-1; i++) {
		
			if (data[i] == data[i + 1]) {
				num++;

				if(i == N-2){
					if (max == num) {
						out[j] = data[i];
						j++;
					}
					if (max < num) {
						out[0] = data[i];
						j = 1;
					}

				}
			}

			if (data[i] != data[i + 1] ) {
				if (num > max) {
					max = num;
					j = 0;
					out[j] = data[i];
				}

				
				if (num == max) {
					out[j] = data[i];
					j++;
				}

				if (num == 1 && i == N-2) {
					out[j] = data[i + 1];
					j++;
				}
				

				num = 1;
			}
		
	}

	

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

Measured memory_bytes: 15872
from collections import OrderedDict
n = int(input())
abet = "abcdefghijklmnopqrstuvwxyz"
foo = OrderedDict.fromkeys(abet)
for _ in range(n):
    line = input()
    for c in abet:
        bar = line.count(c)
        if (foo[c] is None or bar < foo[c]):
            foo[c] = bar
res = ''
for c in abet:
    # print(foo[c])
    res += c * foo[c]
print(res)


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000

using namespace std;

#define MAXN 101
int dp[MAXN][MAXN];

int main(){
  int n;cin>>n;
  vector<int> r(n),c(n), rc(n+1);
  rep(i, n){
    cin>>r[i]>>c[i];
    rc[i]=r[i];
  }
  rc[n]=c[n-1];
  n++;

  // rep(i, n)cout<<rc[i]<<' ';cout<<endl;
  // rep(i, n-1)cout<<r[i]<<' ';cout<<endl;
  // rep(i, n-1)cout<<c[i]<<' ';cout<<endl<<endl;

  // 行列数2について予め計算しておく
  rep(i, n-2)dp[i][i+2]=rc[i]*rc[i+1]*rc[i+2];

  // rep(i, n){rep(j, n)cout<<dp[i][j]<<' ';cout<<endl;}
  // cout<<endl;

  // 計算対象となる行列の数
  for(int len=3; len<=n; len++){
    // 行列の個数が入る分だけ左端から全て計算する
    rep(i, n-len+1){
      int j=i+len;
      dp[i][j]=INF;
      // lenの中で最後に計算する場所についてループを回して全チェック
      // 両端を含む必要はないのでkはi+1で初期化し、i+len-1までのループにする。
      for(int k=i+1; k<j; k++){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j] + rc[i]*rc[j]*rc[k]);
        // cout<<i<<' '<<k<<' '<<j<<'|'<<dp[i][k]<<' '<<dp[k][j]<<' '<<rc[i]*rc[j]*rc[k]<<endl;
      }

      // rep(i, n){rep(j, n)cout<<dp[i][j]<<' ';cout<<endl;}cout<<endl;

      // cout<<endl;
    }
  }

  cout<<dp[0][n-1]<<endl;

  // rep(i, n){rep(j, n)cout<<dp[i][j]<<' ';cout<<endl;}
  // cout<<endl;

  return 0;
}



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

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

Measured memory_bytes: 3616
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void _dump(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void _dump(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  _dump(s, forward<Tail>(tail)...);
}
// }}} End

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

  VAR(int, N);

  i64 res = 0;
  i64 A, B, B_A;
  A = B = B_A = 0;

  rep(i, N) {
    VAR(string, s);

    rep(j, s.length() - 1) if (s.substr(j, 2) == "AB") res++;

    if (s.front() == 'B' && s.back() == 'A') B_A++;
    if (s.front() == 'B') B++;
    if (s.back() == 'A') A++;
  }

  res += min(A, B);
  if (B_A && A == B_A && B == B_A) res--;

  OUTL(res);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll n,a[300000],c=0,m=0;
  cin >> n;
  rep(i,n)cin >> a[i];
  rep(i,n)if(a[i]<0)c++;
  rep(i,n)a[i]=abs(a[i]);
  rep(i,n)m+=a[i];
  sort(a,a+n);
  if(c%2==1)m-=a[0]*2;
  printf("%lld",m);
}

Measured memory_bytes: 2560
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let s = s.trim();
    let mut ans = String::from("");

    for e in s.chars() {
        if e == '0' || e == '1' {
            ans.push(e);
        } else if e == 'B' && ans.len() > 0 {
            ans.pop();
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define r(i,a,n) for(int i=a;i<n;i++)
#define M(a,b,c) make_pair(make_pair(a,b),c)
#define f first
#define s second
#define P pair<pair<int,int>,int >
int x,y,dx[]={1,-1,0,0},dy[]={0,0,1,-1};
string s[61];char d;
bool b[200][200];
int main(){
	while(cin>>x>>y,x){scanf("%c",&d);
		r(i,0,y+y-1)getline(cin,s[i]);
		queue<P>q;
		r(i,0,200)r(j,0,200)b[i][j]=0;
		q.push(M(0,0,1));b[0][0]=1;
		while(!q.empty()){
			P p=q.front();q.pop();
			if(p.f.f==y*2-2&&p.f.s==x*2-2){
				cout<<p.s<<endl;
				goto L;
			}
			r(i,0,4){
				if(p.f.f+dy[i]*2>=0&&p.f.s+dx[i]*2>=0)
					if(p.f.f+dy[i]*2<y*2-1&&p.f.s+dx[i]*2<x*2-1)
						if(s[p.f.f+dy[i]][p.f.s+dx[i]]=='0')
						if(!b[p.f.f+dy[i]*2][p.f.s+dx[i]*2]){
							b[p.f.f+dy[i]*2][p.f.s+dx[i]*2]=1;
							q.push(M(p.f.f+dy[i]*2,p.f.s+dx[i]*2,p.s+1));
						}
			}
		}
		cout<<0<<endl;L:;
	}
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n;i++)
using namespace std;
int main(){
    int n;
    cin >> n;
    double ans;
    ans = n;
    n = (n + 1) / 2;
    ans = n / ans;
    printf("%lf\n", ans);
}

Measured memory_bytes: 256
instr = input()
year, month, date = list(map(int, instr.split('/')))

isHeisei = True
if year > 2019:
  isHeisei = False
elif year == 2019:
  if month > 4:
    isHeisei = False
  elif month == 4:
    if date > 30:
      isHeisei = False
      
printstr = "Heisei" if isHeisei else "TBD"
print(printstr)

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

int main()
{
    int a;
    string str, strhalf;
    cin >> a;
    cin >> str;

    size_t size = str.length();
    if(size%2 == 1){
        cout << "No" << endl;
    }else{
        for(int i=0;i<size/2;i++){
            strhalf += str[i];
        }
        if(str == strhalf + strhalf){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

q = Y//1000 - N

x = [0, 4, 8, 3, 7, 2, 6, 1, 5]

B = x.index(q%9)
b = B
while 4*b <= q:
    c = (q - 4*b) // 9
    a = N-c-b
    if a<0:
        b += 9
        continue
    else:
        print(c, b, a)
        break
else:
    print(-1, -1, -1)


Measured memory_bytes: 9164
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define FT() int t; scanf("%d",&t); while(t--)
#define pb push_back
#define nl printf("\n")
#define fi(i,start,end) for(int i=start; i < (int)end ; ++i)
#define ip(n)   scanf("%d",&n)
#define mz(a)   memset(a,0,sizeof(a))
#define inpArr(A,n) fi(i,0,n)   ip(A[i]);
#define print(a)  for(auto i : a)   cout<<i<<" "; nl;
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll max(ll a,ll b)   {return a>b?a:b;}
ll min(ll a,ll b)   {return a<b?a:b;}

int main() {
   
    //std::cout << std::fixed;
    //std::cout << std::setprecision(6);
    Fastio;
    int testcase = 1;
    //cin>>testcase;
    while(testcase--)
    {
        string s;
        cin>>s;
        ll sm = 0;
        for(auto i : s)
            sm+=(i-'0');
        if(sm%9 == 0)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }


    
    return 0;
}

Measured memory_bytes: 3740
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int N;
	cin >> N;
	string ans = "";
	while (N != 0) {
		int r = N % (-2);
		if (r < 0)r += 2;
		ans += r + '0';
		N = (N - r) / (-2);
	}
	reverse(ans.begin(), ans.end());
	if (ans == "")ans = "0";
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main(void){
	string a,b,c;

	cin>>a>>b>>c;

	if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
		cout << "YES" <<endl;
	} else {
		cout << "NO" <<endl;
	}

	return 0;
}


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

using namespace std;
typedef long long lint;

int main() {
    int N;
    cin >> N;
    vector<int> A(N+2);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    lint sum = 0;
    for (int i = 0; i < N+2; i++) {
        sum += abs(A[i] - A[i+1]);
    }
    for (int i = 1; i <= N; i++) {
        lint ans = sum - abs(A[i] - A[i-1]) - abs(A[i] - A[i+1]) + abs(A[i-1] - A[i+1]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define pb push_back
const int N=1e5+5;

inline int read(){
	int x=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar());
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x;
}

void W(int x){ if(x>=10) W(x/10); putchar(x%10+'0');}

vector<int> g[N];
int mx[N],n,col[N],Q,d[N],c[N],m,p[N];

void dfs(int x){
	if(!col[x]) col[x]=c[Q];
	for(int i:g[x]) if(mx[x]-1>mx[i]) mx[i]=mx[x]-1,dfs(i);
}

int main(){
	memset(mx,-1,sizeof(mx));
	
	n=read(),m=read();
	for(int i=1,uu,vv;i<=m;i++)
		uu=read(),vv=read(),g[uu].pb(vv),g[vv].pb(uu);
	Q=read();
	for(int i=1;i<=Q;i++) p[i]=read(),d[i]=read(),c[i]=read();
	
	for(;Q;Q--) if(d[Q]>mx[p[Q]]) mx[p[Q]]=d[Q],dfs(p[Q]);
	
	for(int i=1;i<=n;i++) W(col[i]),puts("");
	return 0;
}

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

int main(){
	int Line[10];
	int* S=Line;
	char C[4];
	int A;
	while(scanf("%s",C)!=EOF){
		A=atoi(C);
		if(A)
			*S++=A;
		else
			printf("%d\n",*--S);
	}
	return 0;
}

Measured memory_bytes: 548
#include<bits/stdc++.h>
using namespace std;
string S[2];int k,n,x[4][99999][2],sum,p[4]={1,10,100,1000},q[4],i,j,l,h;char T[15]="0123456789ixcm";
int main(){
	cin>>n;
	for(i=0;i<n;i++){
		cin>>S[0]>>S[1];
		for(h=0;h<2;h++){
			k=1;
			for(l=0;l<S[h].size();l++){
				for(j=0;j<14;j++){
					if(S[h][l]==T[j]){
						if(j/10){
							x[j-10][i][h]+=k;k=1;
						}
						else{
							k=j;
						}
					}
				}
			}
		}
		sum=0;
		for(j=0;j<4;j++){sum+=(x[j][i][0]+x[j][i][1])*p[j];}
		for(j=0;j<4;j++){q[j]=(sum/p[j])%10;}
		for(j=3;j>=0;j--){if(q[j]>=2){cout<<q[j];}if(q[j]){cout<<T[10+j];}}cout<<endl;
	}
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int allsum(int n){
    int sum = 0;
    repi(i, 1, n+1) sum += i;
    return sum;
}

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

    int dt = b - a - 1;
    int ca = a;
    int tall = allsum(dt);
    while(true){
        if(a == tall){
            cout << a - ca << endl;
            break;
        }
        a ++;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const long long Maxn=100;
long long n,m=1ll,a[Maxn];
inline long long read()
{
	long long s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int main()
{
	n=read();
	long long cur=(long long)26;
	while(cur<=n)cur*=(long long)26,++m;
	cur/=(long long)26,--m;
	for(long long i=m;i>=0;--i)
	{
		a[i]=n/cur,n%=cur;
		cur/=(long long)26;
	}
	for(long long j=1;j<=m+5;++j)
	for(long long i=m;i;--i)
	{
		if(!a[i-1])
		a[i-1]=(long long)26,a[i]--;
	}
	m+=5;
	while(!a[m])--m;
	for(long long i=m;i>=0;--i)
	putchar(a[i]+'a'-1);
	puts("");
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  cout << (++a+b)/2 << endl;
}

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

int main() {
  string s;
  cin >> s;
  set<char> det;
  rep(i,s.size()) det.insert(s.at(i));
  if (det.size() == s.size()) cout << "yes\n";
  else cout << "no\n";
  return 0;
}


Measured memory_bytes: 256
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

LL fc[200000];

LL fact(LL a)
{
	if(fc[a]>0)
	return fc[a];
	
	if(a<=1)
	return 1;
	
	fc[a]=a*fact(a-1);
	
	return fc[a];
	
	
}

int main()
{
	iniarr(fc,200000);
	LL n;
	sclld(n);
	printf("%lld\n",fact(n));
	return 0;
}

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

int N,M,sum=0;
vector<int> A;

int main(){
    cin>>N>>M;
    A.resize(M);
    for(int i=0;i<M;i++){
        cin>>A[i];
        sum=sum+A[i];
    }
    if(sum<=N){
        cout<<N-sum<<endl;
    }else {
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 3684
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <map>
#include <math.h>

int main() {
  long int X;
  std::cin >> X;
  long int happyness = 0;
  happyness += (X/500)*1000;
  happyness += ((X%500)/5)*5;
  std::cout << happyness;
  return 0;
}

Measured memory_bytes: 256
local n = tonumber(io.read());
local count4, count7 = n // 4, n // 7;
local result = "No";

for i = 0, count4 do
    for j = 0 , count7 do
        if i * 4 + j * 7 == n then
            result = "Yes";
            goto exit
        end
    end
end

::exit::
print(result);

Measured memory_bytes: 760
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

// Print each element of a container.
template <typename Container>
void print(const Container& container)
{
    stringstream sstream;

    string delim("");
	for (const auto& element : container)
	{
		sstream << delim << element;
        delim = " ";
	}

    cout << sstream.str() << endl;
}

template <typename Container>
int selectionSort(Container& container)
{
    int count(0);

    for(auto it(begin(container)); it != end(container); ++it)
    {
        auto kt(it);

        for(auto jt(it); jt != end(container); ++jt)
        {
            if(*kt > *jt) kt = jt;
        }

        iter_swap(it, kt);
        
        if(it != kt) ++count;
    }

    return count;
}

int main()
{
    vector<int> v;

    int n;
    cin >> n;

    for(size_t i(0); i < n; ++i)
    {
        int x;
        cin >> x;

        v.push_back(x);
    }

    int count(selectionSort(v));

    print(v);

    cout << count << endl;

    return 0;
}

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

int main(){
    int i,data[10],best[3];
    for(i=0; i<10; i++){
        cin>>data[i];
    }
    for(i=0; i<3; i++){
        best[i] = 0;
    }
    for(i=0; i<10; i++){
        if(data[i] > best[0]){
            best[2] = best[1];
            best[1] = best[0];
            best[0] = data[i];            
        }
        else if(data[i] > best[1]){
            best[2] = best[1];
            best[1] = data[i];
        }
        else if(data[i] > best[2]){
            best[2] = data[i];
        }
    }
    for(i=0; i<3; i++){
        cout<<best[i]<<endl;
    }
    return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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 int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    vector<bool> a(26, false);
    for(int i = 0; i < s.length(); i++){
        int pos = int(s[i] - 'a');
        a[pos] = true;
    }

    for(int i = 0; i < 26; i++) {
        if(!a[i]){
            cout << char('a'+ i) << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void){
   int N,R;
   int result=0;
   scanf("%d %d",&N,&R);

   if(N>=10){
      printf("%d\n",R);
   }else{
      result=100*(10-N)+R;
      printf("%d\n",result);
   }

   return 0;
}


Measured memory_bytes: 1732