akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long int64;

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

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

int main() {
    long long a, b;
    cin >> a >> b;
    long long ans = lcm(a, b);
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

   int N;
   
   scanf("%d",&N);
   
   int i;
   int L[N];
   int max_L = 0;
   int sum = 0;
   for(i = 0;i < N;i++){
      scanf("%d",&L[i]);
      if(max_L < L[i]){
         max_L = L[i];
      }
      sum = sum + L[i];
   }
   
   if(sum - max_L > max_L){
      printf("Yes\n");
   }
   else {
      printf("No\n");
   }
   
   return 0;

}


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

using namespace std;

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

    if (abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
D = int(input())
# with open("sample1.in") as f:

last = [0 for i in range(26)]
s = [[0 for j in range(26)] for i in range(D)]
c = list(map(int, input().split(" ")))
result = []
# opened = []  #開催したやつを保存
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        #print(i, j, k)
        s[i][j] = int(k)
        # スコア計算
        
for i in range(D):  
    result.append(int(input()))
score_max=0
for i in range(D):
    #score_max = 0
    score_index = 0
    tmp=result[i]-1
    score=s[i][tmp]+(i + 1 - last[tmp]) * c[tmp]
    #print("score",s[i][tmp])
    for j in range(26):
        score -= (i + 1 - last[j]) * c[j]
    #print("score-",score)
    score_max+=score
    print(score_max)
    last[tmp] = i+1
    
    # print(s.index(max(s[i])))
    # print(result[i]+1)


Measured memory_bytes: 9308
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }
ll mod = 1000000007;
ll modsize;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

vector<ll> fac(modsize + 5);
vector<ll> inv(modsize + 5);
vector<ll> facinv(modsize + 5);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

template<class T>
class segtree {
	int n;
	vector<T> data;
	T def;
	function<T(T, T)> operation;
	function<T(T, T)> update;
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];
		T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
		return operation(c1, c2);
	}
public:
	segtree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}
	T operator[](int i) {
		return data[i + n - 1];
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	int n;
	cin >> n;
	cout << n * (n - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k;
char s[N];
int main()
{
    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    int ans=1;
    for(int i=1;i<n;i++)
        if(s[i]!=s[i+1]) ans++;
    ans=max(ans-k-k,1);
    printf("%d\n",n-ans);
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<math.h>

using namespace std;

int main(){
	int f=1,i;
	int foot[2];
	foot[0]=0;
	foot[1]=0;
	int ans=0,N;
	string x;
	while (1){
		cin >>N;
		ans=0;
		f=1;
		foot[0]=0;
		foot[1]=0;
		if(N==0)break;
		//Input
		for(i=0;i<N;i++){
			cin >> x;
			//cout << x << endl;
			if(x=="lu"){
				foot[0]++;
				if(f==1 && foot[1]==1){
					ans++;
					f=0;
				}
			}
			else if(x=="ru"){
				foot[1]++;
				if(f==1 && foot[0]==1){
					ans++;
					f=0;
				}
			}
			else if(x=="ld"){
				foot[0]--;
				if(f==0 && foot[1]==0){
					ans++;
					f=1;
				}
			}
			else{
				foot[1]--;
				if(f==0 && foot[0]==0){
					ans++;
					f=1;
				}
			}
		}
		cout << ans <<endl;
	}
	return 0;
}

Measured memory_bytes: 3100
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, Y) = nextLongList()
    var x = Y / 10000
    var y = (Y % 10000) / 5000
    var z = ((Y % 10000) % 5000) / 1000
    while (x > 0 && x + y + z <= N - 9) {
        x--
        z += 10
    }
    while (y > 0 && x + y + z <= N - 4) {
        y--
        z += 5
    }
    while (x > 0 && x + y + z <= N - 1) {
        x--
        y += 2
    }
    if (x + y + z == N) {
        println("$x $y $z")
    } else {
        println("-1 -1 -1")
    }
}

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

int main() {
    int N;
    cin >> N;
    int sum = 0;
    map<string,int> ma;
    rep(i,N){
        string s;
        int t;
        cin >> s >> t;
        sum += t;
        ma[s] = sum;
    }
    string x;
    cin >> x;
    cout << sum - ma[x] << endl;

    return 0;
}

Measured memory_bytes: 256
list = [int(input()) for i in range(5)]
k = int(input())
n = 1
def calc(list):
  for i in range(0,4):
    for j in range(1,5):
      if list[j]-list[i] >k:
        return ':('
      else:
        continue
  return 'Yay!'
 
print(calc(list))  



Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <algorithm>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=1e3+10;
ll num[mx];


int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n;
cin>>n;
for(ll i=0;i<n;i++) cin>>num[i];
ll qn;
cin>>qn;
for(ll i=1;i<=qn;i++){
    ll b, m, e;
    cin>>b>>m>>e;
    rotate(num+b, num+m, num+e);
}
for(ll i=0;i<n;i++){
    if(0==i) printf("%lld", num[i]);
    else printf(" %lld", num[i]);
}
puts("");

#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 3280
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ubo upper_bound
#define lbo lower_bound
#define VI vector<int>
#define VL vector<ll>
#define VP vector<pii >
#define all(x) x.begin(), x.end()
#define M vector<VI >

using namespace std;

int main(){

	ll x, k, d;
	cin >> x >> k >> d;

	x = abs(x);

	ll h = 0;
	for(int i=0; i<55; i++){
		ll t = 1;
		while((h+2*t)*d <= x) t*=2;
		if((h+t)*d <= x) h += t;
	}

	ll ans = x-min(h, k)*d;
	if(h < k){
		k -= h;
		if(k&1) ans = abs(ans-d);
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 3628
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, A: "List[int]"):
    tmp = []
    for i in range(N):
        tmp.append([A[i], i])
    tmp.sort()
    ret = ' '.join([str(t[1] + 1) for t in tmp])
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


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

int main(){
  long long n;
  cin>>n;
  vector<long>A(n);
  
  for(int i=0;i<n;i++){
    cin >> A.at(i);
  }
 
  long long sum=0;
  long long m=0;
  for(int i=0;i<n;i++){ 
    
    if(m>=A[i]) sum += m-A[i];
    else if(m<A[i]) m=A[i];
  }
  cout<<sum<<endl;
 return 0;
}



Measured memory_bytes: 4844
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(0, c - (a - b)) << endl;
  return 0;
}


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

		for(int i=N; i>0; i--){
			double ans = Math.sqrt(i);
			if(ans%1==0){
				System.out.println(i);
				return;
			}
		}
	}
}


Measured memory_bytes: 23508
// Hovalhagh
// Ya Aziz & Hakim
// AliReza Kaboli

#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	for (int i = 0; i < n; ++i)
		cout << s[i] << t[i];
	cout << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

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

    int ans = 0;
    rep(i, N) {
        int x;
        cin >> x;
        ans += min(x*2,(K-x)*2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define size(x) int(x.size())
typedef long long ll;
using namespace std;
int main(){
    string S,T;
    cin >> S;
    cin >> T;
    int ans = 0;
    REP(i,3){
        if(S[i] == T[i]){
            ans++;
        }
    }
    cout << ans <<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, M = map(int, input().split())
    al = list(map(int, input().split()))
    bl = list(map(int, input().split()))
    disc = []
    for i in range(M):
        x, y, c = map(int, input().split())
        disc.append({"x": x, "y": y, "c": c})

    # 割引券なしの最小値
    a_min = min(al)
    b_min = min(bl)
    ans = a_min + b_min

    # 割引券をつかう場合
    for d in disc:
        c = al[d["x"] - 1] + bl[d["y"] - 1] - d["c"]
        ans = min(ans, c)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 51104
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vector<int> a(n), b(n);
  cin >> a >> b;
  ll pos = 0, neg = 0;
  for (int i = 0; i < n; ++i) {
    a[i] -= b[i];
    if (a[i] > 0)
      pos += a[i];
    else
      neg += -a[i] / 2 * 2;
  }
  cout << (pos * 2 <= neg ? "Yes" : "No");

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
    long answer = 0;
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long w = long.Parse(input[0]);
		long h = long.Parse(input[1]);
    long wMemo = h+1;
    long hMemo = w+1;
    long[][] pathArray = new long[w+h][];
    for(long i = 0; i < w+h; i++)
    {
      pathArray[i] = new long[2];//0は横、1は縦
    }

    for(long i = 0; i < w; i++)
    {
      pathArray[i][0] = long.Parse(Console.ReadLine());
      pathArray[i][1] = 0;
    }

    for(long i = w; i < w+h; i++)
    {
      pathArray[i][0] = long.Parse(Console.ReadLine());
      pathArray[i][1] = 1;
    }

    Array.Sort(pathArray, (a, b) => a[0].CompareTo(b[0]));

    for(long i = 0; i < w+h; i++)
    {
      if(pathArray[i][1] == 0)
      {
        hMemo--;
        answer += pathArray[i][0] * wMemo;
      }else
      {
        wMemo--;
        answer += pathArray[i][0] * hMemo;
      }
    }  

		Console.WriteLine(answer);
	}
}

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

int c[3];

int main(){
    int cnt=1;
    cin>>c[0];
    bool flag=false;
    for(int i=1;i<3;i++){
        cin>>c[i];
        for(int j=0;j<i;j++){
            if(c[j]==c[i])flag=true;
        }
        if(!flag)cnt++;
        flag=false;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define task "tst"
using namespace std;
const ll N = 2e5 + 9;
const ll inf = 1e6 + 7;
typedef pair<ll,ll> LL;
ll n,m,v,p,a[N],i;
ll ans,maxx,cnt;
bool lf(ll x,ll y){
    return x > y;
}
bool chk(ll mid){
    multiset<ll> s;
    vector<ll> res;
    ll cnt = 0,bigger = 0;
    for (i = 1;i <= n;i++){
        ll p = min(m,a[mid] + m - a[i]);
        if (p < 0) bigger++;
        s.insert(max(0ll,p));
    }
    while(s.size() > n - p + 1){
        res.push_back(m);
        s.erase(s.begin());
    }
    for (auto i : res) s.insert(i);
    while(!s.empty()){
        cnt += *s.begin(); s.erase(s.begin());
    }
    return (cnt >= m*v&&bigger < p);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>n>>m>>v>>p;
    for (i = 1;i <= n;i++){
        cin>>a[i];
    }
    sort(a + 1,a + n + 1,lf);
    ll l,mid,h;
    l = 1; h = n;
    while(l <= h){
        mid = (l + h)/2;
        if (chk(mid)) l = mid + 1;
        else h = mid - 1;
    }
    cout<<h;
}


Measured memory_bytes: 6816
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            //var n = Read<long>();
            //var s = Read();
            //var als = Read<long>(n);
            //var sls = Read(n);
            /*List<Tuple<string, long>> scls = new List<Tuple<string, long>>();
            for (int i = 0; i < m; ++i)
            {
                scls.Add(new Tuple(Read(), Read<long>()));
            }*/
            //List<List<long>> abls = new List<List<long>>();
            //List<long> cls = new List<long>();
            /*List<long> edgeNum = Enumerable.Repeat(0L, (int)n).ToList();
            for (int i = 0; i < n - 1; ++i)
            {
                abls.Add(Read<long>(2));
                abls[i].Add(i);
                abls[i].Add(-1);
                --abls[i][0];
                --abls[i][1];
                //cls.Add(Read<long>());
                ++edgeNum[(int)abls[i][0]];
                ++edgeNum[(int)abls[i][1]];
            }*/

            //als.Sort((l, r) => (int)(r - l));

            var als = Read<long>(3);


            Console.WriteLine(als.Distinct().Count() == 2 ? "Yes" : "No");
        }

        static IEnumerator<string> input_iter;

        static IEnumerator<string> LazyLoadAllLines(bool doSplit = true)
        {
            string line;
            if (doSplit)
            {
                do
                {
                    line = Console.ReadLine();
                    foreach (var s in line.Split(' '))
                        yield return s;
                } while (line != null);
            }
            else
            {
                do
                {
                    line = Console.ReadLine();
                    yield return line;
                } while (line != null);
            }
        }
        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        static List<_T> Read<_T>(long num) where _T : struct
        {
            List<_T> res = new List<_T>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add((_T)Convert.ChangeType(input_iter.Current, typeof(_T)));
            }
            return res;
        }
        static List<string> Read(long num)
        {
            List<string> res = new List<string>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add(input_iter.Current);
            }
            return res;
        }

    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

map<string,int> memo;

void write_memo(vector<string>& ids, vector< vector<int> >& tab) {
	for (int i = 0; i < ids.size(); ++i) {
		int row = 0;
		int col = 0;
		for (int j = 0; j < ids[i].length(); ++j) {
			col = ids[i][j] - '0';
			row = tab[row][col];
		}
		memo[ids[i]] = row;
	}
}

bool check_ssn(string id, vector< vector<int> >& tab) {
	int base = memo[id];
	for (int i = 0; i < id.length(); ++i) {
		for (int j = '0'; j <= '9'; ++j) {
			string temp = id;
			if ((char)j != temp[i]) {
				temp[i] = j;
				if (tab[memo[temp]][base] == 0) {
					return false;
				}
			}
		}
	}

	for (int i = 0; i < 10; ++i) {
		if (i != base) {
			if (tab[base][i] == 0) {
				return false;
			}
		}
	}

	for (int i = 0; i < id.length()-1; ++i) {
		string temp = id;
		if (temp[i] != temp[i+1]) {
			char c = temp[i];
			temp[i] = temp[i+1];
			temp[i+1] = c;
			if (tab[memo[temp]][base] == 0) {
				return false;
			}
		}
	}

	string temp = id;
	if (temp[3] != base + '0') {
		temp[3] = base + '0';
		if (tab[memo[temp]][id[3]-'0'] == 0) {
			return false;
		}
	}

	return true;
}

int main(void) {
	vector< vector<int> > tab(10,vector<int>(10));
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			cin >> tab[i][j];
		}
	}

	vector<string> ids;
	for (int i = 0; i < 10000; ++i) {
		string str = to_string(i);
		int ml = 4 - str.length();
		string temp = "";
		for (int j = 0; j < ml; ++j) {
			temp += "0";
		}
		ids.push_back(temp+str);
	}
	write_memo(ids,tab);

	int res = 0;
	for (int i = 0; i < ids.size(); ++i) {
		if (!check_ssn(ids[i],tab)) {
			++res;
		}
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 4852
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    string S;
    cin>>S;
    if(S=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}


Measured memory_bytes: 3632
N = input()[::-1]
l = len(N)
dp = [[0,0] for i in range(l+1)]

for i in range(l):
    dp[i+1][0] = min(dp[i][0] + int(N[i]), dp[i][1] + int(N[i]) + 1)
    if i == 0:
        dp[i+1][1] = 10 - int(N[i])
    else:
        dp[i+1][1] = min(dp[i][0] + 10 - int(N[i]), dp[i][1] + 9 - int(N[i]))

print(min(dp[-1][0],dp[-1][1]+1))


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

int main() {
  int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++) {
    int a,b;
    cin>>a>>b;
    ans+=(b-a+1);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
ABCD = input()
op ="+-"
for i in range(pow(2, 3)):
  v = i
  f = str(ABCD[0])
  for j in range(1,4):
    f += op[v%2] + ABCD[j]
    v //= 2
  if eval(f) == 7:
    print("{}=7".format(f))
    break


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

ll bargar[51];
ll patty[51];

ll get_patty(ll n, ll x){
	if (n == 0) return 1;
	if (x == 1) return 0;
	else if (x <= bargar[n-1]+1) return get_patty(n-1, x-1);
	else if (x == bargar[n-1]+2) return patty[n-1] + 1;
	else if (x <= 2*bargar[n-1]+2) return get_patty(n-1, x-bargar[n-1]-2) + patty[n-1] + 1;
	else return 2*patty[n-1] + 1;
}


int main(){
	ll n, x;
	cin >> n >> x;
	bargar[0] = 1;
	patty[0] = 1;

	for (int i = 1; i <= 50; i++){
		bargar[i] = 3 + 2*bargar[i-1];
		patty[i] = 1 + 2*patty[i-1];
	}

	cout << get_patty(n, x) << endl;
 	return 0;
 }




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <stdio.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define sz size()
using namespace std;
typedef long long ll;
///////////////////////////////////////////
int n;
int a[300400];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        a[x+1]++;
        a[x-1]++;
        a[x]++;
    }
    int ans=-999;
    for(int i=0;i<=300300;i++){
        ans=max(ans,a[i]);
    }
    cout<<ans<<endl;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000003LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

long long power(long long _x, long long _n){
    long long res = 1;
    _x %= MOD;
    while(_n > 0LL){
        if(_n & 1LL){
            res *= _x;
            res %= MOD;
        }
        _x *= _x;
        _x %= MOD;
        _n >>= 1;
    }
    return res;
}

lint fact[MOD], inv_fact[MOD];

lint getfact(lint n){
    if(n >= MOD){
        return 0LL;
    }
    return fact[n];
}

lint getinv(lint n){
    if(n >= MOD){
        return 0LL;
    }
    return inv_fact[n];
}

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

    fact[0] = 1;
    inv_fact[0] = 1;
    REP(i, 1, MOD){
        fact[i] = i * fact[i - 1] % MOD;
        inv_fact[i] = power(fact[i], MOD - 2);
    }

    int q;
    cin >> q;
    rep(I, q){
        lint x, d, n;
        cin >> x >> d >> n;
        if(x == 0LL){
            cout << 0 << endl;
            continue;
        }else if(d == 0LL){
            cout << power(x, n) << endl;
            continue;
        }
        lint ans = power(d, n);
        lint tmp = x * power(d, MOD - 2) % MOD;
        ans = ans * getfact(tmp + n - 1) % MOD;
        ans = ans * getinv(tmp - 1) % MOD;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 16512
#include <iostream>

using namespace std;

int N;
int a[500][3];
int b[500];

int main(){
    cin >> N;
    for(int i=0;i<N-1;i++){
        for(int j=0;j<3;j++){
            cin >> a[i][j];
        }
    }
    b[N-1] = 0;
    for(int i=0;i<N-1;i++){
        int t = 0;
        for(int j=i;j<N-1;j++){
            if(t <= a[j][1]){
                t = a[j][1];
            }else{
                if(t % a[j][2] != 0) t = (a[j][2] - t % a[j][2]) + t;
            }
            t += a[j][0];
        }
        b[i] = t;
    }
    for(int i=0;i<N;i++){
        cout << b[i] << endl;
    }
    return 0;
}

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

int main()
{
	int n,i,j,s=0,maxv=0;
	cin>>n; 
	
	int a[3][n+1];
	for(i=1;i<=2;i++)
	   for(j=1;j<=n;j++)
	   cin>>a[i][j]; 
	
	for(i=1;i<=n;i++){
		s=0;
		for(j=1;j<=i;j++)
		  s+=a[1][j];
		for(j=i;j<=n;j++)
		   s+=a[2][j];
		   
		if(s>maxv) maxv=s;
		
	}
	cout<<maxv;
	
	return 0;
}

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

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


Measured memory_bytes: 384
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
struct Node {
    int va;
    struct Node *before;
    struct Node *next;
};
    
struct Node *note;
    
void insert(int va) {
    struct Node *x = (struct Node *)malloc(sizeof(struct Node));
    x->va = va;
    note->next->before = x;
    x->next = note->next;
    note->next = x;
    x->before = note;
}
    
struct Node* search(int va) {
    struct Node *x = note->next;
    while(x != note && x->va != va ) {
        x = x-> next;
    }
    return x;
}
    
void deleteNode(struct Node *t) {
    if (t == note) return;
    t->before->next = t->next;
    t->next->before = t->before;
}
 void deleteva(int va) {
    deleteNode(search(va));
}  
void deleteFirst() {
    deleteNode(note->next);
}
    
void deleteLast() {
    deleteNode(note->before);
}
    
void print() {
    struct Node *x;
    x = note->next;
    int i = 0;
    while(1) {
        if (x == note) break;
        if(i++ > 0) printf(" ");
        printf("%d", x->va);
        x = x->next;
    }
    printf("\n");
}
    
    
int main(void) {
    int va, n;
    char order[20];
    scanf("%d", &n);
    note = (struct Node *)malloc(sizeof(struct Node));
    note->next = note;
    note->before = note;
    for (int i = 0; i < n; i++) {
        scanf("%s%d",order, &va);
        if(order[0] == 'i') {
            insert(va);
        }else if(order[0] == 'd') {
            if(strlen(order) > 6) {
                if( strlen(order) > 10) {
                    deleteFirst();
                }else if( strlen(order) > 9) {
                    deleteLast();
                }
            }else {
                deleteva(va);
            }
        }
    }
    print();
    return 0;
}

Measured memory_bytes: 36064
s = input()
t = input()

s_char = [x for x in s]
t_char = [x for x in t]

s_char.sort()
t_char.sort(reverse=True)

new_s = ''
new_t = ''

for x in s_char:
    new_s += x

for x in t_char:
    new_t += x

print('Yes' if new_s < new_t else 'No')


Measured memory_bytes: 8932
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  ll n;
  cin >> n;
  multiset<ll> gr;
  ll ans = 0;
  vl v(n);
  REP(i,n) cin >> v[i];
  sort(ALL(v));
  REP(i,n){
    ll tmp = v[v.size()-i-1];
    ll t = 1;
    bool flag = false;
    REP(j,30){
      t <<= 1;
      auto itr = gr.find(abs(tmp-t));
      if(itr!=gr.end()){
        flag = true;
        gr.erase(itr);
        ++ans;
        break;
      }
    }
    if(!flag){
      gr.insert(tmp);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 11136
#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 s(M), c(M);
    rep(i, M)
    {
        cin >> s[i] >> c[i];
    }
    int Max = pow(10, N) - 1, Min = pow(10, N - 1);
    if (N == 1)
    {
        Max = 9;
        Min = 0;
    }
    int ans = 0;
    rep2(i, Min, Max + 1)
    {
        string str = to_string(i);
        rep(j, M)
        {
            if (str[s[j] - 1] - '0' != c[j])
            {
                goto L;
            }
        }
        cout << i;
        return 0;
    L:;
    }
    cout << -1;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define repi(i,a,n) for(int i = (int)a; i < (int)(n); i++)

typedef long long ll;

int main(void){
    int n;
    string s;
    std::cin >> n >>s;
    if(n%2==1){
        std::cout << "No" << std::endl;
        return 0;
    }
    for (int i = 0; i < n/2; i++) {
        if(s[i]!=s[i+n/2]){
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::endl;

    
}

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

int main(void){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    
    int ans_ws = 1, ans_sg = 0;
    int water, sugar;
    int i, j, k, l;
    for(i = 0; i * a * 100 <= f; i++){
        for(j = 0; (i * a + j * b) * 100 <= f; j++){
            if(i == 0 && j == 0){
                continue;
            }
            
            water = (i * a + j * b) * 100;
            
            for(k = 0; water + k * c <= f; k++){
                for(l = 0; water + k * c + l * d <= f; l++){
                    sugar = k * c + l * d;
                    if(sugar * 100 > water * e){
                        break;
                    }
                    
                    if(100.0 * sugar / (water + sugar) >= 100.0 * ans_sg / ans_ws){
                        ans_ws = water + sugar;
                        ans_sg = sugar;
                    }
                }
            }
        }
    }
    
    cout << ans_ws << " " << ans_sg << endl;
    
    return 0;
}


Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())

G = [[] for _ in range(N + 1)]

for _ in range(M):
    l, r, d = map(int, input().split())
    G[l].append((r, -d))
    G[r].append((l, d))


MIN = -10 ** 18

lst = [MIN] * (N + 1)

que = deque()

for i in range(1, N + 1):
    if lst[i] == MIN:
        que.append(i)
        lst[i] = 0

    while que:
        tmp = que.popleft()
        for next_, d in G[tmp]:
            if lst[next_] == MIN:
                lst[next_] = lst[tmp] + d
                que.append(next_)
                continue
            
            if lst[next_] == lst[tmp] + d:
                continue
            else:
                print ('No')
                exit()

print ('Yes')


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

int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int o = n - 1; o >= 0; o--) {
    if (o != 0) cout << arr[o] << " ";
    else cout << arr[o];
  }
  cout << endl;
}


Measured memory_bytes: 3096
n,m=map(int,input().split())
adj=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)


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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> dp(10);
  for(int i=0; i<k; i++){
    int tmp;
    cin >> tmp;
    dp.at(tmp) = 1;
  }
  
  int answer = n;
  
  while(1){
    string s = to_string(answer);
    bool flag = 1;
    for(int i=0; i<s.size(); i++){
      int position = s.at(i) - '0';
      if(dp.at(position)==1){
        flag = 0;
        break;
      }
    }
    if(flag == 1) break;
    answer++;
  }
  
  cout << answer << endl;
  
}

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

int main() {
    long long a, b, c, cnt = 0;
    cin >> a >> b >> c;

    if (c == 0) {
        cout << b << endl;
        return 0;
    }

    for (long long i = 1; i <= c; i++) {
        cnt++;
        if (b != 0) {
            b--;
            cnt++;
        }
        else if (a != 0) {
            a--;
        }
        else break;

        if (i == c) cnt += b;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
class Main{
    public static void main(String args[])throws IOException{
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String s;
       char c;
       while((s = br.readLine())!=null){
           if(s.length()>=1200)break;
           for(int i=0; i<s.length(); i++){
                   c = s.charAt(i);
                   if(c>=0x41 && c<=0x5a){
                       c += 0x20;
                   }else if(c>=0x61 && c<=0x7a){
                       c -= 0x20;
                   }
                   System.out.print(c);
           }
       }
        System.out.println("");
    }
}

Measured memory_bytes: 17040
#include<stdio.h>
int main()
{
  int a,b;
  scanf("%d %d", &a, &b);
  double ave=(a+b)/2.0;
  if(ave==(a+b)/2) printf("%d\n", (a+b)/2);
  else printf("%d\n", 1+(a+b)/2);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

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

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

ll f(int x){
	return 1LL * x * (x + 1) / 2LL;
}

ll get(int limit, int val){
	int R = limit / val;
	return 1LL * val * f(R);
}

int main(){
	int n;
	ri(n);
	ll ans = f(n) - get(n, 3) - get(n, 5) + get(n, 15);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(int i=a; i<b; i++)
#define loopb(i, a, b) for(int i=a; i>=b; i--)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli power(lli x, lli y){
    lli res = 1;
    x = x ;
    while (y > 0) {
        if (y & 1)
            res = (res*x) ;
        y = y>>1;
        x = (x*x);
    }
    return res;
}
lli solve(){
	lli n;
	cin>>n;
	vll h(n), dp(n, 0);
	loop(i, 0, n)	cin>>h[i];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	loop(i, 2, n)	dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i]-h[i-1]));
	cout<<dp[n-1]<<"\n";
	return 0;
}
int main(){
	fastio;
	lli t;
//	cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}

Measured memory_bytes: 1792
use std::str::FromStr;

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

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn mod_pow(a : i64, b : i64, md : i64) -> i64 {
    if b == 0 { return 1; }
    if b % 2 == 0 {
        let h = mod_pow(a, b/2, md);
        return (h * h) % md;
    }
    else {
        return (a * mod_pow(a, b-1, md)) % md;
    }
}

fn mod_comb(a : i64,b : i64,md : i64) -> i64 {
    if a-b < b { return mod_comb(a,a-b,md); }
    let mut ans_mul = 1;
    let mut ans_div = 1;
    for i in 0..b {
        ans_mul *= a-i;
        ans_div *= i+1;
        ans_mul %= md;
        ans_div %= md;
    }
    return (ans_mul * mod_pow(ans_div, md-2, md)) % md;
}

fn main() {
    let v : Vec<i64> = get_vec();
    let n = v[0];
    let a = v[1];
    let b = v[2];
    let modn = 1000000007;
    let ans = (mod_pow(2,n,modn)-1 - mod_comb(n,a,modn) - mod_comb(n,b,modn)) % modn;
    println!("{}", (ans+modn)%modn);


}


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

int main(){
    int N;
    int i,num;
    N >= 1;
    N <= 200000;
    string S[200000];
    cin >> N;
    set <string> gift; 

    for(i=0;i<N;i++){
            cin >> S[i];
        }
    for(i=0;i<N;i++){
        gift.insert(S[i]);
    }
    num = gift.size();
    cout << num <<endl;
}

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

int main(){
  string s;
  cin >> s;
  
  int num = s.length() - 2;
  cout << s[0] << num << s[s.length()-1] << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
char b[100000+10];
int main()
{
    int a[30]={0},flag=1;
    int i;
    scanf("%s",b);
    int len=strlen(b);
    for(i=0;i<len;i++)
    {
        a[b[i]-'a']=1;
    }
    for(i=0;i<26;i++)
    {
        if(a[i]==0)
        {
            printf("%c\n",i+'a');
            flag=0;
            break;
        }
    }
    if(flag) printf("None\n");
}

Measured memory_bytes: 384
a = int(input())  # 500
b = int(input())  # 100
c = int(input())  # 50
x = int(input())
k = 0
for d in range(a + 1):
  for e in range(b + 1):
    for f in range(c + 1):
      if d * 500 + e * 100 + f * 50 == x:
        k += 1
print(k)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<queue>
using namespace std;
typedef pair<int,int> P;

int bfs();
int INF=1000000000;
int h,w,n;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int sx,sy;
int good[1111][1111];
int ans=0;
char life='0';
char mapp[1111][1111];

int main(){
  cin >> h >> w >> n;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> mapp[i][j];
      if(mapp[i][j] == 'S'){
	sy = i;
	sx = j;
      }
    }
  }
  for(int i=1;i<n+1;i++){
    life++;
    ans += bfs();
  }
  cout << ans << endl;
}


int bfs(){
  queue<P> que;
  que.push(P(sy,sx));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      good[i][j] = INF;
    }
  }
  good[sy][sx] = 0;
  
  while(que.size()){
    P p=que.front(); que.pop();
    if(mapp[p.first][p.second] == life){
      sy = p.first;
      sx = p.second;
      break;
    }
    for(int i=0;i<4;i++){
      int ny = p.first + dy[i];
      int nx = p.second + dx[i];
      if(0 <= nx && nx < w && 0 <= ny && ny < h && mapp[ny][nx] != 'X' && good[ny][nx] == INF){
	que.push(P(ny,nx));
	good[ny][nx] = good[p.first][p.second] + 1;
      }
    }
  }
  return good[sy][sx];
}

Measured memory_bytes: 6652
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)

const int kMaxN = 100;

int n, a, b;
string ans;

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

  if ((a-b)%2 == 0) {
    ans = "Alice";
  } else {
    ans = "Borys";
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N){
        cin >> a[i];
        a[i]--;
    }
    int ans = 0;
    REP(i, N) if(a[a[i]] == i) ans++;
    cout << ans/2 << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll r;
    cin>>r;
    if(r<1200){cout<<"ABC"<<endl;}
    else if(r<2800){cout<<"ARC"<<endl;}
    else{cout<<"AGC"<<endl;}
    
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  int pos;
  int count1=0,count2=0;
  
  for(int i=0; i<s.size(); i++){
    pos = i;
    if( pos%2 == 0){
      if( s.at(i) =='0'){
        count1++;
      }
    }else if( pos%2 == 1){
      if( s.at(i) =='1'){
        count1++;
      }
    }
  }
  
  for(int i=0; i<s.size(); i++){
    pos = i;
    if( pos%2 == 0){
      if( s.at(i) =='1'){
        count2++;
      }
    }else if( pos%2 == 1){
      if( s.at(i) =='0'){
        count2++;
      }
    }
  }
  
  if(count1 <= count2){
    cout << count1 << endl;
  }else{
    cout << count2 << endl;
  }
   
}

Measured memory_bytes: 512