akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,a,b,f;scanf("%d%d",&n,&m);
  int ans[n];fill(ans,ans+n,-1);
  vector<int> r[n];
  for(i=0;i<m;i++){
    scanf("%d%d",&a,&b);a--;b--;
    r[a].push_back(b);
    r[b].push_back(a);
  }
  queue<int> q;q.push(0);
  while(!q.empty()){
    f = q.front();q.pop();
    for(i=0;i<r[f].size();i++){
      if(ans[r[f][i]]==-1){
        ans[r[f][i]] = f;q.push(r[f][i]);
      }
    }
  }
  printf("Yes\n");
  for(i=1;i<n;i++) printf("%d\n",ans[i]+1);
}

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

using namespace std;
typedef long long ll;

int main()
{
    ll n;
    cin >> n;
    ll sum = 0, originalN = n;

    while (n > 0)
    {
        sum += n % 10;
        n /= 10;
    }

    string ans = originalN % sum == 0 ? "Yes" : "No";

    cout
        << ans;
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
const LI MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//               When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI x,n,i;cin>>x>>n;
      set<LI> s;
      fo(i,0,n){
        LI r;cin>>r;s.insert(r);
      }
      LI ans=INT_MAX,v;
      fo(i,x,1000){
        if(s.count(i)==0){
          ans=min(ans,abs(i-x));
          v=i;
          break;
        }
      }
      rfo(i,x,-1000){
        if(s.count(i)==0){
          if(ans>=abs(i-x)){
            v=i;
          }
          break;
        }
      }
      cout<<v;
    }
    return 0;
}

Measured memory_bytes: 3656
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

a,b,c,d=MI()
e=b+c-d
f=-a+c+d
g=a+b-d
h=b-a+c
print(e,end=" ")
print(f,end=" ")
print(g,end=" ")
print(h,end=" ")

Measured memory_bytes: 3444
import java.io.File;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
import java.util.Stack;

class Main {
    public static void main(String args[]) throws Exception {

        // java.util.Scanner sc = new java.util.Scanner(new File("/Users/keisuke/dev/atcoder/ALDS_1_10_C/in.txt"));

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());

        List<List<Integer>> list = new ArrayList<>();
        for(int i=0; i<n; i++)  list.add(new ArrayList<Integer>());

        for(int i=0; i<m; i++){
            int v1 = Integer.parseInt(sc.next());
            int v2 = Integer.parseInt(sc.next());
            list.get(v1).add(v2);
            list.get(v2).add(v1);
        }

        BFS bfs = new BFS(list);

        while(bfs.nextSeed()){
            bfs.execute();
        }
        
        int ansNum = Integer.parseInt(sc.next());
        for(int i=0; i<ansNum; i++){
            bfs.isSameRegion(Integer.parseInt(sc.next()), Integer.parseInt(sc.next()));
        }
    }


    static class BFS{
        private final List<List<Integer>> adjacency;
        private final Queue<Integer> queue;
        private final Stack<Integer> stack;
        private final int[] region;
        private int regionId = 0;
        private final int np;

        public int getNp(){
            return this.np;
        }

        public BFS(List<List<Integer>> adjacency){
            this.adjacency = adjacency;
            this.np = adjacency.size();
            this.region = new int[this.np];
            Arrays.fill(this.region, -1);
            this.queue = new ArrayDeque<>();
            this.stack = new Stack<>();
        }

        private void searchConnectedNode(int vi){
            this.region[vi] = this.regionId;
            for(int i=0; i<this.adjacency.get(vi).size(); i++){
                int next = this.adjacency.get(vi).get(i);
                if(this.region[next] == -1){
                    this.region[next] = this.regionId;
                    // this.queue.offer(next);
                    this.stack.push(next);
                }
            }
        }

        private boolean nextSeed(){
            for(int i=0; i<this.np; i++){
                if(this.region[i] == -1){
                    // this.queue.offer(i);
                    this.stack.push(i);
                    return true;
                }
            }
            return false;
        }
        public void execute(){
            while(!this.stack.isEmpty()){
                searchConnectedNode( this.stack.pop());
            }
            this.regionId++;
        }

        public void isSameRegion(int i, int j){
            System.out.println( this.region[i] == this.region[j] && this.region[i] != -1 ? "yes" : "no" );
        }
    }

    static enum Status{
        DONE,
        CURRENT,
        NOT_YET
    }
}



Measured memory_bytes: 86940
#include <stdio.h>
#include <string.h>
int main(void) {
    int flag,i,j,num,count,maxcount[10]={0,4,2,2,2,2,2,3,2,3};
    char key[10][6]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"},input[1025];
    scanf("%d",&num);
    for (j=0; j<num; j++) {
        scanf(" %s",input);
        flag=0,count=0;
        for (i=0; i<strlen(input); i++) {
            if (flag==0&&input[i]=='0') {
                continue;
            } else if (flag==1&&input[i]=='0') {
            	if (count==0) {
            		count=maxcount[input[i-1]-'0'];
            	} else {
            		count--;
            	}
                printf("%c",key[input[i-1]-'0'][count]);
                count=0;
                flag=0;
            } else {
                flag=1;
                if (count==maxcount[input[i]-'0']) {
                    count=0;
                } else {
                    count++;
                }
            }
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define mxn (int)1e5+10
using namespace std;

int ar[mxn][3], dp[mxn][3];

int solve(int day, int task) {

    if(day < 0) return 0;

    if(dp[day][task] != 0) return dp[day][task];

    int ans = INT_MIN;

    for(int t=0; t<3; ++t) {
        if(t != task)
            ans = max(ans, solve(day-1, t));
    }
    return dp[day][task] = ans + ar[day-1][task];
}

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

    for(int i=0; i<n; ++i) {
        for(int j=0; j<3; ++j) {
            cin >> ar[i][j];
        }
    }

    int ans = INT_MIN;
    for(int j=0; j<3; ++j) {
        ans = max(ans, solve(n, j));
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 7296
// ALDS1_6_A.cpp
// Sort II - Counting Sort

#include <iostream>
#include <vector>
using namespace std;
const int maxn = 10005;

void countingSort(vector<int>& A, vector<int>& B, int k)
{
	vector<int> C(k, 0);
	for (int j = 0; j < A.size(); j++) {
		C[A[j]] += 1;
	}
	for (int i = 1; i < k; i++) {
		C[i] += C[i - 1];
	}
	for (int j = A.size() - 1; j >= 0; j--) {
		B[C[A[j]] - 1] = A[j];
		C[A[j]]--;
	}
}

void trace(vector<int>& nums, int n)
{
	for (int i = 0; i < n; i++) {
		if (i > 0) cout << " ";
		cout << nums[i];
	}
	cout << endl;
}

int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	vector<int> B(n);
	countingSort(A, B, maxn);
	trace(B, n);
	return 0;
}

Measured memory_bytes: 18308
n, m = map(int, input().split())
sum = 0
money = 0
list_ab = list()
for i in range(n):
    list_ab.append(list(map(int, input().split())))
list_ab = sorted(list_ab)
for i in range(n):
    if(list_ab[i][1] >= m - sum):
        money += list_ab[i][0] * (m - sum)
        break
    else:
        sum += list_ab[i][1]
        money += list_ab[i][0]*list_ab[i][1]
print(money)


Measured memory_bytes: 28656
#include <iostream>
#include <cstdio>
using namespace std;
long long n, m, a, b, c, d[1005][1005];
int main() {
	int i, j, k;
	cin>>n>>m;
	for(i=1; i<=n; i++) {
		for(j=1; j<=n; j++) d[i][j] = -1e18;
		d[i][i] = 0;
	}
	while(m--) cin>>a>>b>>c, d[a][b] = c;
	for(k=1; k<=n; k++) for(i=1; i<=n; i++) {
		if(d[i][k] == -1e18) continue;
		for(j=1; j<=n; j++) if(d[i][k] + d[k][j] > d[i][j]) d[i][j] = d[i][k] + d[k][j];
	}
//	for(i=1; i<=n; i++) if(d[i][i]>0) return puts("inf"), 0;
	if(d[1][1]>0) return puts("inf"), 0;
	cout<<d[1][n];
	return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < int(n); i++)
#define rep1(i,n) for (int i = 1; i <= int(n); i++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", _dmp_(#__VA_ARGS__, __VA_ARGS__);
void _dmp_(const char*) { cerr << endl; }
template <class T, class... U>
void _dmp_(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; _dmp_(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S> const& p) { return is >> p.first >> p.second; }
struct _Init_ { _Init_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } _init_;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
#define YesNo(c) ((c) ? "Yes" : "No")
////////////////////////////////

int32_t main() {
    string s; cin >> s;
    int n = s.size();
    if (n&1) {
        int m = (n-1)/2;
        int i = m, j = m;
        while (s[i] == s[m]) i--;
        while (s[j] == s[m]) j++;
        cout << min(j,n-1-i) << endl;
    } else {
        int m = n/2;
        if (s[m-1] != s[m]) quit(m);
        int i = m-1, j = m;
        while (s[i] == s[m]) i--;
        while (s[j] == s[m]) j++;
        cout << min(j,n-1-i) << endl;       
    }
}


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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    string s;
    cin >> s;
    int n[4];
    rep(i, 4) n[i] = s[i] - '0';
    if(n[0] + n[1] + n[2] + n[3] == 7) {
        rep(i, 3) cout << s[i] << "+";
    }
    else if(n[0] - n[1] + n[2] + n[3] == 7) {
        cout << s[0] << "-" << s[1] << "+" << s[2] << "+";
    }
    else if(n[0] + n[1] - n[2] + n[3] == 7) {
        cout << s[0] << "+" << s[1] << "-" << s[2] << "+";
    }
    else if(n[0] + n[1] + n[2] - n[3] == 7) {
        cout << s[0] << "+" << s[1] << "+" << s[2] << "-";
    }
    else if(n[0] - n[1] - n[2] + n[3] == 7) {
        cout << s[0] << "-" << s[1] << "-" << s[2] << "+";
    }
    else if(n[0] - n[1] + n[2] - n[3] == 7) {
        cout << s[0] << "-" << s[1] << "+" << s[2] << "-";
    }
    else if(n[0] + n[1] - n[2] - n[3] == 7) {
        cout << s[0] << "+" << s[1] << "-" << s[2] << "-";
    }
    else if(n[0] - n[1] - n[2] - n[3] == 7) {
        cout << s[0] << "-" << s[1] << "-" << s[2] << "-";
    }
    cout  << s[3] << "=7" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c;
	
	cin >> a >> b >> c;
	if((a == 5 && b == 7 && c == 5) || (a == 5 && b == 5 && c == 7) || (a == 7 && b == 5 && c == 5))
	 cout << "YES";
	 else
	 cout << "NO";

	
		return 0;
}

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

#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
const int MAXN = 5e5+5;
const int MOD= 998244353;
int n;
string s,p;
int sum[MAXN][26];
void add(int x,int y,int z){
    for(;x<MAXN;x+=x&-x)sum[x][z]+=y;
}
int query(int x,int z){
    int ans=0;
    for(;x;x-=x&-x){
        ans+=sum[x][z];
    }
    return ans;
}
int main(){
    while(cin>>n>>s){
        memset(sum,0,sizeof(sum));
        rep(i,0,n-1){
            add(i+1,1,s[i]-'a');
        }
        int q;
        cin>>q;
        while(q--){
            int c,l,r;
            cin>>c;
            if(c==1){
                cin>>l>>p;
                add(l,-1,s[l-1]-'a');
                s[l-1]=p[0];
                add(l,1,s[l-1]-'a');
            }
            else{
                cin>>l>>r;
                int num=0;
                rep(i,0,25){
                    if(query(r,i)-query(l-1,i)){
                        num++;
                    }
                }
                cout<<num<<endl;
            }
        }
    }
}


Measured memory_bytes: 51716
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		// 語頭を取り出す
		char a = s.charAt(0);
		// 文字数を取り出す
		int num = s.length() - 2;
		String numStr = String.valueOf(num);
		// 語尾を取り出す
		char b = s.charAt(num + 1);

		System.out.println(a + numStr + b);

	}

}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;

int main() {
	vector<int> x(200000),tmp(200000);
	int n, inp, ans[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> inp;
		x[i] = inp;
	}
	tmp = x;
	sort(tmp.begin(), tmp.begin() + n);
	ans[0] = tmp[n / 2 - 1]; ans[1] = tmp[n / 2];
	for (int i = 0; i < n; i++) {
		if (x[i] <= ans[0])cout << ans[1] << "\n";
		else cout << ans[0] << "\n";
	}
}

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

int main(void){
  int R,C;
  long K;
  cin>>R>>C>>K;
  long* map[R];
  for(int i=0;i<R;i++){
    map[i]=(long*)malloc(sizeof(long)*C);
  }
  for(int i=0;i<R;i++){
    for(int j=0;j<C;j++){
      map[i][j]=0;
    }
  }
  for(int i=0;i<K;i++){
    long r,c,v;
    cin>>r>>c>>v;
    map[r-1][c-1]=v;
  }
  //long table[R][C][4];
  long** table[R];
  for(int i=0;i<R;i++){
    table[i]=(long**)malloc(sizeof(long*)*C);
    for(int j=0;j<C;j++){
      table[i][j]=(long*)malloc(sizeof(long)*4);
    }
  }
  for(int i=0;i<R;i++){
    for(int j=0;j<C;j++){
      for(int k=0;k<4;k++){
        table[i][j][k]=0;
      }
    }
  }
  table[0][0][1]=map[0][0];

  for(int i=0;i<R;i++){
    for(int j=0;j<C;j++){
      if(j>0){
        table[i][j][0]=max(table[i][j-1][0], table[i][j][0]);
        for(int k=1;k<4;k++){
          table[i][j][k]=max(table[i][j-1][k], table[i][j-1][k-1]+map[i][j]);
        }
      }
      if(i>0){
        table[i][j][0]=max({table[i][j][0], table[i-1][j][0], table[i-1][j][1], table[i-1][j][2], table[i-1][j][3]});
        table[i][j][1]=max({table[i][j][1], table[i-1][j][0]+map[i][j], table[i-1][j][1]+map[i][j], table[i-1][j][2]+map[i][j], table[i-1][j][3]+map[i][j]});
      }
    }
  }



  cout<<max({table[R-1][C-1][0], table[R-1][C-1][1], table[R-1][C-1][2], table[R-1][C-1][3]})<<endl;

  return 0;
}


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 29
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n,k,l;
int par_d[200000];
int rank_d[200000];
int par_t[200000];
int rank_t[200000];
map<pii,int> memo;

void init(int n,int par[],int rank[]){
  REP(i,n){
    par[i] = i;
    rank[i] = 0;
  }
}

int find(int x,int par[]){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x], par);
  }
}

void unite(int x, int y, int par[], int rank[]){
  x = find(x,par);
  y = find(y,par);
  if(x == y) return;

  if(rank[x] < rank[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(rank[x] == rank[y]) rank[x]++;
  }
}

bool same(int x, int y,int par[]){
  return find(x,par) == find(y,par);
}

int main(){
  cin >> n >>k >> l;
  init(n,par_d,rank_d);
  init(n,par_t,rank_t);
  REP(i,k){
    int a,b;
    cin >> a>>b;
    unite(a-1,b-1,par_d,rank_d);
  }
  REP(i,l){
    int a,b;
    cin >> a>> b;
    unite(a-1,b-1,par_t,rank_t);
  }
  REP(i,n){
    pii p = pii(find(i,par_d),find(i,par_t));
    if(memo.count(p)) memo[p]++;
    else memo[p] = 1;
  }
  REP(i,n){
    if(i!=0) cout << " ";
    cout << memo[pii(find(i,par_d),find(i,par_t))];
  }
  cout << endl;
}


Measured memory_bytes: 15104
import java.util.Iterator;
import java.util.Scanner;
import java.util.Vector;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int q = sc.nextInt();

			@SuppressWarnings("unchecked")
			Vector<Integer>[] A = new Vector[n];
			for(int i=0;i<n;i++) {
				A[i] = new Vector<>();
			}

			for(int i=0;i<q;i++) {
				int query = sc.nextInt();
				int t = sc.nextInt();
				switch(query) {
				case 0:
					A[t].add(sc.nextInt());
					break;
				case 1:
					Iterator<Integer> LI = A[t].iterator();
					if(LI.hasNext()) {
						System.out.print(LI.next());
						while(LI.hasNext()) {
							System.out.print(" " + LI.next());
						}
					}
					System.out.println();
					break;
				case 2:
					A[t].clear();
					break;
				}
			}
		}
	}
}


Measured memory_bytes: 310332
#include<iostream>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

struct Union_Find {
	vector<int> rank, par;
	int independent_tree;
	int N;

	Union_Find(int n) {
		N = n;
		for (int i = 0; i < N; i++)rank.push_back(1), par.push_back(i);
		independent_tree = N;
	}

	int getroot(int X) {
		if (par[X] == X)return X;
		return par[X] = getroot(par[X]);
	}

	bool issame(int A, int B) {
		return getroot(A) == getroot(B);
	}

	void unite(int A, int B) {
		A = getroot(A), B = getroot(B);
		if (A == B)return;
		if (rank[A] > rank[B]) {
			par[B] = A;
		}
		else if (rank[A] == rank[B]) {
			par[B] = A;
			rank[A]++;
		}
		else {
			par[A] = B;
		}
	}

};

int N;

int main() {
	Union_Find uf(200000 + 10);
	cin >> N;
	for (int i = 0; i < N; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		uf.unite(x ,100000 + y);
	}
	ll ans = -N;
	map<int, ll> my;
	map<int, ll> mx;
	for (int i = 0; i < 100000; i++) {
		mx[uf.getroot(i)]++;
		my[uf.getroot(i + 100000)]++;
	}
	for (int i = 0; i < 2 * 100000; i++) {
		ans += mx[i] * my[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 26860
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
int main(){
  string sa,sb,sc;
  cin>>sa>>sb>>sc;
  int n=sa.size(); int m=sb.size(); int l=sc.size();
  char turn='a';
  int ca=0; int cb=0; int cc=0;
  rep(i,n+m+l+1){
    if(turn=='a'){
      if(sa[ca]=='a') turn='a';
else  if(sa[ca]=='b') turn='b';
else  if(sa[ca]=='c') turn='c';
      ca++;
    }
    if(turn=='b'){
      if(sb[cb]=='a') turn='a';
else  if(sb[cb]=='b') turn='b';
else  if(sb[cb]=='c') turn='c';
      cb++;
    }
    if(turn=='c'){
      if(sc[cc]=='a') turn='a';
else  if(sc[cc]=='b') turn='b';
else  if(sc[cc]=='c') turn='c';
      cc++;
    }
  if(ca==n+1){
    cout<<'A';
    return 0;
  }
else if(cb==m+1){
    cout<<'B';
    return 0;
  }
   if(cc==l+1){
    cout<<'C';
    return 0;
  } 
  }
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main()
{
  int k,arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin>>k;
  cout<<arr[k-1];
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
//#define int long long

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

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

class Countings{
    private:
        int mod;
        vector<long long> factList, invList;
        long long Pow(long long x, long long n);
    public:
        Countings(int sz, int mod);
        long long Permutation(int n, int r);
        long long Combination(int n, int r);
        long long HomogeneousProduct(int n, int r);
};

Countings::Countings(int sz, int mod) : mod(mod), factList(sz + 1), invList(sz + 1) {
    factList[0] = 1;
    for(int i = 1; i < factList.size(); i++) {
        factList[i] = factList[i - 1] * i % mod;
    }
    invList[sz] = Pow(factList[sz], mod - 2);
    for(int i = sz - 1; i >= 0; i--) {
        invList[i] = invList[i + 1] * (i + 1) % mod;
    }
}

long long Countings::Pow(long long x, long long n){
    long long ret = 1;
    while(n > 0) {
      if(n & 1) ret = ret * x % mod;
      x = x * x % mod;
      n >>= 1;
    }
    return ret;
}

long long Countings::Permutation(int n, int r){
    if(r < 0 || n < r) return 0;
    return factList[n] * invList[n - r] % mod;
}

long long Countings::Combination(int n, int r){
    if(r < 0 || n < r) return 0;
    return factList[n] * invList[r] % mod * invList[n - r] % mod;
}

long long Countings::HomogeneousProduct(int n, int r){
    if(n < 0 || r < 0) return 0;
    return (r == 0 ? 1 : Combination(n + r - 1, r));
}

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

    int n, p;
    cin >> n >> p;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    int cnt = 0;
    REP(i, n) if(a[i] % 2 == 0) cnt++;
    
    LL sum = pow(2LL, cnt);
    LL ans = 0;
    Countings countings(n, MOD);
    REP(i, n-cnt+1){
        if(p == 0){
            if(i % 2 == 0) ans += sum * countings.Combination(n-cnt, i);
        }else{
            if(i % 2 == 1) ans += sum * countings.Combination(n-cnt, i);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
let toOp op = match op with
    | "+" -> ( + )
    | "-" -> ( - )
    | "*" -> ( * )
    | "/" -> ( / )
    | _   -> failwith "Invalid Operation"
;;


let rec f _ = 
    let (a, op, b) = Scanf.sscanf(read_line()) "%d %s %d" (fun x y z -> (x, y, z)) in
    if op = "?" then ()
    else (
        Printf.printf "%d\n" ((toOp op) a b);
        f ()
    );;

f ();;


Measured memory_bytes: 2296
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int a, b, h;
  cin >> a >> b >> h;
  cout << (a + b) * h / 2 << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(true){
int x=Integer.parseInt(sc.next());
int y=Integer.parseInt(sc.next());
int s=Integer.parseInt(sc.next());
int max=0,temp=0;
for(int i=1;i<s;i++){
   for(int j=1;j<s;j++){
   if(i*(100+x)/100+j*(100+x)/100==s){
   temp=i*(100+y)/100+j*(100+y)/100;
   break;
   }
   }   
max=Math.max(temp,max);
}
if(x==0&&y==0&&s==0)break;
System.out.println(max);
}
}
}


Measured memory_bytes: 31148
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = list(map(int, sys.stdin.buffer.readline().split()))
    print('Possible' if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0 else 'Impossible')


if __name__ == '__main__':
    main()


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

using namespace std;

#define REP(i, b, e) for(int i = (int)(b); i < (int)(e); i++)
#define rep(i, n) REP(i, 0, n)
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;



int main(){
	int a, b;
	cin>>a>>b;
	a -= 1;
	b -= 1;
	if(a == 0) a = 13;
	if(b == 0) b = 13;
	if(a > b) cout<<"Alice"<<endl;
	else if(a == b) cout<<"Draw"<<endl;
	else cout<<"Bob"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int z = 1000000007;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
    return 0;
}

Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

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

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt64

func maxInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func minInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func main() {
	x := make([]int, 5)
	for i := 0; i < 5; i++ {
		x[i] = nextInt()
	}
	for i := 0; i < 5; i++ {
		if x[i] == 0 {
			fmt.Println(i + 1)
		}
	}
}


Measured memory_bytes: 1756
void main() {
    writeln(readln.chomp.to!double.sqrt.to!int ^^ 2);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

string s;

void input() {
  cin >> s;
}

void solve() {
  ll sum = 0;

  for (auto&& i : s)
    sum += i - '0';

  string ans = "No";

  if (sum % 9 == 0)
    ans = "Yes";

  cout << ans << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 3;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3768
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 1000000


int main() {

	int x, y, z;
	cin>>x>>y>>z;

	int tmp = x;
	x = y;
	y = tmp;

	 tmp = x;
	x = z;
	z = tmp;

	cout<<x<< " " <<y<<" " <<z<<endl;

	return 0;

}

Measured memory_bytes: 3632
import sys

def BINGO():
    print("Yes")
    sys.exit()

Frow=list(map(int,input().split()))
Srow=list(map(int,input().split()))
Trow=list(map(int,input().split()))
Mybingo=[Frow,Srow,Trow]
n=int(input())

blist=[]
for i in range(n):
    blist.append(int(input()))

for i in range(3):
    for j in range(3):
        if Mybingo[i][j] in blist:
            Mybingo[i][j] = 1
        else:
            Mybingo[i][j] = 0

for i in range(3):
    if sum(Mybingo[i]) == 3:
        BINGO()
    elif Mybingo[0][i]+Mybingo[1][i]+Mybingo[2][i] == 3:
        BINGO()

if Mybingo[0][0]+Mybingo[1][1]+Mybingo[2][2] == 3 or Mybingo[0][2]+Mybingo[1][1]+Mybingo[2][0] ==3:
    BINGO()

print("No")



Measured memory_bytes: 3064
def main():
    import sys
    input=sys.stdin.readline
    n,m,x=map(int,input().split())
    C=[0]*n
    A=[0]*n
    for i in range(n):
        c,*a=map(int,input().split())
        C[i]=c
        A[i]=a
    ans=-1
    for i in range(2**n):
        flag=True
        for j in range(m):
            u=0
            for d in range(n):
                u+=A[d][j]*(i>>d&1)
            if u<x:
                flag=False
        if flag:
            price=0
            for d in range(n):
                price+=C[d]*(i>>d&1)
            if ans==-1 or ans>price:
                ans=price
    print(ans)
if __name__ == '__main__':
    main()

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

int main(){
    ll N; cin>>N;
    set<string> S;
    for(ll i=0;i<N;i++){
        string s;
        cin>>s;
        S.insert(s);
    }
    cout<<S.size();
    return 0;
}


Measured memory_bytes: 19220
from itertools import permutations

k = int(input())
points = [tuple(map(int, input().split(' '))) for _ in range(k)]

indexes = set(range(8))
xs = indexes - {x for _, x in points}
ys = list(indexes - {y for y, _ in points})

result = None
for x_indexes in permutations(xs):
    selected = set(points)
    for i, x in enumerate(x_indexes):
        y = ys[i]
        for sy, sx in selected:
            if abs(sx - x) == abs(sy - y):
                break
        else:
            selected.add((y, x))
            continue
        break
    else:
        result = selected
        break

rows = []
for _ in range(8):
    row = ['.'] * 8
    rows.append(row)

for y, x in result:
    rows[y][x] = 'Q'

for row in rows:
    print(''.join(row))



Measured memory_bytes: 5652
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LLu unsigned long long
using namespace std;
char s[250010];
LLu base=233,inv=7204522363551799129,f[250010],X=1,Y,ans=0;
int n;
map<LLu,int> mp;
int main()
{
	scanf("%d",&n);getchar();
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)
	{
		f[i]=f[i-1];
		if(s[i]=='+') f[i]+=X;
		if(s[i]=='-') f[i]-=X;
		if(s[i]=='<') X*=base;
		if(s[i]=='>') X*=inv;
		mp[f[i]]++;
	}
	X=1;
	for(int i=1;i<=n;i++)
	{
		ans+=mp[f[n]*X+Y];
		if(s[i]=='+') Y+=X;
		if(s[i]=='-') Y-=X;
		if(s[i]=='<') X*=base;
		if(s[i]=='>') X*=inv;
		mp[f[i]]--;
	}
	printf("%llu",ans);
}

Measured memory_bytes: 33664
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout << arg << "\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef set<int> si;
typedef string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
};
ll n,k;
mint dp[55][55][2600];
void solve(){
  dp[0][0][0]=1;
  rep(i,n){
    rep(j,i+1){
      rep(l,k+1){
	{
	  int nj=j;
	  dp[i+1][nj][l+2*nj]+=dp[i][j][l];
	}
	{
	  int nj=j+1;
	  dp[i+1][nj][l+2*nj]+=dp[i][j][l];
	}
	{
	  int nj=j;
	  mint x=2*nj;
	  dp[i+1][nj][l+2*nj]+=dp[i][j][l]*x;
	}
	if(j>=1){
	  int nj=j-1;
	  mint x=j*j;
	  dp[i+1][nj][l+2*nj]+=dp[i][j][l]*x;
	}
      }
    }
  }
  prin(dp[n][0][k].x);
}
int main(){
  cin>>n>>k;
  solve();
  return 0;
}


Measured memory_bytes: 61696
n, y = list(map(int, input().split()))

a = -1
b = -1
c = -1

for i in range(n+1):
    for j in range(n+1-i):
        if i*1000 + j*5000 + (n-i-j)*10000 == y:
            a, b, c = i, j, n-i-j
            break
print(c, b, a)

Measured memory_bytes: 3060
#a, b = gets.split.map(&:to_i)
s = gets.chomp
n = s.size

for l in 0..n-1
    for r in l..n
        t = ''
        t += s[0..l-1] if l-1 >= 0
        t += s[r..-1] if r <= n-1
        #p t
        if  t == 'keyence'
            puts 'YES'
            exit
        end
    end
end

puts 'NO'


Measured memory_bytes: 14208
#include <iostream>
using namespace std;
const int INF = 10000000;
int n;
int a[10100];
int main(){
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    int cnt = INF;
    for (int i = 0; i < n; ++i){
        int res = 0;
        while (a[i] % 2 == 0){
                ++res;
                a[i] /= 2;
        }
        if (cnt > res) cnt = res;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cstring>
#include<functional>

using namespace std;

int main() {
    long long comb[51][51];
    for (int i = 0; i < 51; ++i)
        for (int j = 0; j < 51; ++j)
            comb[i][j] = 0;
    comb[0][0] = 1;
    for (int i = 1; i < 51; ++i)
        for (int j = 0; j <= i; ++j)
            comb[i][j] = j == 0 ? 1 : comb[i - 1][j - 1] + comb[i - 1][j];

    int N, A, B;
    cin >> N >> A >> B;

    long long vv[N];
    vector< pair<long long, int> > v;

    for (int i = 0; i < N; ++i) {
        long long vi;
        cin >> vi;
        vv[i] = vi;
        bool multi = false;
        for (int j = 0; j < v.size(); ++j) {
            if (v[j].first == vi){
                v[j].second++;
                multi = true;
            }
        }
        if (multi) continue;
        v.push_back(make_pair(vi, 1));
    }

    sort(v.begin(), v.end(), greater<pair<long long, int> >());
    sort(vv, vv + N, greater<long long>());
    double ans_ave = 0;
    for (int i = 0; i < A; ++i) {
        ans_ave += vv[i];
    }
    ans_ave /= A;
    
    printf("%.6f\n", ans_ave);

    bool same = v[0].second >= A;

    long long ans_cnt = 0;
    if (same) {
        for (int i = A; i <= B && i <= v[0].second; ++i) {
            //printf("add comb[%d][%d] = %lld\n", v[0].second, i, comb[v[0].second][i]);
            ans_cnt += comb[v[0].second][i];
        }
    } else {
        ans_cnt = 1;
        int cnt = 0;
        for (int i = 0; i < v.size(); ++i){
            if (cnt + v[i].second > A){
                ans_cnt *= comb[v[i].second][A - cnt];
                //printf("%lld, %d - %d,%d - %lld\n",v[i].first ,v[i].second, A - cnt, v[i].second, ans_cnt);
                break;
            }
            
            cnt += v[i].second;
        }
    }
    printf("%lld\n", ans_cnt);
}

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

using namespace std;
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define MOD 1000000007

#define MAXSIZE 410

int n;
LL tab[MAXSIZE];
LL pref[MAXSIZE][MAXSIZE];
LL dp[MAXSIZE][MAXSIZE];

int main(){
	
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	
	FOR(i,1,n)
		cin>>tab[i];
	
	FOR(i,1,n){
		pref[i][i]=tab[i];
		FOR(j,i+1,n)
			pref[i][j]=pref[i][j-1]+tab[j];
	}
	
	
	FOR(dl,2,n){
		FOR(p,1,n){
			int k=p+dl-1;
			if(k>n)
				break;
			dp[p][k]=LLONG_MAX;
			FOR(a,p,k-1)
				dp[p][k]=min(dp[p][k],dp[p][a]+dp[a+1][k]+pref[p][a]+pref[a+1][k]);
		}
	}
	
	cout<<dp[1][n];
	return 0;
}


Measured memory_bytes: 2816
#include <stdio.h>
#include <math.h>

int main(void) {
	// your code goes here
	int d,n;
	scanf("%d %d",&d,&n);
	if(n==100) n++;
	n=n*pow(10.0,2*d);
	printf("%d\n",n);
	return 0;
}


Measured memory_bytes: 128
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

const int INF=5e8;
int n;
string s,t;

pi ps[1000005];

void ng(){
  puts("-1");
  exit(0);
}

int main(){
  cin>>n>>s>>t;
  if(s==t){
    puts("0");
    return 0;
  }

  int q=n-1;
  int m=0;
  for(int i=n-1;i>=0;--i){
    int j=i;
    while(j>=0 && t[j]==t[i]) --j;

    int p=i;
    q=min(j+1,q);
    while(q>=0 && s[q]!=t[p]) --q;

    if(q<0) ng();

    ps[m++]=mp(q,p);
    if(p<q) ng();

    i=j+1;
  }
  ps[m++]=mp(INF,0);
  sort(ps,ps+m);

  int lb=-1,ub=n+1;
  while(ub-lb>1){
    int md=(lb+ub)>>1;
    bool fail=false;
    dump(md);
    REP(i,m-1){
      int trg=ps[min(m-1,i+md)].fr-md;
      if(trg<ps[i].sc) fail=true;
    }
    if(fail) lb=md;
    else ub=md;
  }
  printf("%d\n",ub);
  return 0;
}





Measured memory_bytes: 10120
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,a[1000],sum=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	sort(a,a+n);
	int k=sum%(4*m)==0?sum/(4*m):sum/(4*m)+1;
	cout<<(a[n-m]>=k?"Yes\n":"No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, q;

int main() {
    scanf("%d%d%d", &n, &m, &q);
    int tcnt[512][512] = {0};
    int query[512][512] = {0};
    for (int i = 0; i < m; i++) {
        int l, r; scanf("%d%d", &l, &r);
        tcnt[l][l]++;
        tcnt[l][r+1]--;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            tcnt[i][j] += tcnt[i][j-1];
        }
    }
    
    int upcnt[512][512] = {0}, dwncnt[512][512] = {0};

    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n+1; j++) {
            upcnt[i][j] = upcnt[i][j-1];
            dwncnt[i][j] = dwncnt[i][j-1];
            if (tcnt[i][j] > tcnt[i][j-1]) upcnt[i][j] += tcnt[i][j] - tcnt[i][j-1];
            if (tcnt[i][j] < tcnt[i][j-1]) dwncnt[i][j] += tcnt[i][j-1] - tcnt[i][j];
        }
    }

    for (int pi = 1; pi <= n; pi++) {
        for (int qi = 1; qi <= n; qi++) {
            for (int i = pi; i <= qi; i++) {
                query[pi][qi] += min(upcnt[i][qi+1], dwncnt[i][qi+1]);
            }
        }
    }


    for (int i = 0; i < q; i++) {
        int pi, qi; scanf("%d%d", &pi, &qi);
        printf("%d\n", query[pi][qi]);
    }
}


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

#define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define H_MAX 10
#define W 5
int H,score;
int pazzle[H_MAX][W];

void disp(){

	rep(i, 0, H){
		rep(j, 0, W)cout << pazzle[i][j];
		cout << endl;
	}
}

bool calc(void){
	//disp();
	int prev = score;
	rep(i, 0, H){
		bool check[W] = { false };
		int num = 0;
		int cnt = 0;
		rep(j, 1, W - 1)
		if (pazzle[i][j] == pazzle[i][j - 1] && pazzle[i][j] == pazzle[i][j + 1]){
			cnt++;
			num = pazzle[i][j];
			rep(k, j - 1, j + 2)check[k] = true;

		}
		score += (cnt + 2)*num;
		rep(j, 0, W)if (check[j])pazzle[i][j] = 0;
	}


	if (prev != score)return true;
	else return false;
}



void clear(){
	//disp();
	rep(i, -H+1, 0)
		rep(j, 0, W)if (!pazzle[-i][j]){
		rep(k, i + 1, 1)if (pazzle[-k][j]){
			int temp = pazzle[-i][j];
			pazzle[-i][j] = pazzle[-k][j];
			pazzle[-k][j] = temp;
			break;
		}
	}
	//disp();



}

int main(void){
	while (true){

		cin >> H;
		if (!H)return(0);
		score = 0;
		rep(i, 0, H)rep(j, 0, W)cin >> pazzle[i][j];
		while (calc())clear();
		cout << score << endl;
	}




}

Measured memory_bytes: 1160
#include<stdio.h>
int main()
{
	int n,k,i,y=0;

	scanf("%d%d",&n,&k);

	int h[n+1];

	for(i=0;i<n;i++)
		scanf("%d",&h[i]);
	for(i=0;i<n;i++)
		if(h[i]>=k)
			y++;
	printf("%d",y);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main(){
    long long x; cin>>x;
    cout<<x*x*x<<"\n";
    return 0;
}



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

vector<vector<int>> g(100, vector<int>(0));
vector<int> color(100, -1);
int t = 0;
vector<int> d(100), f(100);

void dfs(int start, int n) {
    color[start] = 1;
    d[start] = ++t;
    rep(i, g[start].size()) {
        if (color[g[start][i]] == -1) {
            dfs(g[start][i], n);
        }
    }
    color[start] = 2;
    f[start] = ++t;
}

int main() {
    int n;
    scanf("%d", &n);
    rep(i, n) {
        int u, k;
        scanf("%d %d", &u, &k); u--; k;
        rep(j, k) {
            int v;
            scanf("%d", &v); v--;
            g[u].push_back(v);
        }
    }
    rep(i, n) {
        if (color[i] == -1) {
            dfs(i, n);
        }
    }
    
    rep(i, n) {
        printf("%d %d %d\n", i+1, d[i], f[i]);
    }
}


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

int main(){
string s;
cin>>s;
int l=s.length();
double w;
cin>>w;
int c=floor((l-1)/w);
string t;
for(int i=0;i<=c;i++){
cout<<s[w*i];
}
}


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

using namespace std;

int main(){
  int N;;
  while(1){
    cin >> N;
    if(N == 0){
      break;
    }else{
      int array[N], ave, sum = 0;
      
      for(int i = 0;i < N;i++){
	cin >>array[i];
      }
      sort(array,array+N);
      for(int i = 0;i < N;i++){
	if(!(i == 0 || i == N-1)){
	sum += array[i];
	}
      }
      ave = sum /( N -2);
      cout << ave << endl;
      
    }
  }
  
  return 0;
}



Measured memory_bytes: 3088
#include <iostream>
using namespace std;
const int MAX = 51;

int island[MAX][MAX],H,W;
int dx[8]={1,1,1,-1,-1,-1,0,0},dy[8]={0,1,-1,0,1,-1,-1,1};


void dfs(int x,int y){
  island[x][y] = 0;

  for(int i = 0 ; i < 8 ; i++){
    int nx = dx[i] + x;
    int ny = dy[i] + y;
    if(0 <= nx && nx < W && 0 <= ny && ny < H)
      if(island[nx][ny]) dfs(nx,ny);
  }
}

int main(){

  while(cin >> H >> W ,H + W){
    for(int i = 0 ; i < W ; i++)
      for(int j = 0 ; j < H ; j++)
	cin >> island[i][j];
    
    int ans = 0;
    for(int i = 0 ; i < W ; i++){
      for(int j = 0 ; j < H ; j++){
	if(island[i][j]){
	  dfs(i,j);
	  ans++;
	}
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;

  cin >>a ;
  
  int ich=a%2;
  int jyu=(a/10)%2;
  int hya=a/100;

 
  cout <<ich+jyu+hya<< endl;
}

/* 
000=0
001=1
010=1
011=2
100=1
101=2
110=2
111=3
*/

Measured memory_bytes: 256
s=input()*2;n=len(s)//2;X=[(0,0)]*4
for j in range(n+1):
 for k in range(3,-1,-1):
  a=int(s[n-j])
  if k>j+1:X[k]=(0,0)
  else:X[k]=(X[k][0]+9*X[k-1][0]if k else 1,(X[k][0]+(a-1)*X[k-1][0]+X[k-1][1]if k else 1)if a else X[k][1])
print(X[int(input())][1])

Measured memory_bytes: 38256