akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
    int a,b,i;
    cin>>a>>b;
    if(a>b)
    {
        for(i=0;i<a;i++)
        {
            cout<<b;
        }
    }
    else if(a==b)
    {
        for(i=0;i<a;i++)
        {
            cout<<a;
        }
    }
    else if(a<b)
    {
        for(i=0;i<b;i++)
        {
            cout<<a;
        }
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  int even = 1;
  REP(i, N){
    if(A[i]%2 == 0) even *= 2;
  }

  int ans = pow(3, N)-even;

  cout << ans << "\n";


  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll; 
typedef pair<int, int> P; 
const int mod = 1e9 + 7;
const int N = 2e6 + 5;
struct ed{
	int to, nxt;
}e[N << 1];
int head[N], tot = 1;
void add(int u, int v){
	e[tot].to = v, e[tot].nxt = head[u], head[u] = tot++;
}

int n, s, t, dep[N], mx[N], fa[N], ans, tp;
void dfs(int x, int last){
	fa[x] = last;
	dep[x] = dep[last] + 1;
	mx[x] = dep[x];
	for (int i = head[x]; i; i = e[i].nxt){
		int v = e[i].to;
		if (v == last)	continue;
		dfs(v, x);
		mx[x] = max(mx[x], mx[v]);
	}
}
int  main()
{
	scanf("%d%d%d", &n, &s, &t);
	for (int i = 0; i < n - 1; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		add(x, y);
		add(y, x);
	}
	dfs(t, 0);
	t = 1;
	ans = (dep[s] - dep[t]) >> 1;
	while (true){
		if (dep[s] <= t)	break;
		if ((dep[s] - dep[t]) & 1)
			ans = max(ans, mx[s] - t - 1 + tp);
		else
			ans = max(ans, mx[s] - t - 1 + tp);
		s = fa[s];
		t++;
		tp++;
	}
	printf("%d\n", ans);
}

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

using namespace std;

typedef pair<int,int> pii;
const int inf = 1e9+10;

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

    int n;
    while(cin>>n)
    {
        vector<pair<int,pii> > ex;
        for(int i=0;i<n;i++)
        {
            int x1,y1,x2,y2;
            cin>>x1>>y1>>x2>>y2;
            if(y1==y2)
            {
                ex.push_back(make_pair(min(x1,x2),pii(-inf,y1)));
                ex.push_back(make_pair(max(x1,x2),pii(inf,y2)));
            }else
            {
                ex.push_back(make_pair(x1,pii(min(y1,y2),max(y1,y2))));
            }
        }

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

        set<int> se;
        int ans = 0;
        for(int i=0;i<ex.size();i++)
        {
            int y1=ex[i].second.first,y2=ex[i].second.second;
            if(y1==-inf)
            {
                se.insert(y2);
            }else if(y1==inf)
            {
                se.erase(y2);
            }else
            {
                ans += distance(se.lower_bound(y1),se.upper_bound(y2));
            }
        }

        cout<<ans<<endl;
    }

    return 0;
}



Measured memory_bytes: 8092
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String[] S = br.readLine().split(" ");
			int ans = 0;
			if (S[1].equals("+")) {
				ans = Integer.parseInt(S[0]) + Integer.parseInt(S[2]);
			} else {
				ans = Integer.parseInt(S[0]) - Integer.parseInt(S[2]);
			}

			System.out.println(ans);
		} catch (Exception e) {
			System.err.println("Error:" + e.getMessage());
		}
	}
}

Measured memory_bytes: 8272
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define vvb vector<vb>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

void solve(){
	int n;
	cin >> n;
	
	vll dp(n+1);
	dp[0] = 1;
	for(int i=1 ; i<n+1 ; ++i){
		dp[i] = 0;
		for(int j=3 ; j<=i ; ++j){
			dp[i] += dp[i-j];
			dp[i] %= MOD;
		}
	}
	
	cout << dp[n];
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cout << fixed << setprecision(10);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


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

static const double pi = 3.141592653589793;
int main(){
  double a,b,h,m;
  cin>>a>>b>>h>>m;
  double tan = h*30+m/60*30;
  double cho = 6*m;
  double s = min(360-abs(cho-tan), abs(cho-tan));
  double r = 2*pi*s/360;
  //double r = s;
  double ans = sqrt(a*a + b*b - 2*a*b*cos(r));
  cout<<fixed << setprecision(20)<<ans;
  return 0;
}

Measured memory_bytes: 4292
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

int main(){
    int dat[3]; FOR(i,3) scanf("%d", dat+i);
    sort(dat, dat+3);
    if (dat[0] == 5 && dat[1] == 5 && dat[2] == 7) {
        puts("YES");
    } else {
        puts("NO");
    }
    return 0;
}


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

string s;
int pos=0;

bool cat(){
  if(s[pos]=='m'){
    pos++;
    if(s[pos]=='m' && !cat())return false;
    if(s[pos]!='e')return false;
    pos++;
    if(s[pos]=='m' && !cat())return false;
    if(s[pos]!='w')return false;
    else{
      pos++;
      return true;
    }
  }
  return false;
}

int main(){
  cin>>s;
  if(cat() && s.length()==pos)cout<<"Cat"<<endl;
  else cout<<"Rabbit"<<endl;
  return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,k;
  cin>>n>>k;
  int a;
  set<int> S;
  vector<int> count(300000,INF);
  rep(i,n){
    cin>>a;
    if(count[a]==INF){
      count[a]=0;
    }
    count[a]++;
    S.insert(a);
  }
  int si=S.size();
  sort(all(count));
  if(si<=k){
    cout<<0<<'\n';
  }
  else{
    int sum=0;
    rep(i,si-k){
      sum+=count[i];
    }
    cout<<sum<<'\n';
  }
  return(0);
}


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

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;

double len(pdd a, pdd b) {
	return sqrt((a.first-b.first)*(a.first-b.first) + (a.second-b.second)*(a.second-b.second));
}

int main() {
	vector<pdd> p;
	double x, y;
	while(scanf("%lf,%lf",&x,&y)!=EOF) {
		p.push_back(pdd(x,y));
	}
	double S = 0.0;
	for(int i=1; i+1<p.size(); i++) {
		double a = len(p[0], p[i]);
		double b = len(p[i], p[i+1]);
		double c = len(p[i+1], p[0]);
		double z = (a+b+c)/2.0;
		S += sqrt(z*(z-a)*(z-b)*(z-c));
	}
	printf("%.8lf\n", S);
	return 0;
}

Measured memory_bytes: 1088
#include<stdio.h>

int main(void)
{
    int n=0 ,x=0 ;
    int i=0 ,j=0 ,k=0 ;
    int flg=0 ;

    while(1){
        scanf("%d%d",&n ,&x);
        if (n==0 && x==0) break;

        for (i=1 ;i<=n-2 ;i++){
            for (j=i+1 ;j<=n-1 ;j++){
                for (k=j+1 ;k<=n ;k++){

                    if ((i+j+k)==x){
                        flg++;
                    }

                }
            }
        }

        printf("%d\n",flg);
        flg=0;
    }

    return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	/* 入力 */
	String s = scan.next();

	String ans = "";
	for(int i = 0; i < s.length(); i++){
	    if(s.charAt(i) == '0'){
		ans += "0";
	    }else if(s.charAt(i) == '1'){
		ans += "1";
	    }else{
		if(ans.length() != 0){
		    ans = ans.substring(0,ans.length()-1);
		}
	    }
	}

	/* 出力 */
	System.out.println(ans);
    }
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll x;
    cin >> x;
    ll res = x % 500;
    x -= res;
    cout << 2 * x + (res / 5) * 5;
    return (0);
}

Measured memory_bytes: 256
// Aizu 2102: Rummy
// 2017.9.20 bal4u@uu

#include <stdio.h>
#include <string.h>

int f[3][15];
char tr['Z'];
int v[10];

int main()
{
	int t, i, j, n;
	char c[5];

	tr['R'] = 0, tr['G'] = 1, tr['B'] = 2;
	scanf("%d", &t); while (t-- > 0) {
		memset(f, 0, sizeof(f));
		for (i = 0; i < 9; i++) scanf("%d", v+i);
		for (i = 0; i < 9; i++) scanf("%s", c), f[tr[*c]][v[i]]++;
		for (n = 0, j = 0; j < 3; j++)	for (i = 1; i <= 9; i++) {
			while (f[j][i] > 0 && f[j][i+1] > 0 && f[j][i+2] > 0)
				n++, f[j][i]--, f[j][i+1]--, f[j][i+2]--;
			if (n == 3) goto Done;
		}
		for (j = 0; j < 3; j++) for (i = 1; i <= 9; i++) {
			while (f[j][i] >= 3) n++, f[j][i] -= 3;
			if (n == 3) goto Done;
		}
Done:	puts(n == 3 ? "1" : "0");
	}
	return 0;
}

Measured memory_bytes: 1752
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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;}


int main() {
  string s;
  cin >> s;
  s[5] = ' ';
  s[13] = ' ';
  P(s);
  return 0;
}

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

using namespace std;

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

string& smax(string& a, string& b) {
  if (a.length() > b.length()) return a;
  if (a.length() < b.length()) return b;
  int i;
  REP(i,a.length()) {
    if (a[i] > b[i]) {
      return a;
    } else if (a[i] < b[i]) {
      return b;
    }
  }
  return a;
}

const int INF = (1<<29);
int mp[10] = {INF,2,5,5,4,5,6,3,7,6};

string dp[10010];

int main() {
  int i,j;
  int N,M;
  int a[10];

  scanf("%d %d", &N, &M);
  REP(i,M) scanf("%d", &a[i]);

  REP(i,N+1) if (dp[i] != "" || i == 0) {
    REP(j,M) {
      int next = i + mp[a[j]];
      if (next <= N) {
        string t = dp[i] + (char)('0' + a[j]);
        dp[next] = smax(dp[next], t);
      }
    } 
  }
  cout << dp[N] << endl;

  return 0;
}


Measured memory_bytes: 37504
#include<bits/stdc++.h>
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); i++)
#define RREP(i, a, b) for(int i=(int)(a); i>=(int)(b); i--)
#define ALL(v) v.begin(), v.end()
#define INF 2e9
typedef long long ll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return 1;}return 0;}

using namespace std;

#define bit(n, k) (n>>k)&1
#define MOD 1000000007LL

int a[30][30];
ll dp[1<<22];

int main(void)
{
	int N;
	cin >> N;
	REP(i, 0, N){
		REP(k, 0, N){
			cin >> a[i][k];
		}
	}
	dp[0] = 1;
	REP(S, 1, 1<<N){
		int i = __builtin_popcount(S);
		REP(k, 0, N){
			if((bit(S, k)==1)and(a[i-1][k]==1))
			{
				dp[S] = (dp[S] + dp[S^(1<<k)])%MOD;
			}
		}
	}
	cout << dp[(1<<N)-1] << "\n";
}


Measured memory_bytes: 18688
def resolve():
  a = int(input())
  b = int(input())
  c = int(input())
  d = int(input())
  e = int(input())
  x = 10
  if a%10 != 0:
    x = min(x, a%10)
    a = a - a%10 + 10
  if b%10 != 0:
    x = min(x, b%10)
    b = b - b%10 + 10
  if c%10 != 0:
    x = min(x, c%10)
    c = c - c%10 + 10
  if d%10 != 0:
    x = min(x, d%10)
    d = d - d%10 + 10
  if e%10 != 0:
    x = min(x, e%10)
    e = e - e%10 + 10

  ans = (a + b + c + d + e) - 10 + x
  print(ans)

  return

if __name__ == "__main__":
  resolve()


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

int main() {

    int A, B, K;
    cin >> A >> B >> K;

    set<int> s;
    for(int i = 0; i < K; i++) {
        s.insert(A++);
        s.insert(B--);
        if(A > B) break;
    }

    for(auto e : s) cout << e << 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);
	// 2つの文字の固まりをそれぞれ整数値と想定して読み込む 
	int a = sc.nextInt();
	int b = sc.nextInt();
	int area = a*b;/* ここを変えて面積を求めよう */
	int length = (a+b)*2;/* ここを変えて周囲の長さを求めよう */ 
	System.out.println(area + " " + length);
	sc.close();
	}
}


Measured memory_bytes: 26108
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

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

int main()
{
	for(int n;cin>>n,n!=-1;){
		complex<double> pos(1,0);
		rep(i,n-1){
			double rad=arg(pos);
			pos.real()-=sin(rad);
			pos.imag()+=cos(rad);
		}
		cout<<pos.real()<<endl;
		cout<<pos.imag()<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


#define X(x) ((x) & 63)
#define Y(x) ((x) >> 6)
#define XY(x, y) (((y) << 6) | (x))


const int dp[] = {-64, -1, 64, 1};


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int H, W, C = 0;

  std::cin >> H >> W;

  std::vector<std::string> a(H);

  for (auto& s : a) {
    std::cin >> s;

    C += std::count(ALL(s), '.');

    s = '#' + s + '#';
  }

  a.insert(std::begin(a), std::string(W + 2, '#'));
  a.push_back(std::string(W + 2, '#'));

  std::queue<int> queue;

  int parent[4444] = {0}, p = XY(1, 1), c = -1, G = XY(W, H);

  queue.push(p);

  parent[p] = -1;

  while (! queue.empty()) {
    int p = queue.front(); queue.pop();

    for (int k = 0; k < 4; k ++) {
      int pp = p + dp[k], xx = X(pp), yy = Y(pp);

      if (parent[pp] == 0)
        if (a[yy][xx] == '.') {
          parent[pp] = p;
            
          if (pp == G) {
            c = 0;

            for (p = pp; p >= 0; p = parent[p], c ++)
              ;
            
            goto endloop;
          }
            
          queue.push(pp);
        }
    }
  }

 endloop:

  std::cout << (c == -1 ? c : C - c) << std::endl;

  return 0;
}


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

using namespace std;

typedef long long int ll;

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

  string S;
  cin >> S;

  vector<int> count(256);
  for (int i = 0; i < S.size(); i++) count[(int)S[i]]++;
  int num = 0;
  for (int i = 0; i < count.size(); i++) {
    if (count[i] == 0) continue;
    else if (count[i] == 2) num++;
    else {
      cout << "No" << endl;
      return 0;
    }
  }
  if (num == 2) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


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

namespace Aizu
{
    class Program
    {
        static void Main(string[] args)
        {
            var answer = new List<int>();

            while (true)
            {
                var firstLine = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
                var w = firstLine[0];
                var h = firstLine[1];

                if(w == 0 && h == 0)
                {
                    break;
                }

                var map = new List<char[]>();
                var isArrived = new bool[h, w];

                for (var i = 0; i < h; i++)
                {
                    map.Add(Console.ReadLine().Split(' ').Select(value => char.Parse(value)).ToArray());

                    for (var j = 0; j < w; j++)
                    {
                        if (map[i][j] == '0')
                        {
                            isArrived[i, j] = true;
                        }
                    }
                }

                var count = 0;
                for (var i = 0; i < h; i++)
                {
                    for (var j = 0; j < w; j++)
                    {
                        if (!isArrived[i, j])
                        {
                            count++;
                            Dfs(i, j, map, isArrived);
                        }
                    }
                }

                answer.Add(count);
            }

            answer.ForEach(value => Console.WriteLine($"{value}"));
        }

        private static void Dfs(int i, int j, List<char[]> map, bool[,] isArrived)
        {
            isArrived[i, j] = true;

            for(var y = i - 1; y <= i + 1; y++)
            {
                for(var x = j - 1; x <= j + 1; x++)
                {
                    if(y < 0 || map.Count <= y || x < 0 || map[0].Length <= x)
                    {
                        continue;
                    }

                    if(!isArrived[y, x] && map[y][x] == '1')
                    {
                        Dfs(y, x, map, isArrived);
                    }
                }
            }
        }
    }
}



Measured memory_bytes: 16584
#include<stdio.h>

int main(void)
{
  int x1,x2,x3,x4,x5;
  scanf("%d %d %d %d %d",&x1,&x2,&x3,&x4,&x5);
  
	int i,count = 0;	
  int s[5];
  
  s[0] = x1;
  s[1] = x2;
  s[2] = x3;
  s[3] = x4;
  s[4] = x5;
  
  for(i = 0 ; i < 5 ; i++)
  {
    count = count + 1;
    if(s[i] == 0)
      break;
  }
  
  printf("%d",count);
  
  return 0;
}


Measured memory_bytes: 1680
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
vector<int>pat[202020];
int dat[26][202020];
int dp[202020];
bool isok[202020];
int main()
{
	string s;
	cin >> s;
	int num = s.size();
	reverse(s.begin(), s.end());
	s.push_back('#');
	reverse(s.begin(), s.end());
	s.push_back('#');
	for (int i = 0; i < 26; i++)
	{
		dat[i][num + 1] = num + 1;
		for (int j = num + 1; j >= 1; j--)
		{
			if (s[j] == 'a' + i)dat[i][j - 1] = j;
			else dat[i][j - 1] = dat[i][j];
		}
	}
	fill(dp, dp + num + 10, 1000000000);
	dp[0] = 0;
	for (int i = 0; i <= num; i++)
	{
		for (int j = 0; j < 26; j++)
		{
			dp[dat[j][i]] = min(dp[dat[j][i]], dp[i] + 1);
			pat[dat[j][i]].push_back(i);
		}
	}
	isok[num + 1] = true;
	for (int i = num + 1; i >= 0; i--)
	{
		if (!isok[i])continue;
		for (int j = 0; j < pat[i].size(); j++)
		{
			if (dp[i] == dp[pat[i][j]] + 1)isok[pat[i][j]] = true;
		}
	}
	string ans;
	int now = 0;
	for (;;)
	{
		char c;
		for (int j = 0; j < 26; j++)
		{
			if (isok[dat[j][now]] && dp[now] + 1 == dp[dat[j][now]])
			{
				now = dat[j][now];
				c = 'a' + j;
				break;
			}
		}
		ans.push_back(c);
		if (now == num + 1)break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 59396
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int Q,H,S,D;
  cin >> Q >> H >> S >> D;
  int N;
  cin >> N;
  ll a=min({Q*8,H*4,S*2,D});
  ll b=min({Q*4,H*2,S});
  ll ans=(N/2)*a+(N%2)*b;
  cout << ans << endl;
  return 0;
}

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

int main(){
    int h1,h2,m1,m2,k,i,j;
    cin >> h1>>m1>>h2>>m2>>k;
    int h,m;
    h=h2-h1;
    m=m2-m1;
    if(m<0){
        h--;
        m+=60;
    }
    int sum=h*60+m;
    sum-=k;
    cout << sum;
}


Measured memory_bytes: 3552
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main(){
    int a,b,c;
    cin >> a>> b >>c;
    int ab = a+b;
    int bc = b+c;
    int ac = a+c;
    int ans = min(ab,bc);
    ans = min(ans,ac);
    cout << ans <<  endl;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  ll a, b, c; cin >> a >> b >> c;
  if(c > a+b) cout << (a+b+1) + b << endl;
  else cout << b+c << endl;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<math.h>
using namespace std;
int n,d;
std::vector<std::vector<int> > v;

double cal(int i,int j){
  double ll=0;
  for (int k = 0; k < d; k++) {
    ll+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
    // std::cout << (v[i][k]-v[j][k])*(v[i][k]-v[j][k]) << '\n';
  }
  return sqrt(ll);
}

int solve(){
  int ans=0;
  for (size_t i = 0; i < n-1; i++) {
    for (size_t j = i+1; j < n; j++) {
        double ch;
        ch=cal(i,j);
        // std::cout <<"(i:"<<i<<" j:"<<j<<")"<<floor(ch)<<":"<<ch<< '\n';
        if(floor(ch)==ch)ans++;
    }
  }
  return ans;

}

int main(){

  std::cin >> n>>d;
  v.resize(n);

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < d; j++) {
      int tmp;
      std::cin >> tmp;
      v[i].push_back(tmp);
    }
  }
  int ans=0;
  ans=solve();
  std::cout << ans << '\n';


  return 0;
}


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

using namespace std;

const int N = 1e5 + 3;

long long a[N], b[N], c[N], dp[N][3];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) 
        cin >> a[i] >> b[i] >> c[i];
    for (int i = 1; i <= n; ++i) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]});
    return 0;
}

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

using namespace std;

#define llong long long
#define ii pair<int, int>
#define xx first
#define yy second
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define len(x) ((int)x.size())

#define maxn 111
int n, m;
int cnt[30] = {0};
int a[maxn][maxn];

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> n >> m;
  rep(i, n) {
    string s;
    cin >> s;
    for (auto& c: s) cnt[c - 'a']++;
  }
  memset(a, -1, sizeof(a));
#define no return cout << "No", 0

  rep(i, 26) {
    if (cnt[i] % 2 == 1) {
      if (m % 2 == 0 or n % 2 == 0) no;
      if (a[n / 2][m / 2] != -1) no;
      a[n / 2][m / 2] = i;
      --cnt[i];
    }
  }

  if (n % 2 == 1) {
    rep(i, m / 2) {
      int p = -1;
      rep(f, 26) if (cnt[f] % 4 == 2) p = f;
      if (p == -1) rep(f, 26) if (cnt[f] % 4 == 0 and cnt[f]) p = f;
      if (p == -1 or cnt[p] == 0) no;

      a[n / 2][i] = a[n / 2][m - i - 1] = p;
      cnt[p] -= 2;
    }
  }
  if (m % 2 == 1) {
    rep(i, n / 2) {
      int p = -1;
      rep(f, 26) if (cnt[f] % 4 == 2) p = f;
      if (p == -1) rep(f, 26) if (cnt[f] % 4 == 0 and cnt[f]) p = f;
      if (p == -1 or cnt[p] == 0) no;

      a[i][m / 2] = a[n - i - 1][m / 2] = p;
      cnt[p] -= 2;
    }
  }

  rep(i, 26) if (cnt[i] % 4 == 2) no;

  cout << "Yes";


  return 0;
}


Measured memory_bytes: 256
N, Q = list(map(int,input().split()))
S = input()
A = []
B = []
for i in range(Q):
    in1, in2 = list(map(int,input().split()))
    A.append(in1)
    B.append(in2)
ac = [0]
for i in range(1, N):
    if S[i] == "C" and S[i - 1] == "A":
        ac.append(ac[-1] + 1)
    else:
        ac.append(ac[-1])
        
for i in range(Q):
    ans = ac[B[i] - 1] - ac[A[i] - 1]
    print(ans)

Measured memory_bytes: 92452
#include <bits/stdc++.h>
using namespace std;
int n,x[9],y[9];
double ans;
double got[9][9];
int vis[9],num[9];
void dfs(int x){
	if (x==n+1){
		for (int i=2;i<=n;i++) ans+=got[num[i]][num[i-1]];
	}
	for (int i=1;i<=n;i++) if (!vis[i]){
		vis[i]=1;
		num[x]=i;
		dfs(x+1);
		vis[i]=0;
	}
}
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>x[i]>>y[i];
	}
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			got[i][j]=sqrt(abs(x[i]-x[j])*abs(x[i]-x[j])+abs(y[i]-y[j])*abs(y[i]-y[j]));
	dfs(1);
	for (int i=1;i<=n;i++) ans/=(double)(i);
	printf("%.8lf",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,dp[100002],ans=0;
vector<int>a[100002];
int solve(int u){
    if(dp[u]!=-1){
        return dp[u];
    }
    int ans=0;
    for(int i=0;i<a[u].size();i++){
        int v=a[u][i];
        ans=max(ans,solve(v)+1);
    }
    dp[u]=ans;
    return dp[u];
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int x,y;
        cin>>x>>y;
        a[x].push_back(y);
    }
    for(int i=1;i<=n;i++){
        dp[i]=-1;
    }
    for(int i=1;i<=n;i++){
        ans=max(ans,solve(i));
    }
    cout<<ans;
}


Measured memory_bytes: 8192
#include "stdio.h"
#include "math.h"

#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef long long  ll;
typedef pair<int, int> P;

/** Problem0193 : Deven-Eleven **/
int field[100][100];
int d[100][100];
bool vis[100][100];
const int dx0[6]={0, 1, 1, 1, 0, -1}, dy0[6]={-1, -1, 0, 1, 1, 0};
const int dx1[6]={-1, 0, 1, 0, -1, -1}, dy1[6]={-1, -1, 0, 1, 1, 0};

int main()
{
	int n, m, s, t;
	while (cin>>m>>n, m||n) {
		fill(field[0], field[0]+100*100, -1);
		fill(d[0], d[0]+100*100, INF);
		
		cin >> s;
		rep(k, s) {
			int x, y; cin >> x >> y;
			x--; y--;
			field[x][y] = k;
			
			fill(vis[0], vis[0]+100*100, false);
			queue<P> Q;
			queue<int> dis;
			Q.push(P(x, y));
			dis.push(0);
			
			while (Q.size()) {
				P p = Q.front(); Q.pop();
				int dd = dis.front(); dis.pop();
				
				if (vis[p.first][p.second])continue;
				vis[p.first][p.second]=true;
				
				d[p.first][p.second] = min(dd, d[p.first][p.second]);
				
				rep(i, 6) {
					int nx, ny;
					if (p.second%2==1) {
						nx = p.first+dx0[i]; ny = p.second+dy0[i];
					} else {
						nx = p.first+dx1[i]; ny = p.second+dy1[i];
					}
					if (0<=nx&&nx<m && 0<=ny&&ny<n && !vis[nx][ny]) {
						Q.push(P(nx, ny));
						dis.push(dd+1);
					}
				}
			}
		}

			
		cin >> t;
		int ans=0;
		
		rep(k, t) {
			int x, y; cin >> x >> y;
			x--; y--;
			fill(vis[0], vis[0]+100*100, false);
			queue<P> Q;
			queue<int> dis;
			Q.push(P(x, y));
			dis.push(0);
			
			int cnt=0;
			while (Q.size()) {
				P p = Q.front(); Q.pop();
				int dd = dis.front(); dis.pop();
				
				if (vis[p.first][p.second])continue;
				vis[p.first][p.second] = true;
				
				if (dd<d[p.first][p.second])
					cnt++;
				
				rep(i, 6) {
					int nx, ny;
					if (p.second%2==1) {
						nx = p.first+dx0[i]; ny = p.second+dy0[i];
					} else {
						nx = p.first+dx1[i]; ny = p.second+dy1[i];
					}
					if (0<=nx&&nx<m && 0<=ny&&ny<n && !vis[nx][ny]) {
						Q.push(P(nx, ny));
						dis.push(dd+1);
					}
				}
			}
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

const int kMaxCache = 1 << 11;
const int kMaxL = int(1e5);
int V[1 << 18];
int W[1 << 18];
int dp[kMaxCache][kMaxL + 1];
int ndp[kMaxL + 1];

void setmax(int& a, int b) {
  if (a < b) a = b;
}

int Parent(int node) { return (node - 1) / 2; }

int main() {
  in(int, n);
  rep(i, n) cin >> V[i] >> W[i];

  for (int i = W[0]; i <= kMaxL; ++i) dp[0][i] = V[0];
  for (int node = 1; node < min(kMaxCache, n); ++node) {
    int parent = Parent(node);
    for (int i = 0; i <= kMaxL; ++i) dp[node][i] = dp[parent][i];
    for (int i = kMaxL; i - W[node] >= 0; --i) {
      setmax(dp[node][i], dp[parent][i - W[node]] + V[node]);
    }
  }

  in(int, q);
  rep(i, q) {
    in(int, v, l);
    --v;

    if (v < kMaxCache) {
      out(dp[v][l]);
    } else {
      vector<int> vs, ws;
      while (v >= kMaxCache) {
        vs.push_back(V[v]);
        ws.push_back(W[v]);
        v = Parent(v);
      }
      int ans = 0;
      rep(i, 1 << vs.size()) {
        int v_sum = 0;
        int w_sum = 0;
        rep(j, vs.size()) if ((i >> j) & 1) {
          v_sum += vs[j];
          w_sum += ws[j];
        }
        if (w_sum <= l) {
          ans = max(ans, v_sum + dp[v][l - w_sum]);
        }
      }
      out(ans);
    }
  }
}


Measured memory_bytes: 805612
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int N =Integer.parseInt(in.next());
		int A =Integer.parseInt(in.next());
		int B =Integer.parseInt(in.next());
		System.out.println(Math.min(B,N*A));
	}
}

Measured memory_bytes: 22612
Odd = *0..9
Even = (0..9).map{ |k| k < 5 ? k * 2 : k * 2 % 10 + 1 }

n = gets.to_i
s = gets.chomp.reverse
m = gets.to_i
num = gets.split.map(&:to_i)
sum = 0
o, e = 0, 0
n.times do |i|
  if s[i] != '*'
    sum += (i+1).odd? ? Odd[s[i].to_i] : Even[s[i].to_i]
  else
    (i+1).odd? ? o += 1 : e += 1
  end
end

count = 2.times.map{ [0] * 10 }
if o >= 1
  m.times{ |i| count[0][Odd[num[i]]]+= 1 }
  o -= 1
else
  m.times{ |i| count[0][Even[num[i]]] += 1 }
  e -= 1
end

o.times do |i|
  10.times do |j|
    m.times do |k|
      count[1][(j + Odd[num[k]]) % 10] += count[0][j]
    end
  end
  count[0] = count[1].dup
  count[1].fill(0)
end

e.times do |i|
  10.times do |j|
    m.times do |k|
      count[1][(j + Even[num[k]]) % 10] += count[0][j]
    end
  end
  count[0] = count[1].dup
  count[1].fill(0)
end

p count[0][(10 - (sum % 10)) % 10]

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

int main(){
        std::string s;
        std::cin >> s;

        long ans=0, l=s.size()-1;
        for(int i=0; i<(1<<l); i++){
                long sm = 0, kou = s[0] - '0';
                for(int j=0; j<l; j++){
                        if((i>>j)&1){
                                sm += kou;
                                kou = (s[j+1]-'0');
                        }else{
                                kou *= 10;
                                kou += s[j+1]-'0';
                        }
                }
                ans += sm+kou;
        }
        printf("%ld\n", ans);
        return 0;
}

Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int  in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int d,n;

signed main(){
    io();

    cin>>d>>n;
    if(n==100){
        if(d==0){
            cout<<101<<endl;
        }else if(d==1){
            cout<<10100<<endl;
        }else{
            cout<<1010000<<endl;
        }
        return 0;
    }
    cout<<n;
    rep(i,d*2){
        cout<<"0";
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

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

    return 0;
}

Measured memory_bytes: 19116
import math
import fractions
n,m=map(int, input().split())
a=list(map(int, input().split()))
b=[]
s=math.floor(math.log2(max(a)))
buf=0
for i in range(n): #aは偶数なので、1/2した値の配列を作った
    b.append(int(a[i]//2))

for i in range(s+1): #2のi乗ですべての数が割れるかどうか
    for j in b:
        if j%(2**i)==0:
            buf+=1
        else:
            continue
    if buf==n:
        buf=0
        continue
    else:
        break

def lcm(x,y): #最小公倍数を求める関数の定義
    return (x*y)//fractions.gcd(x,y)

if buf!=0 and buf!=n: #偶奇が入り混じってるとき
    print(0)
elif n==1: #配列の要素が1つしかないとき
    d=int(m//b[0])
    print(int((d+1)//2))
else:
    c=[lcm(b[0],b[1])] #以下のサイクルで求めた最小公倍数を入れる配列
    for i in range(1,n):
        x=lcm(c[i-1],b[i])
        c.append(x)
        if x<m:
            continue
        else:
            break
    d=int(m//c[len(c)-1]) #最後の値(c[len(c)-1])が配列bの最小公倍数
    ans=int((d+1)//2)
    print(ans)

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

using namespace std;

int main()
{
    int n,t,x;
    cin>>n>>t;
    x=n-t;
    if(x<=0)
    {
        cout<<"0\n";
    }
    else
    {
        cout<<x<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int arr[200005];

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> v(200001);
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        v[x]++;
    }
    int cnt=0;
    sort(v.rbegin(),v.rend());
    for(int i=0;i<k;i++)
        cnt+=v[i];
    cout<<n-cnt;



}


Measured memory_bytes: 1024
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define nmax 200001
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define PI 3.141592654

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

    map<ll,ll> vals;
    ll maxi = 0;
    for(int i=0;i<pow(2,n);i++) {
        ll a; scanf("%lld", &a);
        vals[a]++;
        maxi = max(maxi,a);
    }

    // for(auto i:vals)
    //     cout<<i.first<<" "<<i.second<<endl;

    if(vals[maxi]>1){
        cout<<"No"<<endl;
        return 0;
    }

    multiset<ll> se;
    se.insert(maxi);
    vals.erase(maxi);

    for(int i=1;i<=n;i++) {
        multiset<ll>::reverse_iterator rit = se.rbegin();
        vector<ll> temp;

        while(rit != se.rend()) {
            map<ll,ll>::iterator it = vals.lower_bound(*rit);
            if(it==vals.begin()) {
                cout<<"No"<<endl;
                return 0;
            }

            it--;
            temp.pb((*it).first);
            (*it).second--;
            
            if((*it).second==0)
                vals.erase((*it).first);

            rit++;
        }
        for(auto i:temp)
            se.insert(i);
    }

    if(se.size()!=pow(2,n) && vals.size()!=0)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;

    return 0;
}



Measured memory_bytes: 18680
import itertools
X,Y,Z,N=input().split()
hako=[]
hako.append(X)
hako.append(Y)
hako.append(Z)
hako.append(N)
ans = ["1","9","7","4"]
kari=[]
for v in itertools.permutations(hako,4):
    kari.append(list(v))

if ans in kari:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
using namespace std;

class Dice{
public:
  int value[6];
  void roll(char _order) {
    switch(_order) {
    case 'N':
      swap(value[4], value[0]);
      swap(value[0], value[1]);
      swap(value[1], value[5]);
      break;
    case 'E':
      swap(value[2], value[0]);
      swap(value[0], value[3]);
      swap(value[3], value[5]);
      break;
    case 'S':
      swap(value[1], value[0]);
      swap(value[0], value[4]);
      swap(value[4], value[5]);
      break;
    case 'W':
      swap(value[0], value[2]);
      swap(value[2], value[5]);
      swap(value[5], value[3]);
      break;
    }
  }
  void rotate(void) {
    this->roll('N');
    this->roll('E');
    this->roll('S');
  }
  bool operator==(const Dice other) {
    bool res = true;
    for (int knock=1;knock<=30;knock++) {
      res = true;
      for (int i=0;i<6;i++)
        if (other.value[i] != this->value[i])
          res = false;
      if (res)
        break;
      else {
        if (knock % 5 == 0) {
          if (knock / 5 <= 3) {
            this->roll('N');
          } else if (knock / 5 == 4) {
            this->roll('E');
          } else {
            this->roll('E');
            this->roll('E');
          }
        } else {
          this->rotate();
        }
      }
    }
    return res;
  }
};

int main() {
  Dice base, comp;
  for (int i=0;i<6;i++)
    cin >> base.value[i];
  for (int i=0;i<6;i++)
    cin >> comp.value[i];

  if (comp == base)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main() {
    string a,b; cin>>a>>b;
    string S=a+b;
    int s=atoi(S.c_str());
    int ans=sqrt(s);
    if(s==ans*ans){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
//hi
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long int LL;
string s;
set<string> st;
int main(void){
    cin>>s;
    int k;
    scanf("%d",&k);
    int i,j;
    for(i=0;i<s.size();i++){
		string tmp="";
		for(j=i;j<s.size() && j<i+5;j++){
			tmp+=s[j];
			st.insert(tmp);
		}
	}
	int cnt=0;
	string ret;
	for(auto x : st){
		cnt++;
		if(cnt==k){
			ret=x;
			break;
		}
		//cout << x << endl;
	}
	cout << ret << endl;
    return 0;
}


Measured memory_bytes: 1664
int main(void){
  int i,n;
  char list[128],x[2],before[2],after[2];

  while(1){
    scanf("%d",&n);
    if(!n) break;

    for(i=0;i<128;i++){
      list[i] = i;
    }
    while(n--){
      scanf("%s%s",before,after);
      list[before[0]] = after[0];
    }

    scanf("%d",&n);
    while(n--){
      scanf("%s",x);
      putchar(list[x[0]]);
    }
    putchar('\n');
  }

  return 0;
}

Measured memory_bytes: 0