akhauriyash/Code-Regression huggingface dataset:
inp = input()
inp = int(float(inp))
aaa = 0
bbb = 0
yyy = 0

if 0 < inp and inp <= 10**9:
  if 500 <= inp:
    big = inp // 500
    aaa = big * 1000
    amari = inp % 500
    if 5 <= amari:
      smo = amari //5
      bbb = smo *5
    print(aaa+bbb)
  elif 5 <= inp:
    hhh = inp // 5
    yyy = hhh * 5
    print(yyy)
else:
  print(0)

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

int main(){
	ll n;
	cin >> n;
	int ans[50];
	for (int i = 0;i < 50;i++) {
		ans[i] = 0;
	}
	if (n == 0) {
		cout << 0 << endl;
	}
	else {
		while (n != 0) {
			if (n > 0) {
				ll sum = 0;
				for (int i = 0;;i += 2) {
					sum += pow(2, i);
					if (sum >= n) {
						n -= pow(2, i);
						ans[i] = 1;
						break;
					}
				}
			}
			else if (n < 0) {
				ll sum = 0;
				for (int i = 1;;i += 2) {
					sum -= pow(2, i);
					if (sum <= n) {
						n += pow(2, i);
						ans[i] = 1;
						break;
					}
				}
			}
		}
		int last;
		for (int i = 0;i < 50;i++) {
			if (ans[i] == 1) {
				last = i;
			}
		}
		for (int i = last;i >= 0;i--) {
			cout << ans[i];
		}
		cout << endl;
	}


	return 0;
}

Measured memory_bytes: 256
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

/*lld fac[500001]; 

void getfac(lld p)
{
    fac[0] = 1; 
    for (lld i=1 ; i<=500000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrmodp(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}
*/



lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k,m,g;
lld x,y,n1,a,b=0,n2,h,z,c;
/*
void solve()
{
    cin>>n;
    ans=1;
    k=0;
    vector<lld > v;
    x=0;
    for(i=0;i<n;i++)
    {
        cin>>l;
        v.pb(l);
        if(l==0) k=1;
        if(l>1000000000) x+=1; 
        //cout<<"A";
    }
    if(x>=2)
    {
        cout<<"-1";
        return;
    }
    if(k==1)
    {
        cout<<"0";
        return;
    }
    ans=1;

    for(i=0;i<n;i++)
    {
        ans*=v[i];
    //  cout<<ans<<" \n";
        if(ans > 1000000000000000000 || ans < 0)
        {
            cout<<"-1";
            return;
        }
    }
    cout<<ans;
}
*/

void solve()
{
    cin>>n;
    ans=0;
    m=n;
    for(i=2;i*i<n;i++)
    {
        if(m%i==0)
        {
            x=0;
            while(m%i==0)
            {
                x+=1;
                m/=i;
            }
            j=1;
            y=0;
         //   cout<<x<<" ";
            while(x>=y)
            {
                y+=j;
                j++;
            }
            ans+=(j-2);
        }
    }
    if(m>1) ans+=1; 
    cout<<ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    //cin>>t;
    //cout<<t;
   //  getfac(p2);
    //check the value by which modulo is to be taken
    
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
                  solve();
    cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++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 irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }
 
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
 
inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vi a(n);
  vvi x(n), y(n);
  rep(i,n){
    cin>>a[i];
    rep(j,a[i]){
      int X,Y; cin>>X>>Y;
      X--;
      x[i].push_back(X);
      y[i].push_back(Y);
    }
  }
  
  int ans=0;
  for(int bit=0; bit<(1<<n); bit++){
    bool ok=true;
    rep(i,n){
      if(bit&(1<<i)){
        rep(j, a[i]){
          int X=x[i][j]; int Y=y[i][j];
          if(bit&(1<<X)){
            if(Y==0) ok=false;
          }else{
            if(Y==1) ok=false;
          }
        }
      }
    }
    if(ok){
      int tmp=0;
      rep(i,n) if(bit&(1<<i)) tmp++;
      chmax(ans,tmp);
    }
  }
  cout<<ans<<endl;
}

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

using ll = long long;

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

int main()
{
    int N; cin >> N;
    vector<int> A(N); cin >> A;

    ll ans = 0;
    ll sum = 0;
    int l = 0, r = 0;
    while (r < N) {
        if (sum + A[r] == (sum ^ A[r])) {
            sum += A[r];
            ans += r - l + 1;
            r++;
        } else {
            sum ^= A[l];
            l++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].fe << " " << v[i].se << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <=================================================================================================================================
// <=================================================================================================================================




signed  main() {
    //op();
    lets_go
    int i, j, x, y, u, l;
    //int t; cin >> t; while (t--)
    {
        i = j = x = y = u = l = 0;

        int n;
        cin >> n;
        x = n + (n*n) + (n*n*n);
        PT(x);
        


        /* */

    }
    return 0;

}


Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main()
{
    int n, m; cin >> n >> m;
    int x = 0, y = 0, z = 0;
    bool flag = false;

    // x = m / 10000; // とりま、nを10000で割って、xの枚数を固定する
    // y = m / 5000;
    // z = m / 1000;

    // xが決まった後のyとzの関係式は以下の通り
    // y + z = n - x;
    // 5000 * y + 1000 * z = m - 10000 * x;

    for (int i = 0; i <= n; i++) {
        x = i;
        for (int j = 0; j <= n - i; j++) {
            y = j;
            if (10000 * i + 5000 * j + 1000 * (n - i - j) == m) {

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

                z = n - i - j;
                flag = true;
                break;
            }
        } if (flag) break;
    }

    // for (int i = 0; i <= n - x; i++) {
    //     // i: yの枚数, n - x - i: zの枚数
    //     if (5000 * i + 1000 * (n - x - i) == m - 10000 * x && x + i + (n - x - i) == n) {
    //         y = i;
    //         z = n - x -i;
    //         flag = true;
    //         break;
    //     }
    // }

    // for (int i = 0; i <= n - y; i++) {
    //     // i: xの枚数, n - y - i; zの枚数
    //     if (10000 * i + 1000 * (n - y -i) == m - 5000 * y && i + y + (n - y - i) == n) {
    //         x = i;
    //         z = n - y - i;
    //         flag = true;
    //         break;
    //     }
    // }

    // for (int i = 0; i <= n - z; i++) {
    //     // i: xの枚数, n - z - i; yの枚数
    //     if (10000 * i + 5000 * (n - z -i) == m - 1000 * z && i + (n - z - i) + z == n) {
    //         x = i;
    //         y = n - z - i;
    //         flag = true;
    //         break;
    //     }
    // }

    if (flag) {
        cout << x << " " << y << " " << z << endl;
    } else {
        cout << -1 << " " << -1 << " " << -1 << endl;
    }

    return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#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 pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n,x;
	cin >> n >> x;
	vector<int> a(n);
	FOR(i,0,n)
		cin >> a[i];
	sort(ALL(a));
	int ans = 0;
	FOR(i,0,n-1){
		if(a[i] <= x){
			ans++;
			x -=a[i];
		}else{
			break;
		}
	}
	if(a[n-1] == x)ans++;
	ANS(ans);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] In = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int d = In[0];
            int t = In[1];
            int s = In[2];
            if (d <= t * s) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 28116
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
//#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element



//---------- セグ木 ----------
//1<<17 = 2^17 = 131072
#define SEG_MAX (1 << 18)
int seg[SEG_MAX * 2] = { 0 };

//[a,b]にxを加算 (節点kをベースに[l,r]に足す)
void add(int a, int b, int x, int k = 0, int l = 0, int r = SEG_MAX - 1)
{
	if (a <= l && r <= b)
	{
		seg[k] += x;
	}
	else
	{
		int l0 = l;
		int r0 = l + (r - l) / 2;
		int l1 = r0 + 1;
		int r1 = r;
		if (a <= r0)
		{
			int kk = 2 * k + 1;
			add(a, b, x, kk, l0, r0);
		}
		if (l1 <= b)
		{
			int kk = 2 * k + 2;
			add(a, b, x, kk, l1, r1);
		}
	}
}

int get(int index)
{
	int sum = 0;
	int k = SEG_MAX - 1 + index; //根
	while (true)
	{
		sum += seg[k];
		if (k == 0) break;
		k = (k - 1) / 2;
	}
	return sum;
}

int N, K;
int A[200010];


signed main()
{
	cin >> N >> K;
	REP(i, N) cin >> A[i + 1];

	for (int i = 1; i <= N; i++)
	{
		add(i, i, A[i]);
	}

	for (int k = 0; k < K; k++)
	{
		memset(seg, 0, sizeof(seg));
		for (int i = 1; i <= N; i++)
		{
			int l = max(1, i - A[i]);
			int r = min(N, i + A[i]);
			add(l, r, 1);
		}

		bool end = true;
		for (int i = 1; i <= N; i++)
		{
			A[i] = min(N, get(i));
			if (A[i] < N)
			{
				end = false;
			}
		}
		if (end)
		{
			break;
		}
	}

	for (int i = 1; i <= N; i++)
	{
		cout << (i != 1 ? " " : "") << A[i];
	}
	cout << endl;
}



//
//signed main()
//{
//	cin >> N >> K;
//	REP(i, N) cin >> A[i];
//
//	for (int k = 0; k < K; k++)
//	{
//		memset(B, 0, sizeof(B));
//		for (int i = 0; i < N; i++)
//		{
//			for (int j = i - A[i]; j <= i + A[i]; j++)
//			{
//				if (0 <= j && j < N)
//					B[j]++;
//			}
//		}
//		memcpy(A, B, sizeof(A));
//		REP(i, N) cout << A[i] << " ";
//		cout << endl;
//	}
//
//}
//



Measured memory_bytes: 6008
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


typedef long long i64;
const int inf = (int)1.05e9;


int calc(vector<int>& nums)
{
	int len = nums.size();

	if(len == 0) return 0;
	if(len == 1) nums.back();

	int d = nums[len - 1];

	int x = (len - 1) * 9 + (d - 1);

	nums.pop_back();
	while(!nums.empty() && nums.back() == 0)
		nums.pop_back();
	int y = calc(nums) + d;

	return max(x, y);
}


int main()
{
	i64 n;

	scanf("%lld", &n);

	vector<int> nums;
	while(n > 0) {
		i64 q = n / 10;
		i64 r = n % 10;
		nums.push_back(r);
		n = q;
	}

	int ans = calc(nums);

	printf("%d\n", ans);

	return 0;
}

/* waffle */


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

#define repeat(i, x) for (int64_t i = 0; (i) < (int64_t)(x); (i)++)

const int64_t inf = (1LL << 60);

int maxChildren_[100];
vector<int> g_[100];
int depth_;

void DFS(int u, int par, int dep) {
    depth_ = max(depth_, dep);

    int num = 0;
    for (int to : g_[u]) {
        if (to == par) continue;
        num++;
        DFS(to, u, dep + 1);
    }
    maxChildren_[dep] = max(maxChildren_[dep], num);
}

int64_t countLeaves() {
    int64_t num = 1;
    for (int dep = depth_ - 1; dep >= 0; dep--) {
        num = min(inf, num * maxChildren_[dep]);
    }
    return num;
}

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

    int n;
    cin >> n;

    vector<int> a(n - 1), b(n - 1);
    repeat (i, n - 1) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;

        g_[a[i]].push_back(b[i]);
        g_[b[i]].push_back(a[i]);
    }

    int64_t colorful = n,
            numLeaves = n;
    repeat (u, n) {
        memset(maxChildren_, 0, sizeof(maxChildren_));
        depth_ = 0;

        DFS(u, -1, 0);

        if (depth_ + 1 > colorful) continue;
        // 葉の数を数える
        int64_t num = countLeaves();

        if (depth_ + 1 == colorful and num < numLeaves) numLeaves = num;
        if (depth_ + 1 < colorful) {
            colorful = depth_ + 1;
            numLeaves = num;
        }
    }

    repeat (i, n - 1) {
        memset(maxChildren_, 0, sizeof(maxChildren_));
        depth_ = 0;

        DFS(a[i], b[i], 0);
        DFS(b[i], a[i], 0);

        if (depth_ + 1 > colorful) continue;

        int64_t num = 2 * countLeaves();

        if (depth_ + 1 == colorful and num < numLeaves) numLeaves = num;
        if (depth_ + 1 < colorful) {
            colorful = depth_ + 1;
            numLeaves = num;
        }
    }

    cout << colorful << " " << numLeaves << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A[] = new int[100]; 
		int N = sc.nextInt(); 
		int D = sc.nextInt(); 
		int X = sc.nextInt(); 
		int cnt = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			for(int j = 1; j <= D; j = j+A[i]) {
				cnt++;
			}
		}
		System.out.println(X+cnt);
	}
}

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

using namespace std;

#define INF 1<<30
#define LINF 1ll<<60ll
#define pb(a) push_back(a)
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
#define ll long long
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;++i)
#define FORVEC(i, v) for(int i = 0;i < sz(v);++i)

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

#define fil0(i,n) cout<<swet(n)<<setfill('0')<<i<<resetiosflags(ios_base::floatfield)


int main(){
    string s;
    cin>>s;
    int a=0;
    REP(i,4){
        if(s[i]=='+'){
            a++;
        }else{
            a--;
        }
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
S = input()

a = 0
b = 0

for char in S:
    if char == 'a' and a + b < A + B:
            a += 1
            print('Yes')
    elif char == 'b' and a + b < A + B and b < B:
            b += 1
            print('Yes')
    else:
        print('No')


Measured memory_bytes: 4016
#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <set>
using namespace std;

struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }
	void init(int n) { par.assign(n, -1); }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	vector<int>X(M);
	vector<int>Y(M);
	for (int n = 0; n < M; ++n) {
		cin >> X[n] >> Y[n];
		--X[n];
		--Y[n];
	}
	UnionFind uf(N);
	for (int n = 0; n < M; ++n) {
		uf.merge(X[n], Y[n]);
	}
	int ans = 0;
	for (int i = 0;i<N; ++i) {
		int size = uf.size(i);
		ans = max(ans,size);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5636
n = int(input())
a = [[0]*n for i in range(n)]
  
for i in range(n):
    v = list(map(int, input().split()))
    u, k = v[0], v[1]
    for j in range(v[1]):
        a[u - 1][v[2 + j] - 1] = 1
 
for i in range(n):
    print(*a[i])

Measured memory_bytes: 6380
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define ENDL cout << endl
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1000000000;

int main() {
    string S, T;
    cin >> S >> T;
    T.pop_back();
    if (S == T) {
        COUT("Yes");
    } else {
        COUT("No");
    }
    return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> aSet(n + 1, true);
    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        aSet[a] = false;
    }

    vector<ll> dp(n + 1);
    dp[0] = 1;
    dp[1] = (aSet[1]) ? 1 : 0;
    for (int i = 2; i <= n; i++) {
        if (aSet[i]) {
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
        } else {
            dp[i] = 0;
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;
const int MOD = 1000000007;

const int MAX_N = 2010;
const int MAX_M = 2010;
ll d[MAX_N][MAX_M + 1];

ll N;
vector<string> answer;

void dfs(string s, ll pos){

  if(s.size() == N) {
    answer.push_back(s);
  }else{
    if(s.at(s.size()-1)== '0'){
      dfs(s+'0', pos+1);
      dfs(s+'1', pos+1);
    }else if(s.at(s.size()-1)!= '9'){
      char p = s.at(s.size()-1);
      for(int i= -1; i<2; i++){
      char pp = p+i;
      dfs(s+pp, pos+1);
      }
    }else{
      dfs(s+'8', pos+1);
      dfs(s+'9', pos+1);
    }
  }
}
int main() {
  ll k;
  cin >> k;
  for(int i=1; i<=10; i++){
    N = i;
    for(int j=1; j<=9; j++){
      string ps = to_string(j);
      dfs(ps,1);
    }
  }

  cout << answer[k-1] << endl;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

int main(void){
    int N;
    scanf("%d",&N);

    //A[1]~A[N]に格納する
    int* A;
    NEW(A,N+1);
    for(int i=1;i<=N;i++){
        scanf("%d",&A[i]);
    }

    //ボールを入れる箱の個数
    int M=0;

    //ボールを入れる方法を格納する
    //B[i]は番号iの箱
    int* B;
    NEW(B,N+1);
    for(int i=N;i>0;i--){
        //iの倍数が書かれた箱のボースの総数をsumに数える
        int index=i;
        int sum=0;
        while(index<=N){
            sum+=B[index];
            index+=i;
        }

        if((sum%2)==A[i]) B[i]=0;
        else{
            B[i]=1;
            M+=1;
        }
    }

    printf("%d\n",M);
    if(M!=0){
        for(int i=1;i<=N;i++){
            if(B[i]==1) printf("%d ",i);
        }
        printf("\n");
    }

    return 0;
}

//400点
//昇順で考えるより降順で考えたほうがいいこともあるよね

Measured memory_bytes: 2432
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL); \
	cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 1E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {
	calcFac(maxn);
	return;
}

void solve() {
	lli n;
	string s;
	cin >> n >> s;
	
	bool op[2 * n]; // chose to be LEFT
	memset(op, true, sizeof(op));
	for (int i = 1; i < 2*n; ++i) {
		if (s[i] == s[i - 1]) op[i] = !op[i - 1];
		else op[i] = op[i - 1];
	}
	
	bool flag = true;
	lli cnt = 0;
	for (int i = 0; i < 2*n; ++i) {
		if (op[i]) ++cnt;
		else --cnt;
		
		if (cnt < 0) flag = false;
	}
	if (cnt != 0) flag = false;
	if (s[0] == 'W' or s[2 * n - 1] == 'W') flag = false;
	
	if (flag) {
		lli ans = 1, pre = 0;
		for (int i = 0; i < 2*n; ++i) {
			if (op[i]) ++pre;
			else ans = (ans * pre--) % mod;
		}
		ans %= mod;
		cout << (ans * fac[n]) % mod << '\n';
	}
	else {
		cout << 0 << '\n';
	}
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, -1)
#define RREP(i, n, k) for(auto i = n; i != k; i--)

#define debug(x) cerr << #x << " " << x << endl
#define print(x) cout << x;
#define println(x) cout << x << endl;
#define spc << " " <<

#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define eb emplace_back
#define np next_permutation

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<class T>using V = vector<T>;
template<class T>using VV = vector<vector<T>>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

int main() {
   int n, k; scanf("%d%d", &n, &k);
   int P = 0;
   Vi w = Vi(n); rep(i, n) {
      scanf("%d", &w[i]);
      P = max(P, w[i]);
   }

   ll ans = INT_MAX;
   ll lower_payload = P, upper_payload = INT_MAX;

   while (true) {
      const ll mid_payload = (upper_payload + lower_payload) / 2;
//      printf("%lld %lld %lld\n", lower_payload, mid_payload, upper_payload);

      int track_n = 0, rest_payload = 0;
      for (int wi: w) {
         if (wi <= rest_payload) {
            rest_payload -= wi;
         } else {
            rest_payload = mid_payload - wi;
            track_n++;
            if (track_n > k) break;
         }
      }

      if (track_n <= k) {
         ans = min(ans, mid_payload);
         upper_payload = mid_payload;
      } else if (track_n > k) {
         lower_payload = mid_payload + 1;
      }

      if (lower_payload >= upper_payload) break;
   }

   printf("%lld\n", ans);
   return 0;
}



Measured memory_bytes: 3428
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = (N-1) - datas[::-1].index(now_max)
_min = min(datas)
min_index = datas.index(_min)

if max_index > min_index:
    diff = now_max - _min
else:
    diff = now_max - datas[0]
    
    for i in range(1,N-1):
        if i == max_index:
            now_max = max(datas[i+1:])
            max_index = datas.index(now_max,i+1)
        new_diff = now_max - datas[i]
        if diff < new_diff:
            diff = new_diff

print(diff)


Measured memory_bytes: 27836
cook=[0]*5
omit=[0]*5

for i in range(5):
    cook[i]=int(input())
    omit[i]=cook[i]%10
    if omit[i]==0:
        omit[i]=10

loss=omit.index(min(omit))
time=cook[loss]
del cook[loss]
del omit[loss]

for i in range(4):
    cook[i]=cook[i]+10-omit[i]
    time=time+cook[i]

print(time)

Measured memory_bytes: 3064
h,w,k = map(int,input().split())
board = [list(input()) for i in range(h)]
ans = 0

for paint_h in range(2 ** h):
    for paint_w in range(2 ** w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if (paint_h >> i)&1 == 0 and (paint_w >> j)&1 == 0:
                    if board[i][j] == "#":
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Measured memory_bytes: 9204
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = Long.parseLong(sc.next());
    Map<Long,Integer> map = getFactor(n);
    long sum = 0;
    int base;
    for(Integer value : map.values()){
      base = 1;
      while(value >= base){
        sum++;
        value-=base;
        base++;
      }
    }
    
    System.out.println(sum);
  }
  
  public static Map<Long,Integer> getFactor(long n){
    Map<Long,Integer> map = new HashMap<>();
    for(long i=2;i*i<=n;i++){
      if(n%i==0){
        int count = 0;
        while(n%i==0){
          count++;
          n/=i;
        }
        map.put(i,count);
      }
    }
    if(n!=1){
      map.put(n,1);
    }
    return map;
  } 
}

Measured memory_bytes: 35760
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(input())

    if N == 1:
        print("Hello World")
    else:
        A = int(input())
        B = int(input())
        print(A + B)


main()


Measured memory_bytes: 5072
use std::io::Read;

#[allow(non_snake_case)]
struct Input {
    D: usize,          // Days
    s: Vec<Vec<i64>>,  // score(day, contest)
    c: Vec<i64>        // cost(contest)
}

fn compute_scores(input: &Input, out: &Vec<usize>) -> Vec<i64> {
    let mut scores = vec![];
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
        scores.push(score);
    }
    scores
}


#[allow(non_snake_case)]
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let mut iter = buffer.split_whitespace();

    let D: usize = iter.next().unwrap().parse().unwrap();
    let c: Vec<i64> = (0..26)
        .map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let s: Vec<Vec<i64>> = (0..D)
        .map(|_| (0..26)
            .map(|_| iter.next().unwrap().parse().unwrap()).collect()
        )
        .collect();
    let input = Input{ D, s, c };

    let out: Vec<usize> = (0..D)
        .map(|_| (iter.next().unwrap().parse::<i64>().unwrap() - 1) as usize).collect();

    let scores = compute_scores(&input, &out);
    for i in 0..D {
        println!("{}", scores[i]);
    }
}


Measured memory_bytes: 2292
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

int main()
{
  char s[1000];
  scanf("%s",s);
  s[strlen(s)-8]='\0';
  printf("%s\n",s);
  return 0;
}

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

public class Main {

    static int K;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        K = sc.nextInt();

        System.out.println(solve());
    }

    static int solve() {
        return (K / 2) * ((K+1) / 2);
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

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

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

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 23124
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  int N; cin>>N;
  vector<int> A(N);
  set<int> list;
  rep(i,N)
  {
    cin>>A.at(i);
    list.insert(A.at(i));
  }
  sort(A.begin(),A.end());
  
  
  vector<bool> judge(N,true);  
  rep(i,N)
  {
    if(i==0) {continue;}
    if(A.at(i)==A.at(i-1))
    {
      judge.at(i)=false;
      judge.at(i-1)=false;
    }
  }
  rep(i,N)
  {
    if(!(judge.at(i))) {continue;}
    int a=A.at(i);
    for(int j=1;j*j<=a;j++)
    {
      if(a%j==0)
      {
        if(a!=j&&list.count(j)) {judge.at(i)=false;}
        if(a/j!=a&&list.count(a/j)) {judge.at(i)=false;}
      }
    }
  }
  
  ll ans=0;
  rep(i,N)
  {
    if(judge.at(i)) {ans++;}
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 13456
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define N 300005
#define vi vector<int>
#define all(v) v.begin(),v.end()

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   int p[n];
   for(int i=0;i<n;i++)
    cin>>p[i];
   int cnt=0;
   for(int i=1;i<(n-1);i++)
   {
       if(p[i]<p[i-1] && p[i]>p[i+1])cnt++;
       if(p[i]>p[i-1] && p[i]<p[i+1])cnt++;
   }
   cout<<cnt<<endl;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;

public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
        this.H = inpt[0];
        this.W = inpt[1];

        StringBuilder mp = new StringBuilder();
        for(int i=0; i<this.H; i++) {
            mp.Append(Reader.ReadLine());
        }
        this.Map = mp.ToString();


        bool ans = this.GetAns(1, 0, 0);
        Console.WriteLine(ans?"Possible":"Impossible");
    }

    private Dictionary<int, Dictionary<long, bool>> dic = new Dictionary<int, Dictionary<long, bool>>();
    private bool GetAns(long flag, int r, int c) {
        int posKey = r * this.W + c;
        if(!dic.ContainsKey(posKey)) {
            dic.Add(posKey, new Dictionary<long, bool>());
        }
        if(dic[posKey].ContainsKey(flag)) {
            return dic[posKey][flag];
        }

        if(r == this.H-1 && c == this.W - 1) {
            bool ans = true;
            for(int i=0; i<this.Map.Length; i++) {
                bool f = (flag & (1l<<i)) != 0;
                if(Map[i] == '#' && f) {
                    continue;
                } else if(this.Map[i] == '.' && (!f)) {
                    continue;
                } else {
                    ans = false;
                    break;
                }
            }
            this.dic[posKey][flag] = ans;
            return ans;
        }

        bool ret = false;
        if(c<this.W-1) {
            int newIdx = r * this.W + (c+ 1);
            if(this.Map[newIdx] == '#') {
                long newFlag = flag + (1l<<newIdx);
                ret = ret | this.GetAns(newFlag, r, c+1);
            }
        }
        if(r < this.H-1 && (!ret)) {
            int newIdx = (r+1)*this.W + c;
            if(this.Map[newIdx] == '#') {
                long newFlag = flag + (1l<<newIdx);
                ret = ret | this.GetAns(newFlag, r+1, c);
            }
        }
        this.dic[posKey][flag] = ret;
        return ret;
    }


    private int H;
    private int W;
    private string Map;

    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"


4 5
##...
.##..
..##.
...##



";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 4056
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main(){

    int n,m;
    readf("%d %d\n",&n,&m);
    int a[31];
    for(int i=0;i<31;i++){
	a[i] = i;
    }
    for(int i=0;i<m;i++){
	auto a1 = chomp(readln()).split(",");
	swap(a[to!int(a1[0])] , a[to!int(a1[1])]);
    }
    for(int i=1;i<=n;i++){
	writeln(a[i]);
    }
}

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

#define SORT(v) sort(v.begin(),v.end())
#define si(n) scanf("%d",&n)
#define sii(n,m) scanf("%d %d",&n,&m)
#define sl(n) scanf("%lld",&n)
#define sll(n,m) scanf("%lld %lld",&n,&m)
#define ss(cad) scanf("%s",cad)
#define PB push_back
#define fst first
#define scn second
#define DBG(x) cerr << #x << " = " << (x) << endl; 
#define M 1000000007
#define N_MAX 100010

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vp;

int link[100010], tam[100010], tam2[100010];
int con[100010];

int find(int x){
	if(x == link[x])	return x;
	return link[x] = find(link[x]);
}

void unir(int a, int b){
	a = find(a);
	b = find(b);
	if(a == b)
		return;
	link[b] = a;
	tam[a] += tam[b];
	tam2[a] += tam2[b];
}

int main(){
	int n;
	si(n);
	vector<vi> grx, gry, cntx;
	grx.resize(100010);
	gry.resize(100010);
	cntx.resize(100010);
	for(int i = 0; i < n; i++){
		int a, b;
		sii(a, b);
		a--;
		b--;
		grx[a].push_back(b);
		gry[b].push_back(a);
	}

	for(int i = 0; i < 100000; i++){
		link[i] = i;
		if((int)gry[i].size() >= 2)
			tam[i] = 1;
		tam2[i] = 1;
	}

	for(int i = 0; i < 100000; i++){
		if((int)grx[i].size() >= 2)
			for(int p = 1; p < grx[i].size(); p++)
				//if((int)gry[grx[i][p-1]].size() >= 2 || (int)gry[grx[i][p]].size() >= 2)
					unir(grx[i][p-1], grx[i][p]);
	}
	for(int i = 0; i < 100000; i++){
		for(int p = 0; p < gry[i].size(); p++)
			cntx[find(i)].push_back(gry[i][p]);
	}
	for(int i = 0; i < 100000; i++){
		sort(cntx[i].begin(), cntx[i].end());
		cntx[i].resize(unique(cntx[i].begin(), cntx[i].end()) - cntx[i].begin());
	}
	ll ans = 0;
	for(int i = 0; i < 100000; i++){
		if(tam[find(i)] != 0)
			ans -= (ll)gry[i].size();
		if(con[find(i)] == 0 && tam[find(i)] != 0){
			ans += (ll)tam2[find(i)]*(ll)cntx[find(i)].size();
			con[find(i)] = 1;
			//printf("padre=%d, cnt=%d %lld\n", find(i), tam2[find(i)], ans);
		}
	}
	printf("%lld\n", ans);

	return 0;
}


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

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  if (a < b) {
    ll i = b / x + 1;
    ll j = 0;
    if (a != 0) j = (a - 1) / x + 1;
    cout << i - j << endl;

  } else {
    cout << (a % x == 0 ? 1 : 0) << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const string n="CODEFESTIVAL2016";
short ans;
int main()
{
	string s;
	cin>>s;
	for(short i=0;i<n.size();i++)
		if(n[i]!=s[i])
			ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define pbb pop_back
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define map map<ll,ll>
#define set set<ll>
const int m=1e9+7;
int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    cout<<a*b/(__gcd(a,b))<<endl;
    
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	long long int n, m;
	long long int ans = 0;
	scanf("%lld%lld", &n, &m);
	if (m > 2 && n > 2)
	{
		ans = (m - 2)*(n - 2);
	}
	else if (m == 2 || n == 2)
	{
		ans = 0;
	}
	else if (m == 1 && n == 1)
	{
		ans = 1;
	}
	else if (m == 1)
	{
		ans = n - 2;
	}
	else if (n == 1)
	{
		ans = m - 2;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back 
#define mp make_pair
#define sp " "
#define cs "Case "
#define fi first
#define sn second 
#define po(x) x*x
/* STL */
#define vi vector<int>v
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxi(v) distance(v.begin(),max_element(v.begin(),v.end()))
#define mxa(a) *max_element(a, a.size())
#define r(a) reverse(a.begin(),a.end())
/* loops */
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n)i=1;i<=(n);i++)
#define fa(i,a,n) for(int  i=a;i<=b;i++)
/*Special*/
#define Ezio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(something)  cerr<<#something<<" - "<<something<<"\n";         

int main()
{
  
   Ezio
   ll t,m,n,x,a,b;
   string s,ss;
   
   cin>>s;
   cin>>ss;
   n=0;
   fr(i,sz(s)){
     if(s[i]!=ss[i]){
       n++;
     }
   }
   
   cout<<n<<endl;
   return 0;
}
    

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

using namespace std;

int main()
{
	int64_t  N, A, B;
	cin >> N >> A >> B;
	if (A*N > B)
	{
		cout << B << endl;
	}
	else
	{
		cout << A*N << endl;
	}
 	return 0;
}

Measured memory_bytes: 256