akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int w = in.nextInt();
		int n = in.nextInt();

		int[] x = new int[w];
		for (int i=0; i<w; i++) {
			x[i] = i + 1;
		}

		while (n-- > 0) {
			String[] str = in.next().split(",");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			int t = x[a];
			x[a] = x[b];
			x[b] = t;
		}

		for (int ans : x) {
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26124
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector<pint>v[101010];
ll dist[101010];
void dfs(int x,int par){
    for(auto to:v[x]){
        if(to.first==par)continue;
        dist[to.first]=dist[x]+to.second;
        dfs(to.first,x);
    }
}
int main(){
    int n;
    cin>>n;
    int a,b,c;
    rep(i,n-1){
        cin>>a>>b>>c;
        --a;--b;
        v[a].push_back({b,c});
        v[b].push_back({a,c});
    }
    int q,k;
    cin>>q>>k;
    dfs(k-1,-1);
    while(q--){
        int x,y;
        cin>>x>>y;
        cout<<dist[--x]+dist[--y]<<endl;
    }
    return 0;
}

Measured memory_bytes: 12800
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    ll n;
    cin >> n;
    ll answer = 1;
    ll diff = 1;
    ll difff = 1;
    if(n==1){
        cout << 0 << endl;
        return 0;
    }
    REP(i,n){
        answer = (answer * 10) %MOD;
        diff = (diff * 9) % MOD;
        difff = (difff * 8) %MOD;
    }
    answer-=diff;
    if(answer<0)answer+=MOD;
    answer-=diff;
    if(answer<0)answer+=MOD;
    answer = (answer + difff)%MOD; 
   
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3632
def abc_134c(N):
    max_1 = (0, 0)
    max_2 = (0, 0)
    for i in range(N):
        buf = int(input())
        if max_2[1] < buf:
            if max_1[1] < buf:
                max_2 = max_1
                max_1 = (i, buf)
            else:
                max_2 = (i, buf)

    output = [max_1[1] for _ in range(N)]
    output[max_1[0]] = max_2[1]
    [print(output[i]) for i in range(N)]


if __name__ == "__main__":
    N = int(input())
    abc_134c(N)


Measured memory_bytes: 7776
mi = lambda : map(int, input().split())

l, r = mi()

if r-l>2019:
    r = l+2019

ans = 2018
for i in range(l, r+1):
    for j in range(l, r+1):
        if i<j and ans>(i*j)%2019:
            ans = (i*j)%2019
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
                                                                                                
  
int main(void){
                                                                                                
   
    long long n, i;

    long long p = 1;
   
      
    scanf("%lld", &n);


    for( i = 1 ; i <= n ; i = i + 1 ){

         p = p * i % ( 1000000000 + 7 );

         }
   

    printf("%lld\n", p );


    return 0;
                                                          
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;

const long long MOD = 1000000007;

long long rapidPow(long long x, long long n, long long mod){
    //x ^ nを高速で求める
    //適宜modを取る
    long long ans = 1;
    while(n > 0){
        if(n & 1){
            ans = ans * x;
            if(ans >= mod){
                ans %= mod;
            }
        }
        x *= x;
        if(x >= mod){
            x %= mod;
        }
        n >>= 1;
    }
    return ans;
}

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

    ll ans = 0;

    ll t1 = rapidPow(10, n, MOD);
    ll t2 = rapidPow(9, n, MOD);
    ll t3 = rapidPow(8, n, MOD);
    ans = t1 - 2 * t2 + t3;
    while(ans < 0){
        ans += MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)


int main()
{
	int N;
	vector<int> a;
	cin >> N;
	REP(i, 0, N) {
		int aa;
		cin >> aa;
		a.push_back(aa);
	}

	int over = 0;
	bool color[8];
	REP(i, 0, 8) color[i] = false;
	REP(i, 0, N) {
		if (a[i] < 3200) color[a[i] / 400] = true;
		else over++;
	}

	int sum = 0;
	REP(i, 0, 8) {
		if (color[i]) sum++;
	}

	cout << max(1, sum) << " " << sum + over << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    s = input()
    flag = True

    for i in range(len(s)):
        if flag:
            if s[i] == "C":
                flag = False
        else:
            if s[i] == "F":
                print("Yes")
                exit()
    else:
        print("No")


if __name__ == "__main__":
    main()


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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  vector<int> cnt(1000001, 0);
  int prev = -1;
  for (int i = 0; i < N; i++) {
    cnt.at(A.at(i))++;
    if (A.at(i) == prev) continue;
    // A[i] の倍数には 1 加算
    for (int j = 2 * A.at(i); j <= 1000000; j += A.at(i)) {
      cnt.at(j)++;
    }
    prev = A.at(i);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (cnt.at(A.at(i)) == 1) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7988
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    auto dfs = [&](auto && self, string s, char mc) ->void{
        if(s.size() == n) cout << s << endl;
        else{
            for(char c='a';c<=mc;c++){
                if(c == mc) self(self, s + c, char(mc+1));
                else self(self, s + c, mc);
            }
        }
    };
    string S = "";
    dfs(dfs, S, 'a');
}


Measured memory_bytes: 1536
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
typedef pair<int, int> P;

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

    int n, m;
    cin >> n >> m;

    vector <int> d(n);
    vector <P> d_sort(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
        d_sort[i] = P(d[i], i);
    }

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

    vector < vector <P> > edge(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        edge[u].push_back(P(i, v));
        edge[v].push_back(P(i, u));
    }

    vector <int> color(n, -1);
    vector <int> ans(m, 1000000000);

    vector <int> visited(n, false);
    for (int i = 0; i < n; i++) {
        int idx = d_sort[i].second;
        if (visited[idx]) continue;

        bool exist = false;
        for (P p : edge[idx]) {
            if (visited[p.second]) {
                color[idx] = (color[p.second] + 1) % 2;
                visited[idx] = true;
                exist = true;
                ans[p.first] = d_sort[i].first;
                break;
            }
        }

        if (!exist) {
            bool ok = false;

            for (P p : edge[idx]) {
                if (d[p.second] == d_sort[i].first) {
                    ok = true;
                    ans[p.first] = d[p.second];
                    color[idx] = 0;
                    visited[idx] = true;
                    color[p.second] = 1;
                    visited[p.second] = true;
                    break;
                }
            }

            if (!ok) {
                cout << -1 << '\n';
                return 0;
            }
        }
    }

    for (int i = 0; i < n; i++) {
        if (color[i] == 0) {
            cout << 'B';
        } else {
            cout << 'W';
        }
    }

    cout << '\n';
    for (int i = 0; i < m; i++) cout << ans[i] << '\n';

    return 0;
}

Measured memory_bytes: 13056
AtoZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(input())
S = input()
Ans = ""

for i in range(len(S)):
    for k in range(26):
        if S[i] == AtoZ[k]:
            Ans += AtoZ[(k+N)%26]
    
print(Ans)

Measured memory_bytes: 41308
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;

vector<long long> PrimeFactorization(long long n) {
    vector<long long> res;
    long long t = n;
    for (long long i = 2; i * i <= t; ){
        if (n % i == 0) res.push_back(i), n /= i;
        else i++;
    }
    if(n != 1) res.push_back(n);
    return res;
}

long long factorial(long long n, long long mod) {
    long long ret = 1;
    for (long long i = 1; i <= n; i++) {
        ret = (ret * i) % mod;
    }
    return ret;
}

long long inv_mod(long long n, long long mod) {
    long long a = n % mod, b = mod - 2, ret = 1;
    while (b > 0) {
        if (b & 1) ret = (ret * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ret;
}

long long nPr(long long n, long long r, long long mod) {
    long long ret = 1;
    for (long long i = n; i >= n - r + 1; i--) {
        ret = ret * (i % mod) % mod;
    }
    return ret;
}

long long nCr(long long n, long long r, long long mod) {
    return nPr(n,r,mod) * inv_mod(factorial(r,mod),mod) % mod;
}

long long nHr(long long n, long long r, long long mod) {
    return nCr(n+r-1,r,mod);
}

ll N,M;
const ll MOD = 1000000007LL;

int main () {

	cin >> N >> M;

	vector < ll > p = PrimeFactorization(M);
	map < ll,ll > cnt;
	REP(i,p.size()) cnt[p[i]]++;

	ll ans = 1LL;
	for (auto itr : cnt) {
		ans *= nHr(N, itr.second, MOD);
		ans %= MOD;
	}

	cout << ans << endl;


    return 0;
}

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

int main(void)
{
	int num;
	int employ_num;
	long long employ[4001], ef[4001];
	long long employ_money, employ_sell;
	int i;
	int flag;
	
	while (1){
		scanf("%d", &num);
		
		if (num == 0){
			break;
		}
		
		flag = 0;
		memset(employ, 0, sizeof(employ));
		memset(ef, 0, sizeof(ef));
		for (i = 0; i < num; i++){
			scanf("%d%lld%lld", &employ_num, &employ_money, &employ_sell);
			
			employ[employ_num] += employ_sell * employ_money;
			
			if (employ[employ_num] >= 1000000 && ef[employ_num] != 1){
				printf("%d\n", employ_num);
				flag = 1;
				ef[employ_num] = 1;
			}
		}
		
		if (flag != 1){
			printf("NA\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
n,k=io.read("*n","*n")
p=1 a={} b={} for i=1,n do a[i]=io.read("*n") b[i]=0 end
while 0<k do if k%2==1 then p=a[p] end k=k//2
for i=1,n do b[i]=a[a[i]] end
for i=1,n do a[i]=b[i] end
end print(p)

Measured memory_bytes: 10636
if __name__ == "__main__":
    n = int(input())
    x = 0

    for i in range(1, n + 1):

        if i % 3 == 0:
            print(f" {i}", end="")
        else:
            x = i
            while (x):
                if x % 10 == 3:
                    print(f" {i}", end="")
                    break
                x //= 10

    print()


Measured memory_bytes: 5884
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int n, m;
        cin >> n >> m;
        if (n == 0) return;

        vector<int> a(21), b(21);
        rep(i, 0, n) {
            int tmp;
            cin >> tmp;
            a[tmp]++;
        }
        rep(i, 0, m) {
            int tmp;
            cin >> tmp;
            b[tmp]++;
        }

        int ans = 0;
        for (int i = 0; i < 21; ++i) {
            ans += max(a[i], b[i]) * i;
        }
        cout << ans << endl;
        solve();
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}



Measured memory_bytes: 3112
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const ld eps = 1e-9;
const db PI = atan(1) * 4;

template<typename T, typename S>inline bool upmin(T&a, const S&b) { return a > b ? a = b, 1 : 0; }
template<typename T, typename S>inline bool upmax(T&a, const S&b) { return a < b ? a = b, 1 : 0; }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }
ll pow(ll a, ll b) {
	if (b == 0) {
		return 1;
	}
	if (b == 1) {
		return a;
	}
	ll ans = pow(a, b / 2);
	ans *= ans;
	ans *= b % 2 == 1 ? a : 1;
	return ans;
}

namespace SOLVE {
	void main() {
		int n, t, a, b;
		cin >> n >> t;
		VI amount(t + 5);
		REP(i, 0, n) {
			cin >> a >> b;
			amount[a]++;
			amount[b]--;
		}
		int current = 0;
		int ans = 0;
		REP(i, 0, t + 5) {
			current += amount[i];
			ans = max(ans, current);
		}
		cout << ans << endl;

	}
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	//    in(t);
	t = 1;
	while (t--) {
		SOLVE::main();

	}

	return 0;
}



Measured memory_bytes: 3356
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
	int n;
	cin>>n;
	int a,b;
	a=n/100;
	b=n%100;
	if(a<13&&a>0){
		if(0<b&&b<13){
			cout<<"AMBIGUOUS"<<endl;
		}else{
			cout<<"MMYY"<<endl;
		}
	}else{
		if(0<b&&b<13){
			cout<<"YYMM"<<endl;
		}else{
			cout<<"NA"<<endl;
		}
	}

	return 0;
}

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

using namespace std;

void solve()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while (cin >> n, n)
	{
		bool c[100001];
		for (int i = 0; i < n; ++i)
		{
			cin >> c[i];
			if ((i + 1) % 2 == 0)
			{
				if (i - 1 >= 0 && c[i - 1] != c[i])
				{
					for (int j = i - 1; j >= 0; --j)
					{
						if (c[j] == c[i])
						{
							break;
						}
						c[j] = c[i];
					}
				}
			}
		}
		cout << count(c, c + n, false) << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1288
#include<stdio.h>
#include<stdlib.h>
int main(){
	long long N, M, K, A[200200]={0}, B[200200]={0};
	scanf("%lld%lld%lld",&N,&M,&K);
	for(int i=0; i<N; i++){
		int a;
		scanf("%d",&a);
		A[i+1] = a + A[i];
	}
	for(int i=0; i<M; i++){
		int b;
		scanf("%d",&b);
		B[i+1] = b + B[i];
	}
	int ans = 0;
	for(int i=0; i<=N; i++){
		int l=-1, r=M+1;
		while(abs(l-r) > 1){
			int mid = (l+r)/2;
			if(A[i] + B[mid] > K)r = mid;
			else l = mid;
		}
		if(A[i] + B[l] <= K)ans = ans>(i+l)?ans:(i+l);
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin >> s;
    
    for (int i = s.size() - 2; i >= 2; i -= 2){
        int hf = i / 2;
        string a = s.substr(0, hf);
        string b = s.substr(hf, hf);
        if (a.compare(b) == 0) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}
        

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


int main(){
	string s;
	cin >> s;
	int a=s.size();
	int n=0;
	int m=0;
	int w=0;
	int e=0;
	for(int i=0;i<a;i++){
		if(s.at(i)=='N'){
			n++;
		}else if(s.at(i)=='S'){
			m++;
		}else if(s.at(i)=='E'){
			e++;
		}else if(s.at(i)=='W'){
			w++;
		}
	}
	if((n==0&&m!=0)||(n!=0&&m==0)||(e==0&&w!=0)||(e!=0&&w==0)){
		cout << "No" <<endl;
	}else{
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
//ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
//ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}


int main(){

  char x;
  cin >> x;
  x++;
  cout << x << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

bool prime(int x) {
  if (x <= 1) return false;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}

int main() {
  int x;
  cin >> x;
  while (!prime(x)) x++;
  cout << x << endl;
  return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<int> a(100002);
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    a[x]++;
  }
  int max=0;
  for(int i=1;i<=100000;i++){
    if(max<a[i]+a[i+1]+a[i-1])max=a[i]+a[i+1]+a[i-1];
    }
  cout << max << endl;
}

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

using namespace std;

const int N = 15;

int n;
int a[N];
int res;
int t[N];

void backtrack(int pos) {
  if (pos == n + 1) {
    long long s = 1;
    for (int i = 1; i <= n; i++) {
      if (t[i] == 0) {
        s *= a[i];
      } else if (t[i] == 1) {
        s *= (a[i] - 1);
      } else {
        s *= (a[i] + 1);
      }
    }
    if (s % 2 == 0) ++res;
  } else {
    for (int i = 0; i < 3; i++) {
      t[pos] = i;
      backtrack(pos + 1);
    }
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  backtrack(1);
  printf("%d", res);
  return 0;
}

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

int pre[100001],d[100001];

int find(int x){
  if(pre[x]==x) return x;
  int fx=find(pre[x]);
  d[x]+=d[pre[x]];
  return pre[x]=fx;
}

int main(){
  int n,m;
  cin>>n>>m;
  for(int i=1;i<=n;i++) pre[i]=i;
  int l,r,dd,fl,fr;
  for(int i=0;i<m;i++){
    cin>>l>>r>>dd;
    fl=find(l);
    fr=find(r);
    if(fl==fr){
      if(d[r]-d[l]!=dd){
        cout<<"No";
        return 0;
      }
    } else {
      pre[fr]=pre[fl];
      d[fr]=dd-(d[r]-d[l]);
    }
  }
  cout<<"Yes";
  return 0;
}


Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#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 FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 2019

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}
ll getPow(ll a, ll b){
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll d = getPow(a, b / 2);
		return (d*d) % MOD;
	}
	else {
		return (a*getPow(a, b - 1))%MOD;
	}
}


int main() {
	int l,r;
	scanf("%d%d", &l, &r);
	FOR(i, l, r + 1) {
		if (i%MOD == 0) {
			PRINTD(0);
			return 0;
		}
	}

	l %= MOD;
	r %= MOD;
	int ans = INF;
	FOR(i, l, r) {
		FOR(j, i + 1, r + 1) {
			ans = Min(ans, (i*j) % MOD);
		}
	}

	PRINTD(ans);

}


Measured memory_bytes: 128
n=int(input())
t = [list(map(int,input().split())) for i in range(n-1)]
for i in range(n-1):
  ans=t[i][1]+t[i][0]
  for j in range(i+1,n-1):
    if ans>=t[j][1]:
      ans+= -ans%t[j][2]+t[j][0]
    else:
      ans+=t[j][1]-ans+t[j][0]
  print(ans)
print(0)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int A,B,C,D,N,M;
int h[10000];
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> h[i];
  }
int max = 0;
int num = 0;
  for(int i = 0; i < N; i++) {
    if(max <= h[i]) {
      num++;
      max = h[i];
    }
  }
  cout << num;


  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
    static final long MOD = 1000000007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        final int[] a = new int[n];
        final TreeSet<Integer> set = new TreeSet<>();
        for (int i = 0; i < a.length; i++) {
            a[i] = scanner.nextInt();
        }

        final TreeMap<Integer, Integer> ints = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            final Integer floor = ints.floorKey(a[i]);
            if (floor == null) {
                ints.put(a[i], 1);
            } else if (floor == a[i]) {
                final Integer floor2 = ints.floorKey(a[i] - 1);
                if (floor2 == null) {
                    ints.put(a[i], ints.get(a[i]) + 1);
                } else {
                    final Integer val = ints.get(floor2);
                    if (val == 1) {
                        ints.remove(floor2);
                        ints.put(a[i], ints.get(floor) + 1);
                    } else {
                        ints.put(floor2, val - 1);
                        ints.put(a[i], ints.get(floor) + 1);
                    }
                }
            } else {
                final Integer val = ints.get(floor);
                if (val == 1) {
                    ints.remove(floor);
                    ints.put(a[i], 1);
                } else {
                    ints.put(floor, val - 1);
                    ints.put(a[i], 1);
                }
            }
            //System.out.println(ints);
        }
        System.out.println(ints.values().stream().reduce((i1, i2) -> i1 + i2).get());
    }
}


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

int main()
{
	int h,w;
	cin >> h >> w;
	char field[h][w];
	int visited[h][w];
	int whiteCount = 0;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> field[i][j];
			visited[i][j] = -1;
			if(field[i][j] == '.')
				whiteCount++;
		}
	}

	visited[0][0] = 1;
	queue<pair<int,int>> bfs;
	bfs.push(make_pair(0,0));
	while(!bfs.empty()){
		int y = bfs.front().first;
		int x = bfs.front().second;
		bfs.pop();
		if(y == h-1 && x == w-1){
			cout << whiteCount - visited[y][x] << "\n";
			return 0;
		}
		int dy[4] = {1,0,-1,0};
		int dx[4] = {0,1,0,-1};
		for(int i = 0; i < 4; i++){
			int ny = y + dy[i];
			int nx = x + dx[i];
			if(0 <= ny && ny < h && 0 <= nx && nx < w && field[ny][nx] != '#'){
				if(visited[ny][nx] == -1 || visited[ny][nx] > visited[y][x] + 1){
					visited[ny][nx] = visited[y][x] + 1;
					bfs.push(make_pair(ny,nx));
				}
			}
		}
	}

	cout << -1 << "\n";

	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 a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a+b<10){
            System.out.println(a+b);
        }else{
            System.out.println("error");
        }
    }
}

Measured memory_bytes: 23508
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <map>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define MAX_N 105
int vx [4]= {1,0,-1,0};
int vy [4]= {0,1,0,-1};
long long  dp[MAX_N][21]={};//dp[iテァツ閉ェテァツ崢ョテ」ツ?セテ」ツ?ァテ」ツ?ォ][テ・ツ?、]テッツシツ敕・ツ?凝ヲツ閉ー
int V[MAX_N],W[MAX_N];
int data[MAX_N],B[MAX_N];
int K ,N,a[MAX_N];
using namespace std;
void init(){

  cin >> N;
  cin >> a[1];
    dp[1][a[1]]=1;
  for(int l= 2;l<=N-1;l++){
    cin >> a[l];
    for(int i= 0;i<=20;i++){
      if(i-a[l]>=0&&i-a[l]<=20) dp[l][i] += dp[l-1][i-a[l]];
      if(i+a[l]>=0&&i+a[l]<=20) dp[l][i] += dp[l-1][i+a[l]];
    }
      //REP(i,21)cout<<l<<':'<< i<<' '<<dp[l-1][i]<<endl;
  }
  //REP(i,21)cout<< i<<' '<<dp[N-1][i]<<endl;
  cin >> a[N];
  cout << dp[N-1][a[N]]<<endl;
}
void solve(){
  init();

}
int main(){
    solve();
}

Measured memory_bytes: 1176
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort()
total_drink = 0
total_pay = 0
for ab in AB:
    total_drink += ab[1]
    if M < total_drink:
        total_pay += ab[0] * (M - total_drink + ab[1])
        break
    else:
        total_pay += ab[1] * ab[0]
        
print(int(total_pay))

Measured memory_bytes: 17000
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		PriorityQueue<Double> PQ = new PriorityQueue<Double>();
		for(int i = 0;i < N;i++) {
			PQ.add(scn.nextDouble());
		}
		double ans = PQ.poll();
		while(!PQ.isEmpty()) {
			ans += PQ.poll();
			ans /= 2;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
cin >> N;
if (N <= 111) cout << 111 << endl;
else if (N <= 222) cout << 222 << endl;
else if (N <= 333) cout << 333 << endl;
else if (N <= 444) cout << 444 << endl;
else if (N <= 555) cout << 555 << endl;
else if (N <= 666) cout << 666 << endl;
else if (N <= 777) cout << 777 << endl;
else if (N <= 888) cout << 888 << endl;
else if (N <= 999) cout << 999 << endl;

return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n,k; cin >> n >> k;
  cout << k * power(k-1,n-1);
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        Task solver = new Task();
        int t = 1;
        while (t --> 0) solver.solve(1, scan, out);
        out.close();
    }

    static class Task {

        public void solve(int testNumber, FastReader scan, PrintWriter out) {
            int n = scan.nextInt();
            String a = scan.next(), b = scan.next();
            for(int i = 0; i < n; i++) {
                out.print(a.charAt(i));
                out.print(b.charAt(i));
            }
        }
    }

    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 22868
#include <iostream>
using namespace std;
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <cstdlib>

int main() {
	int n, a, b;
	cin >> n >> a >>b;
	if(b-a == 1) {
		cout << "Borys" <<endl;
	} else if((b-a)%2==1) {
		cout << "Borys" <<endl;
	} else if((a-b)%2==0) {
		cout << "Alice" <<endl;
	}
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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 U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 N;
  cin >> N;
  vector<int64> L(N);
  REP(i, N) cin >> L[i];
  sort(all(L));
  int64 res = 0;
  REP(i, N) {
    FOR(j, i+1, N) {
      FOR(k, j+1, N) {
        if (L[i] != L[j] && L[j] != L[k] && L[i] != L[k] && L[i] + L[j] > L[k]) res++;
      }
    }
  }
  cout << res << endl;
}


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

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

int main() {

    int n, a, b;
    cin >> n >> a >> b;

    cout << min(a, b) << " " << max(0, -(n-a-b)) << endl;

    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    vector<ll> num = {2,5,5,4,5,6,3,7,6};
    vector<P> match; // (数字、本数)
    ll n, m;
    cin >> n >> m;
    vector<ll> dp(n+1, -1*INF);
    rep(i, m) {
        ll a;
        cin >> a;
        a--;
        match.push_back(make_pair(a+1,num[a]));
    }
    sort(ALL(match), greater<P>());

    dp[0] = 0;
    frep(i, 1, n) {
        ll max = -1*INF;
        rep(j, m) {
            if(i-match[j].second >= 0) {
                if(max < dp[i-match[j].second]+1) {
                    max = dp[i-match[j].second]+1;
                }
            }
        }
        dp[i] = max;
    }

    ll tmp = n;
    rep(i, dp[n]) {
        rep(j, m) {
            if(dp[tmp-match[j].second] == dp[tmp]-1) {
                cout << match[j].first;
                tmp -= match[j].second;
                break;
            }
        }
    }

    cout << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 384
n = int(input())
l = list(map(int,input().split()))

# 一番長い辺が他のN−1辺の長さの合計よりも真に短い場合に限り、条件を満たすN角形が描ける。
if sum(l) - max(l) > max(l):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9008
#!/usr/bin/python3
from heapq import heappush, heappop
solution = [i + 1 for i in range(15)] + [0]
sol_idx = (15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
MAX_DEPTH = 45
count = 0
neighbor = (
    (1, 4),
    (0, 2, 5),
    (1, 6, 3),
    (2, 7),
    (0, 5, 8),
    (1, 4, 6, 9),
    (2, 5, 7, 10),
    (3, 6, 11),
    (4, 9, 12),
    (5, 8, 10, 13),
    (6, 9, 11, 14),
    (7, 10, 15),
    (8, 13),
    (9, 12, 14),
    (10, 13, 15),
    (11, 14)
        )

distance = (
    (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0),
    (0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
    (1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
    (2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
    (3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
    (1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
    (2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4),
    (3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3),
    (4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2),
    (2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4),
    (3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3),
    (4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2),
    (5, 4, 3, 2, 4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1),
    (3, 4, 5, 6, 2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3),
    (4, 3, 4, 5, 3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2),
    (5, 4, 3, 4, 4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1),
    (6, 5, 4, 3, 5, 4, 3, 2, 4, 3, 2, 1, 3, 2, 1, 0)
        )
 
def get_diff(B):
    diff = 0
    for i, v in enumerate(B):
        diff += distance[v][i]
    return diff
 
def get_next_board(board, space, prev):
    for nxt in neighbor[space]:
        if nxt == prev:
            continue
        b = board[:]
        b[space], b[nxt] = b[nxt], 0
        yield b, nxt

def answer_is_odd(board):
    return sum(divmod(board.index(0), 4)) % 2

def search(board):
    lower = get_diff(board)
    start_depth = lower
    if (lower % 2) ^ answer_is_odd(board):
        start_depth += 1
    for limit in range(start_depth, MAX_DEPTH + 1, 2):
        get_next(board, limit, 0, board.index(0), None, lower)
        if count > 0:
            return limit

def get_next(board, limit, move, space, prev, lower):
    if move == limit:
        if board == solution:
            global count
            count += 1
    else:
        for b, nxt in get_next_board(board, space, prev):
            p = board[nxt]
            new_lower = lower - distance[p][nxt] + distance[p][space]
            if new_lower + move <= limit:
                get_next(b, limit, move + 1, nxt, space, new_lower)

# main
boad = []
for i in range(4):
    boad.extend(map(int, input().split()))
print(search(boad))
exit()

Measured memory_bytes: 7988
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  set<int> s;
  rep(i, n){
    auto it = s.find(a[i]);
    if(it != s.end()) s.erase(a[i]);
    else s.insert(a[i]);
  }
  cout << s.size() << endl;
}


Measured memory_bytes: 5376
import sys
import math
if __name__ == "__main__":
    X = int(input())
    buf = int(math.sqrt(X))
    buf = pow(buf, 2)
    for i in range(2, 11):
        tmp = pow(i, 3)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(2, 6):
        tmp = pow(i, 4)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(2, 4):
        tmp = pow(i, 5)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(2, 4):
        tmp = pow(i, 6)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(7, 11):
        tmp = pow(2, i)
        if tmp <= X and tmp > buf:
            buf = tmp
    print(buf)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 200005

using namespace std;

int main()
{
    __

    int a,b,c;

    cin >> a >> b >> c;

    if((a==b && a!=c) || (a==c && a!=b) || (b==c && a!=b)) cout << "Yes\n";

    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 5e3+10, mod = 1e9+7, inv2 = (mod+1)>>1;
int n,m,f[N][N],inv[N],pw[N];

int main(){
	n=read(),m=read();
	pw[0]=inv[0]=1;
	For(i,1,max(n,m)) pw[i]=2ll*pw[i-1]%mod,inv[i]=1ll*inv[i-1]*inv2%mod;
	f[1][0]=1;
	For(i,1,m) f[1][i]=pw[i];
	For(i,2,n){
		f[i][1]=pw[i];
		int s=0;
		For(j,2,m){
			s=(s+1ll*f[i-1][j-1]*(j-1)%mod*inv[j-1])%mod;
			f[i][j]=(1ll*f[i-1][j]*(j+1)+1ll*s*f[1][j-1])%mod;
		}
	}
	printf("%d\n",f[n][m]);
}

Measured memory_bytes: 101564
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/*Used path compression technique*/
/*-------------------------------------*/
//ll finds(ll a)
//{
//    vector<ll>vec;
//    while(parent[a]>0){
//        vec.pb(a);
//        a=parent[a];
//    }
//    for(int i=0;i<vec.size();i++)parent[vec[i]]=a;
//    return a;
//}
//void unions(ll a,ll b)
//{
//    parent[a]+=parent[b];
//    parent[b]=a;
//}
/*------------------------------*/
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    ll n;
    cin>>n;
    cout<<"ABC"<<n<<endl;
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}





Measured memory_bytes: 3576