akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main()
{
  long long int x,y;
  cin>>x>>y;
  
  if(y>=2*x && 4*x>=y)
  {
    if((y-2*x)%2==0 && (4*x-y)%2==0)
      cout<<"Yes";
    
    else
      cout<<"No";
  }
  
  else
    cout<<"No";
  
  return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    vector<int> dp(n);
    dp[0] = h[0];
    for(int i = 1; i < n; i++){
        dp[i] = dp[i-1]+max(0,h[i]-h[i-1]);
    }
    int ans = dp[n-1];
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  cin >> N >> X;
  vi A(N); rep(i,N) cin >> A[i];
  int ans1 = 0;
  if(A[0]>X){
    ans1 += A[0]-X;
    A[0] = X;
  }
  rep2(i,1,N){
    if(A[i]+A[i-1] > X){
      ans1 += A[i]+A[i-1] - X;
      A[i] = X-A[i-1];
    }
  }
  
  cout << ans1 << endl;
  return 0;
}

Measured memory_bytes: 4036
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a;i<(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 100;
const char ENDL = '\n';
int N, M;

struct UnionFind {
	vector<ll> par; 

	UnionFind(ll N) : par(N) {
		rep(i,N) par[i] = i;
	}

	ll root(ll x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(ll x, ll y) {
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry) return;
		par[rx] = ry;
	}

	bool same(ll x, ll y) {
		ll rx = root(x);
		ll ry = root(y);
		return rx == ry;
	}
};


int main()
{
	
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	ll a[MAX], b[MAX], Ans = 0;
	cin >> N >> M;
	
	rep(i, M)
		cin >> a[i] >> b[i];

	rep(i, M) {
		UnionFind tree(N);
		rep(j,M){
			if (i != j)
				tree.unite(a[j] - 1, b[j] - 1);
		}

		if (!tree.same(a[i]-1, b[i]-1))
			Ans++;
	}
	cout << Ans << ENDL;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fname "D"
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define bug(x) cerr << (#x) << " = " << (x) << '\n'
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define X first
#define Y second

using namespace std;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<float, float> ff;
typedef pair<double, double> dd;

int main()
{
	if (fopen(fname".INP", "r")) {
		freopen(fname".INP", "r", stdin);
		freopen(fname".OUT", "w", stdout);
	}
	ios_base::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	for(char ch = 'a'; ch <= 'z'; ++ch) {
		vector<ii> v;
		REP0(i, s.size()) if (s[i] == ch) v.pb({i, 0});
		REP0(i, v.size()) v[i] = {2*i - v[i].X, v[i].X};
		REP0(i, v.size() - 1) {
			if (v[i].X <= v[i + 1].X) {
				cout << v[i].Y + 1 << ' ' << v[i + 1].Y + 1;
				return 0;
			}
		}
	}
	cout << "-1 -1";
	return 0;
}

Measured memory_bytes: 1088
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;
//ll mod = 998244353;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	//t %= mod;
	if (n % 2 == 1)t *= a;
	return t /*% mod*/;
}

const int INF = 1001001001;
//const ll INF = 1e18;

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

ll cal_gcd(ll a, ll b) {
	ll m = max(a, b);
	ll n = min(a, b);
	while (m%n != 0) {
		ll b = m % n;
		m = n;
		n = b;
	}
	return n;
}

vector<pair<ll, ll>> prime_factorize(ll N) {
	vector<pair<ll, ll>> res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0;
		while (N % a == 0) {
			++ex;
			N /= a;
		}
		res.push_back({ a, ex });
	}
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

ll prime(ll N) {
	ll res = 1;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0;
		while (N % a == 0) {
			++ex;
			N /= a;
		}
		res *= ex + 1;
	}
	if (N != 1)res *= 2;
	return res;
}


int main() {
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll tmp = i + 1;
		ll x = n / tmp;
		ans += tmp * x*(x + 1) / 2;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (max(A, max(B, C)) == 7 && min(A, min(B, C)) == 5 && A+B+C == 17){
        cout << "YES" << endl;
    }
    else cout << "NO" << 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);
		String n = sc.next();
		int[] a = new int[4];
		for(int i=0; i<4; i++){
			a[i] = Character.getNumericValue(n.charAt(i));
		}
		if(a[0]+a[1]+a[2]+a[3] == 7){
			System.out.println(a[0]+ "+" +a[1]+ "+" +a[2]+ "+" +a[3]+"=7");
		}else if(a[0]+a[1]+a[2]-a[3] == 7){
			System.out.println(a[0]+ "+" +a[1]+ "+" +a[2]+ "-" +a[3]+"=7");
		}else if(a[0]+a[1]-a[2]+a[3] == 7){
			System.out.println(a[0]+ "+" +a[1]+ "-" +a[2]+ "+" +a[3]+"=7");
		}else if(a[0]+a[1]-a[2]-a[3] == 7){
			System.out.println(a[0]+ "+" +a[1]+ "-" +a[2]+ "-" +a[3]+"=7");
		}else if(a[0]-a[1]+a[2]+a[3] == 7){
			System.out.println(a[0]+ "-" +a[1]+ "+" +a[2]+ "+" +a[3]+"=7");
		}else if(a[0]-a[1]+a[2]-a[3] == 7){
			System.out.println(a[0]+ "-" +a[1]+ "+" +a[2]+ "-" +a[3]+"=7");
		}else if(a[0]-a[1]-a[2]+a[3] == 7){
			System.out.println(a[0]+ "-" +a[1]+ "-" +a[2]+ "+" +a[3]+"=7");
		}else if(a[0]-a[1]-a[2]-a[3] == 7){
			System.out.println(a[0]+ "-" +a[1]+ "-" +a[2]+ "-" +a[3]+"=7");
		}

		sc.close();

	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main(){
	string str;
	getline(cin, str);
	for(int i = 0; i < str.size() - 1; i++){
		if(str[i] >= 'a' && str[i] <= 'z'){
			str[i] -= 'a' - 'A';
		}
	}
	cout << str << endl;
}

Measured memory_bytes: 1176
import collections

n=int(input())
v=list(map(int,input().split()))
cto1,cto2,cte1,cte2=0,0,0,0
fro1,fro2,fre1,fre2=0,0,0,0
ve=v[1::2]
vo=v[::2]
ve.sort()
vo.sort()
ans=-1
cnto=collections.Counter(vo)
cnte=collections.Counter(ve)
mco=cnto.most_common()
mce=cnte.most_common()

fro1,cto1=mco[0]
fre1,cte1=mce[0]
if cto1==cte1==n//2:
  if fro1==fre1:
    ans=n//2
  else:
    ans=0
elif cto1==n//2:
  if fro1!=fre1:
    ans=n//2-cte1
  else:
    fre2,cte2=mce[1]
    ans=n//2-cte2
elif cte1==n//2:
  if fro1!=fre1:
    ans=n//2-cto1
  else:
    fro2,cto2=mco[1]
    ans=n//2-cto2
if ans!=-1:
  print(ans)
  exit()


fro2,cto2=mco[1]
fre2,cte2=mce[1]

if cto1==cte1:
  if fro1!=fre1:
    ans=n-cto1-cte1
  else:
    if cto2!=cte2:
      ans=n-cto1-max(cte2,cto2)
    else:
      ans=n-cto1-cto2


#print(fro1,fro2,fre1,fre2)
#print(cto1,cto2,cte1,cte2)
print(ans)

Measured memory_bytes: 21952
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a=0, b = 0,c,d, n, k;
string s, t;

int kaizyo (int x)
{
	if (x % 2 == 1)
		return 0;
	else
		return 1 + kaizyo(x / 2);
}

int main()
{
	int n;
	cin >> n;
	vector<int> a(n),b(n);
	rep(i, n)
		cin >> a.at(i);
	rep(i, n)
		b.at(i) = kaizyo(a.at(i));
	cout << accumulate(all(b), 0) << endl;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using Long = long long;
using pii = pair<int,int>;
#define ff first
#define ss second

int h , w , m;
map<int,int> H , W;
multiset<pii> S;

int main(){

    scanf("%d %d %d",&h,&w,&m);
    int x , y;
    int mx = 0 , my = 0;

    for( int i = 0 ; i < m ; ++i ){
        scanf("%d %d",&x,&y);
        H[x]++;
        W[y]++;
        S.insert({x,y});
        mx = max( mx , H[x] );
        my = max( my , W[y] );
    }

    vector<int> hh , ww;
    for( auto &it : H ) if( it.ss == mx ) hh.push_back(it.ff);
    for( auto &it : W ) if( it.ss == my ) ww.push_back(it.ff);

    int ans = mx + my ;
    for( int i : hh ){
        for( int j : ww ){
            if( !S.count({i,j}) ){
                printf("%d\n", ans);
                return 0;
            }
        }
    }
    printf("%d\n" , ans - 1);
    return 0;
}

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

const int MAXD = 8;
const int sichigo[] = {3, 5, 7};
int n;

int main()
{
    cin >> n;
    queue<int> que;
    set<int> nums;
    rep(i, 3) que.push(sichigo[i]);
    while(que.size())
    {
        ll a = que.front();
        que.pop();
        rep(i, 3)
        {
            ll b = a * 10 + sichigo[i];
            if(b <= n)
            {
                que.push(a * 10 + sichigo[i]);
            }
        }
        nums.insert(a);
    }

    //cout << nums.size() << " ";
    int res = 0;
    for(int x : nums)
    {
        //cout << x << " ";
        //f(x < 0) cout << "err" << " ";
        if(x > n) break;
        string s = to_string(x);
        bool f1 = false, f2 = false, f3 = false;
        rep(i, s.size())
        {
            if(s[i] == '3') { f1 = true; }
            else if(s[i] == '5') { f2 = true; }
            else if(s[i] == '7') { f3 = true; }
        }
        if(f1 && f2 && f3)
        {
            res++;
        }
    }
    cout << res << endl;

    
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  if (n % 2 == 0) {
    for (int i = n - 1; i >= 1; i -= 2) {
      cout << a.at(i) << " ";
    }
    for (int i = 0; i <= n - 4; i += 2) {
      cout << a.at(i) << " ";
    }
    cout << a.at(n - 2) << endl;
  }
  
  else if (n > 1) {
    for (int i = n - 1; i >= 0; i -= 2) {
      cout << a.at(i) << " ";
    }
    for (int i = 1; i <= n - 4; i += 2) {
      cout << a.at(i) << " ";
    }
    cout << a.at(n - 2) << endl;
  }
  
  else cout << a.at(0) << endl;
}


Measured memory_bytes: 2944
#include<stdio.h>

int main () {
    long n;
    long m = 1;
    scanf("%ld", &n);
    for (long i = 1; i*i <= n; ++i) {
        if (n % i == 0 && m + n/m > i + n/i) {
            m = i;
        }
    }
    printf("%ld\n", m + n/m - 2);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back


void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int h,w;
int v[30];
int a,b,c;

signed main(){
  cin>>h>>w;

  a = (h/2)*(w/2);
  b = (w%2)*(h/2)+(h%2)*(w/2);
  c = (h%2)*(w%2);


  rep(i,h){
    string s;
    cin>>s;
    rep(j,s.size())
      v[s[j]-'a']++;
  }

  bool ans=true;

  rep(i,30){
    int as=min(a,v[i]/4);
    a-=as;
    v[i]-=as*4;
    int bs=min(b,v[i]/2);
    b-=bs;
    v[i]-=bs*2;
    int cs=min(c,v[i]);
    c-=cs;
    v[i]-=cs;
    if(v[i]!=0)
      ans = false;
  }
  if(a!=0||b!=0||c!=0)
    ans = false;

  if(ans){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;

  }
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        if(s.charAt(0)!=s.charAt(1)){
            if(s.charAt(2)==s.charAt(3)){
                if(s.charAt(4)==s.charAt(5)){
                    System.out.println("Yes");return;
                }
            }
        }
        System.out.println("No");
    }
}

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

const int limit = 50;

int N, M;
int a[limit], b[limit];

bool graph[limit][limit];
bool visited[limit];

void dfs(int v)
{
    visited[v] = true;
    for(int v2 = 0; v2 < N; v2++)
    {
        if(graph[v][v2] == false) continue;
        if(visited[v2] == true) continue;
        dfs(v2);
    }
}

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

    for(int i = 0; i < M; i++)
    {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    int ans = 0;

    for(int i = 0; i < M; i++)
    {
        // この辺が橋かどうか判定
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

        for(int j = 0; j < N; j++) visited[j] = false;

        //0から始めて探索
        dfs(0);

        //visitedが一つでもfalseならば橋である
        bool bridge = false;
        for(int j = 0; j < N; j++)
        {
            if(visited[j] == false)
            {
                bridge = true;
            }
        }
        if(bridge == true)
        {
            ans += 1;
        }

        //戻す
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
//#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

//DEBUG_OUT("----\n");

void func(void)
{
    uint32 N;
    cin >> N;
    vector<uint32> a(N);
    for(int i=0; i<N; i++){ cin >> a[i]; }
    
    sort(a.begin(), a.end());
    int j = 0;
    uint32 v = a[0];
    uint32 cnt = 0;
    uint32 ans = 0;
    while(j<N){
        while((j<N) && (v==a[j])){
            cnt++;
            j++;
        }
        if(v < cnt){
            ans += cnt - v;
        }else if(v > cnt){
            ans += cnt;
        }else{
            // v == cnt is OK
        }
        if(j<N){
            v = a[j];
        }
        cnt = 0;
    }

    cout << ans << endl;
}




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

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

    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a.at(i);
    }

    int d_max=0;
    for(int i=0; i<n-1; i++){
        if(d_max<a.at(i+1)-a.at(i)){
            d_max=a.at(i+1)-a.at(i);
        }
    }

    int d_0n=(k-a.at(n-1))+a.at(0);

    cout<<min(k-d_max,k-d_0n)<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

int n;
std::vector<bool> pr(10000001, true);
std::set<int> sets;

int main() {
    for(int i = 2; i <= 10000000; ++i) {
        if(pr[i]) {
            for(long long j = ((long long)i) * i; j <= 10000000ll; j += i) {
                pr[j] = false;

            }
            if(i >= 13) {
                if(pr[i - 2] && pr[i - 6] && pr[i - 8]) {
                    sets.insert(i);
                }
            }
        }
    }

    while(std::cin >> n, n) {
        std::set<int>::iterator it  = sets.upper_bound(n);
        --it;

        std::cout << *it << std::endl;
    }
}

Measured memory_bytes: 2328
// atcoder/abc129/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  string s;
  while (cin >> s) {
    const int N = 100000 + 5;
    const lli mod = 1e9 + 7;

    lli dp[N][2];
    dp[0][0] = 1;
    dp[0][1] = 0;

    for (int i = 1; i <= s.size(); ++i) {
      if (s[i - 1] == '0') {
        dp[i][0] = dp[i - 1][0];
        dp[i][1] = (dp[i - 1][1] * 3) % mod;
      } else {
        dp[i][0] = (dp[i - 1][0] * 2) % mod;
        dp[i][1] = (dp[i - 1][1] * 3 + dp[i - 1][0]) % mod;
      }
    }

    cout << (dp[s.size()][0] + dp[s.size()][1]) % mod << endl;
  }

  return 0;
}


Measured memory_bytes: 2000
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  a,b,c,d = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  while 1:
    c = c - b
    if c <= 0:
      print("Yes")
      exit()
    a = a - d
    if a <= 0:
      print("No")
      exit()
      
if __name__ == '__main__':
  main()

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

int main()
{
    int n, k;
    scanf("%d%d", &n, &k);

    int *h{new int[n]};
    for (int i = 0; i < n; i++) scanf("%d", h + i);
    std::sort(h, h + n);
    
    int min{2000000000};
    for (int i = 0; i + k <= n; i++)
    {
        min = std::min(h[i + k - 1] - h[i], min);
    }
    printf("%d\n", min);

    delete[] h;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    int h,a;
    cin >> h >> a;
    cout << (h+a-1)/a << endl;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  string s, t;
  cin >> s >> t;
  bool b = true;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) b = false;
  }
  if (s.size() + 1 != t.size()) b = false;

  if (b)
    cout << "Yes\n";
  else
    cout << "No\n";
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b.begin(), b.end());
  if (b[n - 1] == b[n - 2]) {
    for (int i = 0; i < n; i++) {
      cout << b[n - 1] << endl;
    }
  }
  else {
    for (int i = 0; i < n; i++) {
      if (a[i] == b[n - 1]) {
        cout << b[n - 2] << endl;
      }
      else {
        cout << b[n - 1] << endl;
      }
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
ll n, w, weight[105], value[105];
vector<ll> A[5];
int main(){
//	freopen("simpleknapsack.in","r",stdin);
	cin >> n >> w;
	for(ll i = 0; i<n; i++){
		cin >> weight[i] >> value[i];
		A[weight[i]-weight[0]].push_back(value[i]);
	}
	ll w0 = weight[0];
	for(ll i=0; i<=3; i++) sort(A[i].begin(), A[i].end(),greater<ll>());
	for(ll i=0; i<=3; i++) for(ll j=1; j<A[i].size(); j++) A[i][j]+=A[i][j-1];
//	for(ll i=0; i<=3; i++){ for(auto j : A[i]) printf("%d ", j); prllf("\n"); }
	ll best = 0;
	for(ll i=0; i<=A[0].size(); i++){
		for(ll j=0; j<=A[1].size(); j++){
			for(ll k=0; k<=A[2].size(); k++){
				for(ll l=0; l<=A[3].size(); l++){
					ll curw = i*w0 + j*(w0+1) + k*(w0+2) + l*(w0+3);
					if(curw > w) continue;
//					printf("%d %d %d %d = %d\n", i, j, k, l, curw);
					ll cur = 0;
					if(i) cur += A[0][i-1];
					if(j) cur += A[1][j-1];
					if(k) cur += A[2][k-1];
					if(l) cur += A[3][l-1];
					best = max(cur, best);
				}
			}
		}
	}
	cout << best;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
using namespace std;

int n,m;
string s;

ll cal(ll a,ll b){
  ll res=1;
  for(int i=a;i>1;i--)res*=i;
  for(int i=b;i>1;i--)res/=i;
  return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1=freopen("in","r",stdin);
    //stream2=freopen("out","w",stdout);
    if(stream1==NULL)return 0;
    //if(stream2==NULL)return 0;
#endif
    cin>>n;
    int m=0,a=0,r=0,c=0,h=0;
    int all=0;
    for(int i=0;i<n;i++){
      string t;cin>>t;
      bool flag=0;
      if(t[0]=='M'){m++;flag=1;}
      if(t[0]=='A'){a++;flag=1;}
      if(t[0]=='R'){r++;flag=1;}
      if(t[0]=='C'){c++;flag=1;}
      if(t[0]=='H'){h++;flag=1;}
      if(flag)all++;
    }
    ll sum=0;
    for(int i=0;i<2;i++){
      for(int j=0;j<2;j++){
        for(int k=0;k<2;k++){
          for(int l=0;l<2;l++){
            for(int o=0;o<2;o++){
              if(i+j+k+l+o!=3)continue;
              ll now=1;
              if(i==1 && m==0)continue;
              else if(i) now*=m;
              if(j==1 && a==0)continue;
              else if(j)now*=a;
              if(k==1 && r==0)continue;
              else if(k)now*=r;
              if(l==1 && c==0)continue;
              else if(l)now*=c;
              if(o==1 && h==0)continue;
              else if(o)now*=h;
              //cerr<<now<<endl;
              sum+=now;
            }
          }
        }
      }
    }
    cout<<sum<<endl;
#ifdef LOCAL_DEFINE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    fclose(stream1);
    //fclose(stream2);
#endif
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define num_element 135
int main(void)
{
	int i,n,m;
	char array[num_element];
	char a[2];
	char b[2];
	char input[2];
	while(1)
	{
		for(i=0;i<num_element;i++)
		{
			array[i] = i;
		}
		scanf("%d",&n);
		if(n == 0)return 0;
		for(i=0;i<n;i++)
		{
			scanf("%s %s",a,b);
			array[a[0]] = b[0];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s",input);
			printf("%c",array[input[0]]);
		}
		printf("\n");
	}
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  int digit_num = 0;
  int a = N;
  
  while(a > 0) {
    digit_num += a % 10;
    a /= 10;
  }
  if (N % digit_num) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;    
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    sort(A.rbegin(),A.rend());
    ll X = A[0];
    double num = INF;
    ll Y;
    for(int i=1;i<N;i++){
        double mid = abs(X/2.0-A[i]);
        //cout << i << ":" << mid << endl;
        if(num>mid){
            num = mid;
            Y = A[i];
        }
    }
    cout << X << " " << Y << endl;
    return 0;
}

Measured memory_bytes: 3968
#!/usr/bin/env python3
import sys
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)


A, B = map(int, input().split())


if A*B % 2 == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Coer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int W = in.nextInt();
            int V = n * 1000;
            int[] w = new int[n + 1];
            int[] v = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                w[i] = in.nextInt();
                v[i] = in.nextInt();
            }
            // 只考虑前i个物品的情况下，总价值是j所需最少容量值
            long[][] dp = new long[n + 1][V + 1];
            for (int i = 0; i <= V; i++) {
                if (i == 0) {
                    dp[0][i] = 0;
                } else {
                    dp[0][i] = Long.MAX_VALUE;
                }
            }
            for (int i = 1; i <= n; i++) {
                for (int j = 0; j <= V; j++) {
                    if (v[i] > j) {
                        dp[i][j] = dp[i - 1][j];
                    } else {
                        if (dp[i - 1][j - v[i]] == Long.MAX_VALUE) {
                            dp[i][j] = dp[i - 1][j];
                        } else {
                            dp[i][j] = Math.min(dp[i - 1][j], dp[i - 1][j - v[i]] + w[i]);
                        }
                    }
                }
            }
            int ans = 0;
            for (int tot = 0; tot <= V; tot++) {
                if (dp[n][tot] <= W) {
                    ans = tot;
                }
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}

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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  string subs = s.substr(0, n / 2);
  if(s == (subs + subs))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

typedef long long ll;
#define INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
const double pi = acos(-1.0);

int n;
int l;

pair<double,double> twoT2P(int twoT){
  double v = pi*twoT/l;
  return make_pair(cos(v),sin(v));
}
int t[3010];

int main(){
  cin>>n>>l;
  rep(i,0,n){
    scanf("%d",t+i);
  }
  double cntX=0;
  double cntY=0;
  rep(i,0,n){
    rep(j,i+1,n){
      pair<double,double> ret = twoT2P(t[i]+t[j]);
      cntX+=(n-2*(j-i))*ret.first;
      cntY+=(n-2*(j-i))*ret.second;
    }
  }
  // cnt / 3 / C(n,3) = 2*cnt/n/(n-1)/(n-2)

  printf("%.15lf %.15lf\n",6*cntX/n/(n-1)/(n-2),6*cntY/n/(n-1)/(n-2));
  return 0;
}


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

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

        if (b - a >= 2019) System.out.println(0);
        else {
            long min = Long.MAX_VALUE;
            for  (long i = a; i <= b; ++i) {
                for (long j = i + 1; j <= b; ++j) {
                    min = Math.min(min, ((i % 2019) * (j % 2019)) % 2019);
                }
            }

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

Measured memory_bytes: 22868
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

P dir[9] = {mp(0, 0), mp(0, 1), mp(1, 0), mp(1, 1), mp(-1, 0), mp(0, -1), mp(-1, -1), mp(1, -1), mp(-1, 1)};

int main() {
    ll H, W, N;
    cin >> H >> W >> N;
    map<P, int> m;
    rep(i, N) {
        int a, b; cin >> a >> b;
        --a, --b;
        rep(j, 9) {
            int h = dir[j].first + a, w = dir[j].second + b;
            if(h < 1 || h >= H - 1 || w < 1 || w >= W - 1) continue;
            m[mp(h, w)]++;
        }
    }
    vector<ll>cnt(10, 0);
    ll sum = 0;
    for(auto itr = m.begin(); itr != m.end(); ++itr) {
        cnt[itr -> second]++;
        ++sum;
    }
    cnt[0] = (W - 2) * (H - 2) - sum;
    rep(i, 10)
        cout << cnt[i] << endl;
}


Measured memory_bytes: 56448
// 2019/06/03 Tazoe

#include <iostream>
using namespace std;

// べき乗（整数版）
int powi(int a, int n)
{
	int b = 1;

	for(int i=0; i<n; i++){
		b *= a;
	}

	return b;
}


int main()
{
	int a, n, m;
	cin >> a >> n >> m;

	int cnt = 0;		// 個数

	for(int i=a+1; powi(i, n)<=m; i++){
		int x = powi(i, n);
		int y = i-a;

		int z = 0;			// 各桁をすべて足して得られる数
		while(x>0){
			z += (x%10);
			x /= 10;
		}

		if(y==z){
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#include <cmath>
using namespace std; 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define rep(i,a,b) for(int i=a;i<b;i++)
#define reprev(i,a,b) for(int i=b-1;i>=a;i--)
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mapp map<int,int>
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define tr(container, it) \
for(auto it = container.begin(); it != container.end(); it++)
 
bool comps(const pair<int,int> &a, const pair<int,int> &b) {return (a.second<b.second);} 
 
int power(int x, unsigned int y)
{ 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}
 
int binomialCoeff(int n, int k)
{  
    // Base Cases  
    if (k == 0 || k == n)  
        return 1;  
  
    // Recur  
    return binomialCoeff(n - 1, k - 1) +  
                binomialCoeff(n - 1, k);  
}
 
signed main(){
    
    IOS
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c;
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        long h = sc.NextLong();
        long w = sc.NextLong();
        long[] res = new long[] { Count(h, w), Count(w, h) };
        Console.WriteLine(res.Min());
    }

    static long Count(long h, long w)
    {
        long min = 1 << 50;
        for (int i = 1; i < h; i++)
        {
            long[] a = new long[3];
            long ww = w / 2;
            a[0] = w * i;
            a[1] = (h - i) * ww;
            a[2] = (h - i) * (w - ww);
            long res = a.Max() - a.Min();
            if (res < min) min = res;
            if (i == h - 1) continue;

            long hh = (h - i) / 2;
            a[1] = w * hh;
            a[2] = w * (h - i - hh);
            res = a.Max() - a.Min();
            if (res < min) min = res;
        }
        return min;
    }

    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


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

using namespace std;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define PB push_back
#define PF push_front

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const ll INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

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

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  
  cout<<max((ll)0,c-max((ll)0,a-b))<<endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;

#define LL long long
const int maxn = 100000 + 100;
const int maxm = 200000 + 100;
LL INF = 1LL << 60;
struct Node {
    int pos;
    int dis;
    Node() {}
    Node(int p, int d) {
        pos = p;
        dis = d;
    }
};
int n, m;
LL num[maxn];
vector<Node> G[maxn];
int l[maxm], r[maxm];
int d[maxm];
queue<int> que;
int fa[maxn];

void Init() {
    for(int i = 1; i <= n; ++i) {
        fa[i] = i;
        G[i].clear();
        num[i] = INF;
    }
}

int Find(int x) {
    return (x == fa[x]? x: fa[x] = Find(fa[x]));
}

void unit(int x, int y) {
    int xx = Find(x);
    int yy = Find(y);
    fa[xx] = yy;
}

void bfs() {
    for(int i = 1; i <= n; ++i) {
        num[Find(i)] = 0;
    }
    for(int i = 1; i <= n; ++i) {
        if(num[i] == 0) {
            que.push(i);
        }
    }
    while(!que.empty()) {
        int x = que.front();
        que.pop();
        int len = G[x].size();
        for(int i = 0; i < len; ++i) {
            int pos = G[x][i].pos;
            LL dis = G[x][i].dis;
            if(num[pos] == INF) {
                num[pos] = num[x] + dis;
                que.push(pos);
            }
        }
    }
}

int main() {
    #ifdef LOCAL
    freopen("test.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    #endif // LOCAL
    ios::sync_with_stdio(false);

    while(scanf("%d%d", &n, &m) != EOF) {
        Init();
        for(int i = 0; i < m; ++i) {
            scanf("%d%d%d", &l[i], &r[i], &d[i]);
            unit(l[i], r[i]);
            G[l[i]].push_back(Node(r[i], d[i]));
            G[r[i]].push_back(Node(l[i], -d[i]));
        }
        bfs();
        bool flag = true;
        for(int i = 0; i < m; ++i) {
            if(num[r[i]] - num[l[i]] != d[i]) {
                flag = false;
                break;
            }
        }
        if(flag) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }

    return 0;
}


Measured memory_bytes: 12544
X, Y = (int(i) for i in input().split())

if X % Y == 0 :
  print(-1)
else :
  i = 2
  while i < 1000000000000000000 :
    multiples = X * i
    if multiples % Y != 0 :
      print(multiples)
      break
    else :
      i += 1

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, x = 0, max = 0;
	string s;
	cin >> n;
	cin >> s;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'I') {
			x++;
			if(max < x) max = x;
		} else {
			x--;
		}
	}
	cout << max << endl;

	return 0;
}

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

int main() {
  ll l,r,ans=99999;
  cin>>l>>r;
  if(r-l>=2018){
    cout<<0<<endl;
    return 0;
  }
  for(ll i=l; i<r; i++){
    for(ll j=i+1; j<=r; j++){
      ll now_ans;
      ll tmp=i,tmp2=j;
      tmp%=2019;
      tmp2%=2019;
      now_ans=tmp*tmp2%2019;
      ans=min(now_ans,ans);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
  int D, N;
  cin >> D >> N;

  if(N != 100){
    cout << N * pow(100, D) << endl;
  }else{
    cout << int((N+1) * pow(100, D)) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f(x) (x)*(x)
using namespace std;
int n;
int a[1001];
int cnt;
int ans;
int ans2;
int ans3;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        cnt+=a[i];
    }
    int t=cnt/n;
    for(int i=1;i<=n;i++){
        ans+=f(a[i]-t);
        ans2+=f(a[i]-t-1);
        ans3+=f(a[i]-t+1);
    }
    int tt=ans<ans2?ans:ans2;
    tt=tt>ans3?ans3:tt;
    while(0){
    	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	}
    cout<<tt<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

#define N_MAX 100001
#define MOD 998244353

long long int intpow(int base, int p)
{
	if (0 == p){
		return 1;
	}
	if (1 == p){
		return base;
	}
	if (0 == p % 2){
		long long int val = intpow(base, p / 2);
		return (val*val) % MOD;
	}
	else{
		return (intpow(base, p - 1)*(long long int)base) % MOD;
	}
}

void func()
{
	int N; scanf("%d", &N);
	int D0; scanf("%d", &D0);
	if (0 != D0){
		printf("0");
		return;
	}

	int table[N_MAX];
	int maxdist = 0;
	fill(table, table + N, 0);
	table[0] = 1;
	for (int i = 1; i < N; i++){
		int d; scanf("%d", &d);
		table[d]++;
		maxdist = max(maxdist, d);
	}

	long long int ret = 1;
	if (1 != table[0]){
		printf("0");
		return;
	}
	for (int i = 1; i <= maxdist; i++){
		ret = (ret*intpow(table[i-1],table[i])) % MOD;
	}

	printf("%lld", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	func();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>

int students[100001];  // 登校した生徒の番号リスト

int main() {
  int N;
  std::cin >> N;

  // 登校の早い順に生徒番号を並べ替える
  for (int i = 1; i <= N; ++i) {
    int A;  // 到着時点で教室にいた人数＝到着した順位
    std::cin >> A;
    students[A] = i;
  }

  // 登校の早い順に生徒番号を表示する
  std::cout << students[1];
  for (int i = 2; i <= N; ++i) {
    std::cout << ' ' << students[i];
  }
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>

using namespace std;
int main(){
  int A,B,C;
  cin >> A >> B>> C;
  int a,b,c;
  a=A+B;
  b=A+C;
  c=B+C;
  if(A==c||B==b||C==a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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


int main(){
    int s,w;
    char token[1000];
    fgets(token, sizeof(token), stdin);
    s=atoi(strtok(token, " "));w=atoi(strtok(NULL, " "));
    if (s<=w) printf("unsafe");
    else printf("safe");
    return 0;
}


Measured memory_bytes: 1708
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

ll d[10][10];

void solve()
{
	int h, w;
	scanf("%d%d", &h, &w);

	int i, j;
	for (i = 0; i < 10; i++) {
		for (j = 0; j < 10; j++) {
			scanf("%d", &d[i][j]);
		}
	}
	for (int k = 0; k < 10; ++k)
		for (int i = 0; i < 10; ++i)
			for (int j = 0; j < 10; ++j) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

	ll ans = 0;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			int tmp;
			scanf("%d", &tmp);
			if (tmp >= 0) ans += d[tmp][1];
		}
	}
	printf("%lld\n", ans);

	return;
}


int main(int argc, char* argv[])
{
#if 1
	solve();
#else
	int T; scanf("%d", &T);
	while (T--) {
		solve();
	}
#endif
	return 0;
}


Measured memory_bytes: 128
def main():
    def is_kaibun(s):
        for i in range(len(s)//2):
            if s[i] != s[-i-1]:
                return False
        return True

    s = input()
    if(not is_kaibun(s[:len(s)//2])):
        print("No")
    elif (s[:len(s)//2] != s[len(s)//2 + 1:]):
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
//by Sshwy
//#define DEBUGGER
#include<algorithm>/*{{{*/
#include<cctype>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<vector>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)

#ifdef DEBUGGER

#define log_prefix() { fprintf(stderr, "\033[37mLine %-3d [%dms]:\033[0m  ", __LINE__,(int)clock()/1000);  }
#define ilog(...)    { fprintf(stderr, __VA_ARGS__); }
#define llog(...)    { log_prefix(); ilog(__VA_ARGS__); }
#define log(...)     { log_prefix(); ilog(__VA_ARGS__); fprintf(stderr,"\n");  }
#define red(...)     { log_prefix(); ilog("\033[31m"); ilog(__VA_ARGS__); ilog("\033[0m\n"); }
#define green(...)   { log_prefix(); ilog("\033[32m"); ilog(__VA_ARGS__); ilog("\033[0m\n"); }
#define blue(...)    { log_prefix(); ilog("\033[34m"); ilog(__VA_ARGS__); ilog("\033[0m\n"); }

#else

#define log_prefix() ;
#define ilog(...)    ;
#define llog(...)    ;
#define log(...)     ;
#define red(...)     ;
#define green(...)   ;
#define blue(...)    ;

#endif

namespace RA{
    int r(int p){return 1ll*rand()*rand()%p;}
    int r(int L,int R){return r(R-L+1)+L;}
}/*}}}*/
/******************heading******************/
const int N=3000;
int n,f[N],c[N],d[N];
char s[N];
vector<int> T[N];

void dfs(int u,int p){
    d[u]=0;
    c[u]=s[u]=='1';
    for(int v:T[u])if(v!=p)dfs(v,u);

    int s=0,mx=0,mxv=-1;

    for(int v:T[u])if(v!=p){
        c[u]+=c[v];
        d[u]+=d[v]+c[v];
        s+=d[v]+c[v];
        if(d[v]+c[v]>mx)mx=d[v]+c[v],mxv=v;
    }
    if(mx*2<=s){
        f[u]=s/2;
    }else {
        f[u]=s-mx;
        s-=(s-mx)*2;
        f[u]+=min(f[mxv],s/2);
    }
}
int calc(int root){
    dfs(root,0);
    if(f[root]*2==d[root])return f[root];
    else return 1e9;
}
int main(){
    scanf("%d",&n);
    scanf("%s",s+1);
    FOR(i,1,n-1){
        int a,b;
        scanf("%d%d",&a,&b);
        T[a].pb(b);
        T[b].pb(a);
    }
    int ans=1e9;
    FOR(i,1,n){
        ans=min(ans,calc(i));
    }
    printf("%d\n",ans==int(1e9)?-1:ans);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
int par[MAX_N],size[MAX_N],p[MAX_N];

void init()
{
	rep(i,MAX_N)
	{
		par[i] = i;
		size[i] = 1;
	}
	return;
}

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

void unite(int x, int y)
{
	if (par[x] == par[y]) return;
	x = find(x);
	y = find(y);
	if (size[x] > size[y]) swap(x,y);
	par[x] = y;
	if (size[x] == size[y]) size[y]++;
	return;
}

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

int main()
{
	init();
	int N,M;
	cin >> N >> M;
	rep(i,N)
	{
		cin >> p[i+1];
	}
	rep(i,M)
	{
		int x,y;
		cin >> x >> y;
		unite(x,y);
	}
	int ans = 0;
	rep(i,N)
	{
		if (same(p[i+1],i+1)) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int a,b,c, tmp; 
    cin >> a >> b >> c;
    if(a>b){
        tmp = b;
        b = a;
        a = tmp;
    }
    if(b>c){
        tmp = b;
        b = c;
        c = tmp;
    }
    if(a>b){
        tmp = b;
        b = a;
        a = tmp;
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3120