akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	int n, y;
	scanf("%d %d", &n, &y);
	for (ll i = 0; i <= n; i++) {
		for (ll j = 0; j <= n; j++) {
			ll k = (y - i * 10000 - j * 5000) / 1000;
			if (k + i + j == n && k >= 0) {
				return printf("%lld %lld %lld\n", i, j, k), 0;
			}
		}
	}
	printf("-1 -1 -1\n");
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5+10;
int num[maxn];
int vis[maxn];
int fa[maxn];
bool check(string a,string b)
{
    int len = a.size();
    for(int i = 0;i<len;++i)
    {
        if(a[i]!=b[i])
            return false;
    }
    return true;
}
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    string a,b;
    cin >> a >> b;
    if(check(a,b))
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long 
using namespace std;

vector<int> zyun;
void fn( int A, int B ){
  vector<int> sichi = { 7, 5, 3 };
  if( A == 0 ){
    zyun.push_back(B);
  }else{
    for( int i = 0; i < 3; i++ ){
      int nB = B*10 + sichi.at(i);
      zyun.push_back(nB);
      fn(A-1, nB);
    }
  }
  
}


signed main() {
  int N;
  cin >> N;
  fn(10, 0);
  sort( zyun.begin(), zyun.end() );
  zyun.erase(unique(zyun.begin(), zyun.end()), zyun.end());
  //for( int i = 0; i < zyun.size(); i++ ) cout << zyun.at(i) << " ";
  
  int ans = 0;
  for( int i = 0; i < zyun.size(); i++ ){
    bool san = 0;
    bool go = 0;
    bool nana = 0;
    if( zyun.at(i) <= N ){
      string K = to_string(zyun.at(i));
      for( int j = 0; j < K.size(); j++ ){
        if( K.at(j) == '3' ) san = 1;
        else if( K.at(j) == '5' ) go = 1;
        else nana = 1;
      }
    }
    if( san && go && nana ) ans++;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 2420
def partition(array, p, r)
  x = array[-1]
  i = p - 1
  p.upto(r - 2) do |index|
    if array[index] <= x
      i += 1
      array[i], array[index] = array[index], array[i]
    end
  end
  array[-1], array[i + 1] = array[i + 1], array[-1]
  [array, i + 1]
end

n = gets.to_i
input = gets.split(' ').map(&:to_i)
result = partition input, 0, n
result[0][result[1]] = "[#{result[0][result[1]]}]"
puts result[0].join ' '


Measured memory_bytes: 13944
//2006年アジアA How I Wonder What You Are!
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-9

typedef struct{
	double x,y,z;
}Position;

double dot(Position a,Position b){
	return a.x * b.x + a.y * b.y + a.z * b.z;
}

double dist(Position a){
	return sqrt(a.x*a.x + a.y*a.y + a.z*a.z);
}

double getTheta(Position a,Position b){
	return acos(dot(a,b) / (dist(a) * dist(b)));
}

int main(){
	int i,j;
	int n,m,ans;
	double phi[50];
	Position s[500],t[50];

	while(scanf("%d",&n) && n){
		for(i=0;i<n;i++) scanf("%lf %lf %lf",&s[i].x,&s[i].y,&s[i].z);
		scanf("%d",&m);
		for(i=0;i<m;i++) scanf("%lf %lf %lf %lf",&t[i].x,&t[i].y,&t[i].z,&phi[i]);

		ans = 0;
		for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        if(getTheta(s[i],t[j]) <= phi[j] + EPS){
  				ans++;
  				break;
  			}
      }
    }
		printf("%d\n",ans);
	}
	return 0;
}



Measured memory_bytes: 2136
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	vector<ll>abc(3);
	rep(i, 3)cin >> abc[i];
	sort(all(abc));
	ll ans = abc[0] * abc[1] * ((abc[2] + 1) / 2) - abc[0] * abc[1] * (abc[2] / 2);
	cout << ans << "\n";

	return 0;
}

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

using namespace std;
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;
typedef unsigned long long int ull;
typedef long long int ll;
#define rep(i,a,b) for (ll i=(a); i<(b); i++)
typedef pair<ll,ll> PLL;
// }}}

signed main() {
    ll n;
    cin>>n;
    vector<ll> a(n+2,0); // index -> value
    rep(i,1,n+1){
        cin>>a[i];
    }
    ll s = 0;
    for (ll i=0; i<=n; i++) {
        s+=abs(a[i+1]-a[i]);
    }
    for (ll i=1; i<=n; i++) {
        ll t = s - abs(a[i-1]-a[i]) - abs(a[i+1]-a[i]) + abs(a[i+1]-a[i-1]);
        cout<<t<<endl;
    }
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> d;
    //int d[N];
    int tmp;
    for(int i=0; i<N; i++){
        scanf(" %d", &tmp);
        d.push_back(tmp);
    }

    std::sort(d.begin(), d.end());
    //qsort(d, sizeof(int), )
    int n = N/2;
    std::cout << d[n] - d[n-1] << std::endl;
}

Measured memory_bytes: 892
x,y,a,b,c = map(int,input().split())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))

A = A[::-1][:x]
B = B[::-1][:y]
C = C[::-1]
D = A+B+C
D.sort(reverse = True)
print(sum(D[:x+y]))

Measured memory_bytes: 23200
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007
#define MEM_SIZE = 1e5+5;

// vector<int> DP[MEM_SIZE]


struct mint {
  int x; // typedef long long int;
  mint(int x=0):x((x%MOD+MOD)%MOD){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(int t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

void solve(void)
{
  int N;
  cin>>N;
  vector<int> C(N);
  for (int i = 0; i < N; i++)
  {
    cin>>C[i];
  }
  sort(C.begin(),C.end());
  vector<mint> two(N+1);
  two[0] = 1;
  for (int i = 0; i < N; i++)
  {
    two[i+1] = two[i]*2;
  }

  mint ANS;
  ANS.x = 0;

  for (int i = 0; i < N; i++)
  {
    int L = i;
    int R = N - 1 - i;
    mint now = two[R];
    if(R != 0) now += two[R-1]*R;
    now *= two[L];
    now *= C[i];
    ANS += now;
    }

    ANS *= two[N];
    cout<<ANS.x<<endl;
  

  
  
  

  
  return;
  
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;

int main(){
    int N,M;
    cin>>N>>M;
    dsu d(N+1);

    for(int i=0;i<M;i++){
        int l,r;
        cin>>l>>r;
        d.merge(l,r);
    }

    set<int> s;
    for(int i=1;i<=N;i++){
        s.insert(d.leader(i));
    }

    cout<<s.size()-1<<endl;
}


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

const int N = 12;

int n, m, cnt, x, ans, p[N];
vector<int> vec[N];

bool ok(int mask) {
	for (int i = 0; i < m; i++) {
		int cnt = 0;
		for (int num: vec[i])
			if(mask & (1 << num))
				cnt ^= 1;
		if(cnt != p[i])
			return false;
	}
	return true;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> cnt;
		while(cnt--) {
			cin >> x;
			vec[i].push_back(--x);
		}
	}
	for (int i = 0; i < m; i++)
		cin >> p[i];
	for (int mask = 0; mask < (1 << n); mask++)
		ans += ok(mask);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

type city struct {
	order int
	name string
	point int
}

type byPoint []city

func (a byPoint) Len() int           { return len(a) }
func (a byPoint) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a byPoint) Less(i, j int) bool { return a[i].point > a[j].point }

type byName []city

func (a byName) Len() int           { return len(a) }
func (a byName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a byName) Less(i, j int) bool { return a[i].name < a[j].name }

func main() {
	var n int
	fmt.Scan(&n)

	l := make([]city, n)
	var (
		s string
		p int
	)
	for i := 0; i < n; i++ {
		fmt.Scan(&s, &p)
		l[i] = city{i, s, p}
	}
	sort.Stable(byPoint(l))
	sort.Stable(byName(l))
	for _, c := range l {
		fmt.Println(c.order + 1)
	}
}

Measured memory_bytes: 512
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
Arr.forEach(function(v){
var arr=v.split(" ").map(Number);
var time=(arr[3]*3600+arr[4]*60+arr[5])-(arr[0]*3600+arr[1]*60+arr[2]);
var m=time%60;
var s=((time-m)%3600)/60;
var h=Math.floor(time/3600);
console.log(h+" "+s+" "+m);
});

Measured memory_bytes: 7640
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 1e9+7;

vi m;
vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	m = vi(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

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

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

void solve(){
	lli n,x,t;cin>>n>>x>>t;
	cout<<(n/x + bool(n%x))*t<<ENDL;
}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}


Measured memory_bytes: 3640
dic1 = {" ":"101", "'":"000000", ",":"000011", "-":"10010001", ".":"010001", "?":"000001",
        "A":"100101", "B":"10011010", "C":"0101", "D":"0001", "E":"110",
        "F":"01001", "G":"10011011", "H":"010000", "I":"0111", "J":"10011000",
        "K":"0110", "L":"00100", "M":"10011001", "N":"10011110", "O":"00101",
        "P":"111", "Q":"10011111", "R":"1000", "S":"00110", "T":"00111",
        "U":"10011100", "V":"10011101", "W":"000010", "X":"10010010", "Y":"10010011", "Z":"10010000"}

dic2 = {"00000":"A", "00001":"B", "00010":"C", "00011":"D", "00100":"E",
        "00101":"F", "00110":"G", "00111":"H", "01000":"I", "01001":"J",
        "01010":"K", "01011":"L", "01100":"M", "01101":"N", "01110":"O",
        "01111":"P", "10000":"Q", "10001":"R", "10010":"S", "10011":"T",
        "10100":"U", "10101":"V", "10110":"W", "10111":"X", "11000":"Y",
        "11001":"Z", "11010":" ", "11011":".", "11100":",", "11101":"-",
        "11110":"'", "11111":"?"}

def to_digit(ss):
  ret = ""
  for s in ss:
    ret += dic1[s]
  return ret

def to_alpha(digit):
  ret = ""
  ind = 0
  end = len(digit)

  while ind + 5 < end:
    ret += dic2[digit[ind:ind + 5]]
    ind += 5

  if digit[ind:]:
    ret += dic2[digit[ind:] + "0" * (5 - end + ind)]

  return ret

while True:
  try:
    print(to_alpha(to_digit(input())))
  except EOFError:
    break


Measured memory_bytes: 5696
#include <bits/stdc++.h>
template<typename T>
class fixed_point : T {
  public:
    explicit constexpr fixed_point (T&& t) noexcept
      : T(std::forward<T>(t)) {}
    template<typename... Args>
    constexpr decltype(auto) operator()(Args&&... args) const
      {return T::operator()(*this, std::forward<Args>(args)...);}
};
template<typename T>
static inline constexpr decltype(auto) fix (T&& t) noexcept {
  return fixed_point<T>{std::forward<T>(t)};
}
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  size_t n, m; std::cin >> n >> m;
  std::vector<std::vector<size_t>> graph(n);
  for (size_t _ = 0; _ < m; _++) {
    size_t a, b; std::cin >> a >> b;
    a--, b--;
    graph.at(a).push_back(b);
    graph.at(b).push_back(a);
  }
  auto yes = [&] {
    std::cout << "Yes" << std::endl;
    exit(0);
  };
  auto no = [&] {
    std::cout << "No" << std::endl;
    exit(0);
  };
  std::for_each(graph.begin(), graph.end(), [&](auto& v){
    if (v.size() % 2 != 0) no();
  });
  std::for_each(graph.begin(), graph.end(), [&](auto& v){
    if (v.size() >= 6) yes();
  });
  std::vector<size_t> fours;
  for (size_t i = 0; i < n; i++) {
    if (graph.at(i).size() == 4) fours.push_back(i);
  }
  if (fours.size() >= 3) yes();
  if (fours.size() <= 1) no();
  auto check = [&] (size_t x) {
    std::vector<int> ckd(n, false);
    ckd.at(x) = true;
    size_t root = (x == 0);
    fix ([&](auto dfs, int crr) -> void {
      ckd.at(crr) = true;
      for (auto const& nxt : graph.at(crr)) {
        if (ckd.at(nxt)) continue;
        dfs(nxt);
      }
    })(root);
    std::for_each(ckd.begin(), ckd.end(), [&](auto x){if (!x) yes();});
  };
  std::for_each(fours.begin(), fours.end(), check);
  std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 7296
#include <iostream>

using namespace std;

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

    int house[4][3][10];
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                house[i][j][k] = 0;
            }
        }
    }

    int b, f, r, v;
    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        house[b - 1][f - 1][r - 1] += v;
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                cout << ' ' << house[i][j][k];
            }
            cout << endl;
        }
        if (i < 3) cout << "####################" << endl;
    }
}


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

/*
 *
 * 問題を細分化する
 *
 * 目的を達成するには
 * ⓵延長または短縮
 * ⓶合成
 * の操作が必要
 *
 * 注意したいのは「⓵と⓶の操作はどっちを先にしても結果は変わらない（操作順序の違いによる結果は不変）」
 *
 * 合成の必要がないものは、正解の数値との差＝MPのカウント数と一括で計算できる。
 * →最も数値の近いものを１つ選べばよい
 * 合成の必要があるのは正解の数値との差を直接魔法で埋めるより効率がいいとき（最も正解の数値と近くなる）
 * →二つや三つ選ぶこともある　→　この判断を適切に行うのは難しい
 *
 * ここでNは8までしかない。→　全探索を考えるのが吉
 *
 * また、最も近くなるような棒（数値）を1つ以上選べばよい問題と定義しなおせる（あとは正解の差を計算するだけなので）
 *
 * 棒を L[N] L[N-1] ... L[2]　L[1] L[0] と並べてそれぞれをビットに対応させるとA,B,Cがそれぞれどれを取るかを探索できる
 *       1     1                    1   Aがとる棒(n桁のビット列)
 *       0     0         1     0    0   Bがとる棒
 *       0     0         0     1    0   Cがとる棒
 *
 * このようにA,B,Cに関してforの三重ループで全探索できる。
 * そうして、選んだ棒と正解の数値との差が最も小さいものを探せばよいことになる
 * 同じ棒を選ばないようにだけ注意は必要
 *
 *
bit 全探索による方法
まず A に採用する竹を選んで
残りの中から B に採用する竹を選んで
その残りの中から C に採用する竹を選んで...
とする
 * */

int N;
vector<int> L;
vector<int> A; // A, B, C

int main() {
    cin >> N;
    A.resize(3);
    for (int i = 0; i < 3; ++i) cin >> A[i];
    L.resize(N);
    for (int i = 0; i < N; ++i) cin >> L[i];

    int res = 1<<29;
    vector<int> bit(3);
    for (bit[0] = 1; bit[0] < (1<<N); ++bit[0]) { // 0 は含めない
        for (bit[1] = 1; bit[1] < (1<<N); ++bit[1]) { // 0 は含めない
            // 共通要素あったらダメ
            if (bit[1] & bit[0]) continue;
            for (bit[2] = 1; bit[2] < (1<<N); ++bit[2]) { // 0 は含めない
                // 共通要素があったらダメ
                if (bit[2] & bit[0]) continue;
                if (bit[2] & bit[1]) continue;

                // sums: A〜C に選んだ竹の長さの合計、nums: A〜C に選んだ竹の本数
                vector<int> sums(3, 0), nums(3, 0);
                for (int i = 0; i < N; ++i) {
                    for (int j = 0; j < 3; ++j) {
                        if (bit[j] & (1<<i)) {
                            sums[j] += L[i];
                            nums[j]++;
                        }
                    }
                }

                // score を求める
                int score = 0;
                for (int i = 0; i < 3; ++i) {
                    score += abs(sums[i] - A[i]); // +1, -1 のコスト
                    score += (nums[i] - 1) * 10; // 合体のコスト
                }
                res = min(res, score);
            }
        }
    }
    cout << res << endl;
}

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

using namespace std;

int main()
{
    int n, w;
    cin >> n >> w;
    int wt[n + 1];
    long long v[n + 1];
    for (int i = 1; i <= n; i++)
    {
        cin >> wt[i] >> v[i];
    }
    long long dp[101][w + 1];
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i <= w; i++)
    {
        dp[0][i] = 0;
    }
    for (int i = 0; i <= n; i++)
    {
        dp[i][0] = 0;
    }
    for (int i = 1; i <= n; i++)
    {
        for (int wi = 0; wi <= w; wi++)
        {
            if (dp[i - 1][wi] != -1)
            {
                dp[i][wi] = max(dp[i - 1][wi], dp[i][wi]);
                if (wi + wt[i] <= w)
                {
                    dp[i][wi + wt[i]] = max(dp[i][wi + wt[i]], dp[i - 1][wi] + v[i]);
                }
            }
        }
    }
    long long ans = 0;
    for (int i = 0; i <= w; i++)
    {
        ans = max(ans, dp[n][i]);
    }
    cout << ans << "\n";
    return 0;
}


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

int main() {
  string S;
  cin >> S;

  char s = S[0];
  for (int i = 1; i < S.length(); i++) {
    if (s == S[i]) {
      cout << "Bad" << endl;
      return 0;
    } else {
      s = S[i];
    }
  }

  cout << "Good" << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let (n, l, t): (usize, i64, i64) = (read(), read(), read());
    let xw: Vec<(i64, i64)> = (0..n).map(|_| (read::<i64>(), read::<i64>())).collect();
    let mut count: i64 = 0;
    let (x0, w0) = xw[0];
    for i in 1..n {
        let (x, w) = xw[i];
        if w0 != w {
            if w0 == 1 && 2 * t >= x - x0 {
                count += (2 * t - (x - x0)) / l + 1;
            } else if w0 == 2 && 2 * t >= l - (x - x0) {
                count += (2 * t - (l - (x - x0))) / l + 1;
            }
        }
    }

    let mut ans: Vec<i64> = vec![0; n];
    let mut cvalue: i64 = 0;
    for i in 0..n {
        let (x, w) = xw[i];
        ans[i] = (x + (t % l) * (if w == 1 { 1 } else { -1 }) + l) % l;
        if i == 0 {
            cvalue = ans[i];
        }
    }
    ans.sort();
    let mut start: usize = 0;
    for i in 0..n {
        if ans[i] == cvalue {
            if w0 == 1 {
                start = (i + n - count as usize % n) % n;
            } else {
                start = (i + count as usize % n) % n;
                break;
            }
        }
    }
    for i in 0..n {
        println!("{}", ans[(i + start) % n]);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 7292
#include <stdio.h>
#include <string.h>
int main(){
	char s[10000];
	while(~scanf("%s",s)){
		int length = strlen(s);
		int I,J;
		I=J=0;
		for(int i=0;i<length;i++){
			if(i+2>=length) break;
			if(s[i]=='J'){
				if(s[i+1]=='O'){
					if(s[i+2]=='I') J++;
				}
			}
			if(s[i]=='I'){
				if(s[i+1]=='O'){
					if(s[i+2]=='I') I++;
				}
			}
		}
		printf("%d\n%d\n",J,I);
	}
	return 0;
}

Measured memory_bytes: 980
#!/bin/sh
read
cnt=0
for i in `echo $REPLY | awk '{print $1"\n"$2"\n"$3}' | sort -n`
do
	cnt=$(( cnt + 1 ))
	eval n$cnt=$i
done
n=$(( n3 % 2 ))
if [ $n -eq 1 ]
then
	echo $(( n1 * n2 ))
else
	echo 0
fi


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

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

int main() {
  int d, w;
  while ( cin >> d >> w, d ) {
    int e[d][w];
    for ( int i = 0; i < d; i++ ) {
      for ( int j = 0; j < w; j++ ) {
	cin >> e[i][j];
      }
    }

    int ans = 0;    
    for ( int a = 1; a <= 9; a++ ) {
      for ( int i = 1; i < d-1; i++ ) {
	for ( int j = 1; j < w-1; j++ ) {
	  if ( e[i][j] >= a ) continue;
	  int y = i, x = j;
	  while ( y+1 < d-1 && e[y+1][j] < a ) y++;
	  while ( x+1 < w-1 && e[i][x+1] < a ) x++;
	  bool flag = true;
	  int sum = 0;
	  // if ( a == 2 ) cout << i << j << y << x << endl;
	  for ( int r = i; r <= y; r++ ) {
	    for ( int c = j; c <= x; c++ ) {
	      sum += a-e[r][c];	      
	      for ( int k = 0; k < 9; k++ ) {	      
		int ny = r+dy[k], nx = c+dx[k];
		if ( k == 0 && e[ny][nx] >= a ) {		  
		  flag = false;
		  r = y; c = x; break;		  
		}
		if ( (ny < i || y < ny || nx < j || x < nx) && e[ny][nx] < a ) {
		  flag = false;
		  r = y; c = x; break;		  
		}
	      }	      
	    }
	  }
	  if ( flag ) {
	    ans = max(ans, sum);
	    // if ( sum == 22 ) cout << i << " " << j << " " << a << endl;
	  }	  
	}
      }
    }

    cout << ans << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;

int a[110][110];

void solve(){
    int w, h, n;
    cin >> w >> h >> n;
    
    for(int i = 0; i < n; i++){
        int x, y, c;
        cin >> x >> y >> c;
        if(c == 1){
            for(int i = 0; i < x; i++){
                for(int j = 0; j < h; j++){
                    a[i][j] = 1;
                }
            }
        }
        if(c == 2){
            for(int i = x; i < w; i++){
                for(int j = 0; j < h; j++){
                    a[i][j] = 1;
                }
            }
        }
        if(c == 3){
            for(int i = 0; i < w; i++){
                for(int j = 0; j < y; j++){
                    a[i][j] = 1;
                }
            }
        }
        if(c == 4){
            for(int i = 0; i < w; i++){
                for(int j = y; j < h; j++){
                    a[i][j] = 1;
                }
            }
        }
    }
    int area = 0;
    for(int i = 0; i < w; i++){
        for(int j = 0; j < h; j++){
            area += (a[i][j] == 0);
        }
    }
    cout << area;
}


int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}
// vse dolzhny vyiti v internet po hhtp


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

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

using namespace std;

int p,q,r,now;
string s;

int formula(void){
	
	if(isdigit(s[now])){return s[now++]-'0';}
	if(s[now]=='P'){now++;return p;}
	if(s[now]=='Q'){now++;return q;}
	if(s[now]=='R'){now++;return r;}
	
	int res=0;
	if(s[now]=='-'){now++;return 2-formula();}
	if(s[now]=='('){
		now++;
		res=formula();
		if(s[now]=='*'){now++;res=min(res,formula());}
		else if(s[now]=='+'){now++;res=max(res,formula());}
		now++;
	}
	return res;
}

int main(void){
	
	while(cin >> s,s!="."){
		
		int cnt=0;
		rep(p,3)rep(q,3)rep(r,3){
			now=0;
			if(formula()==2)cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
 
#define sec second
#define fir first
#define mo 1000000007
#define inf 1e18
#define rep(i, s, n) for (ll i = s; i < n; i = i + 1)
#define rrep(i,s,n) for(ll i=s;i>=n;i--)


int main(){
	ll n;
	cin>>n;
	ll a[n];
	rep(i,0,n) cin>>a[i];
	sort(a,a+n);
	ll ans = a[n-1];
	
	if(n%2==0){
		rep(i,1,n/2){
			ans+=2*a[n-i-1];
		}
		cout<<ans;
	}
	else{
		rep(i,1,n/2){
			ans+=2*a[n-i-1];
		}
		ans += a[n - (n/2 + 1)];
		cout<<ans;
	}
}
		 

Measured memory_bytes: 5200
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;



int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    string a, b;
    cin >> n >> a >> b;
    for (int i = 0; i < n; i++) cout << a[i] << b[i];




}


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

int main(void)
{
 char T[101];
 char S[101];
 
 scanf("%s %s",T,S);
// printf("%s",strcat(S,T));
 printf("%s%s\n",S,T);
 return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int inf=0x4f4f4f4f;
int c[14],a[14][14],dp[14],ans=inf;
vector<int>v;
int n,m,x;
bool check(){
	for(int i=1;i<=m;i++){
		if(v[i]<x) return 0;
	}
	return true;
}
void pplus(int id){
	for(int i=1;i<=m;i++){
		v[i]+=a[id][i];
	}
}
void mins(int id){
	for(int i=1;i<=m;i++){
		v[i]-=a[id][i];
	}
}
void dfs(int u,int cost){
	if(check())ans=min(ans,cost);
	for(int i=u+1;i<=n;i++){
		pplus(i);
		dfs(i,cost+c[i]);
		mins(i);
	}
}
int main(){	
	scanf("%d%d%d",&n,&m,&x);
	v.insert(v.end(),m,0);
	for(int i=1;i<=n;i++){
		scanf("%d",&c[i]);
		for(int j=1;j<=m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	dfs(0,0);
	if(ans!=inf)printf("%d\n",ans);
	else printf("-1\n");
}

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

using namespace std;

int main() {
    int k,a,b;

    cin >> k >> a >> b;

    if ((a % k == 0) || (b % k == 0)) {
        cout << "OK" << endl;
    } else if (a / k - b / k != 0) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
}


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

const int N = 200005;
const int INF = 1e9;

int n, x[N], y[N];

int main() {
  cin >> n;
  rep(i, n) cin >> x[i] >> y[i];
  P p[4] = {MP(-INF, -INF), MP(INF, -INF), MP(INF, INF), MP(-INF, INF)};
  rep(i, n) {
    if (x[i] + y[i] > p[0].F + p[0].S) {
      p[0] = MP(x[i], y[i]);
    } 
    if (-x[i] + y[i] > -p[1].F + p[1].S) {
      p[1] = MP(x[i], y[i]);
    }
    if (-x[i] - y[i] > -p[2].F - p[2].S) {
      p[2] = MP(x[i], y[i]);
    }
    if (x[i] - y[i] > p[3].F - p[3].S) {
      p[3] = MP(x[i], y[i]);
    }
  }
  ll ans = 0;
  rep(i, 4) rep(j, 4) {
    ans = max(ans, abs(p[i].F - p[j].F) + abs(p[i].S - p[j].S));
  }
  cout << ans << endl;
  return 0;
}

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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

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

	int a[n],b[n],c[n-1];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	for(int i=0; i<n; i++){
		cin >> b[i];
	}
	for(int i=0; i<n-1; i++){
		cin >> c[i];
	}

	ans=b[a[0]-1];
	for(int i=1; i<n; i++){
		ans+=b[a[i]-1];
		if(a[i]-a[i-1]==1)	ans+=c[a[i-1]-1];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    W, H, N = map(int, input().split())
    xl, xr, yb, yt = 0, W, 0, H

    for tc in range(N):
        x, y, a = map(int, input().split())

        if a == 1:
            xl = max(xl, x)
            pass
        elif a == 2:
            xr = min(xr, x)
            pass
        elif a == 3:
            yb = max(yb, y)
            pass
        else:
            yt = min(yt, y)
            pass

    if xr > xl and yt > yb:
        ans = (xr - xl) * (yt - yb)
    else:
        ans = 0

    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
#include <cstdio>

#define N 10

int D, Ball[N];
int R, L;

bool solve(int i) {
	if(i == N) return true;
	if(R < Ball[i]) {
		R = Ball[i];
		if( solve(i+1) ) return true;
	}
	if(L < Ball[i]) {
		L = Ball[i];
		if( solve(i+1) ) return true;
	}
	return false;
}

int main() {
	scanf("%d", &D);
	for(int i = 0; i < D; i++) {
		R = L = 0;
		for(int j = 0; j < N; j++) scanf("%d", &Ball[j]);
		R = Ball[0];
		if( solve(1) )	printf("YES\n");
		else			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

#define MOD 1000000007LL

ll modncr(ll n, ll r){
  auto modbeki = [](ll x, ll nn){
    ll res = 1;
    while(nn > 0){
      if(nn & 1) res = res * x % MOD;
      x = x * x % MOD;
      nn >>= 1;
    }
    return res;
  };

  if(n < r) return 0;
  if(r == 0 || r == n) return 1;
  if(r > n-r) r = n-r;

  ll a = 1, b = 1;
  for(ll i = 0; i < r; i++){
    a *= (n - i);
    a %= MOD;
  }
  for(ll i = 0; i < r; i++){
    b *= (i + 1);
    b %= MOD;
  }
  ll c = modbeki(b, MOD-2);
  return a * c % MOD;
}

template <typename T>
T beki(T x, ll n){
  T res = 1;
  while(n > 0){
    if(n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

int main(){
  ll X, Y;
  cin >> X >> Y;
  if( ((X+Y)%3!=0) || (2*X-Y<0) || (2*Y-X<0)){
    cout << 0 << endl;
    return 0;
  }
  ll n = (2*Y-X)/3;
  ll m = (2*X-Y)/3;
  cout << modncr(n+m, n) << endl;
}

Measured memory_bytes: 256
import heapq


n, m, s = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]
change = [list(map(int, input().split())) for i in range(n)]
INF = 10 ** 18
MAX_ = 2600

graph = [[] for i in range(n)]
for u, v, cost, time in info:
    u -= 1
    v -= 1
    graph[u].append((v, cost, time))
    graph[v].append((u, cost, time))


dist = [INF] * ((MAX_ + 1) * n)
dist[min(s, MAX_)] = 0

q = [(0, min(s, MAX_), 0)] # q = [(時間, 銀貨, 現在地)]
while q:
    d, gin, v = heapq.heappop(q)

    if dist[v * (MAX_ + 1) + gin] < d:
        continue

    cc, dd = change[v]
    tmp = gin
    r = [gin]
    while True:
        if tmp + cc <= MAX_:
            if dist[v * (MAX_ + 1) + tmp + cc] > dist[v * (MAX_ + 1) + tmp] + dd:
                dist[v * (MAX_ + 1) + tmp + cc] = dist[v * (MAX_ + 1) + tmp] + dd
                r.append(tmp)
            else:
                break
            tmp += cc
        else:
            break

    for nxt_v, cost, time in graph[v]:
        for g in r:
            if g - cost < 0:
                continue
            if dist[v * (MAX_ + 1) + g] + time < dist[nxt_v * (MAX_ + 1) + g - cost]:
                dist[nxt_v * (MAX_ + 1) + g - cost] = dist[v * (MAX_ + 1) + g] + time
                heapq.heappush(q, (dist[nxt_v * (MAX_ + 1) + g - cost], g - cost, nxt_v))

for i in range(1, n):
     print(min(dist[i * (MAX_ + 1):(i + 1) * (MAX_ + 1)]))


Measured memory_bytes: 130980
#include<bits/stdc++.h>
#define int long long
const int MOD = 1e9 + 7;
using namespace std;
vector<vector<int>> adj;
vector<bool> vis;
int bfs(int s){
    vis[s]=true;
    queue<int> q;
    q.push(s);
    int cnt=1;
    while(!q.empty()) {
        int t = q.front();
        q.pop();
        for (auto i:adj[t]) {
            if (!vis[i]) {
                vis[i] = true;
                q.push(i);
                cnt++;
            }
        }
    }
    return cnt;
}
void solve() {
   int n,m;
   cin>>n>>m;
   adj.resize(n+1);
   vis.resize(n+1);
   int x,y;
   for(int i=0;i<m;++i){
       cin>>x>>y;
       adj[x].push_back(y);
       adj[y].push_back(x);
   }
   int cnt=0;
   for(int i=1;i<=n;++i){
       if(!vis[i]) {
           cnt=max(cnt,bfs(i));
       }
   }
   cout<<cnt;




}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 16912
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}


int main() {
  int N,M;
  cin>>N>>M;
  int p=pow(2,M);
  cout<<p*(1900*M+100*(N-M))<<endl;
  return 0;
}

Measured memory_bytes: 4072
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	string S;
	cin>>S;
	stack<char> sta;
	for(int i=0;i<S.size();i++){
		if(sta.size() && S[i]=='T' && sta.top()=='S')
			sta.pop();
		else
			sta.push(S[i]);
	}
	cout<<sta.size()<<endl;
	return 0;
}

Measured memory_bytes: 644
# Problem B - Ringo's Favorite Numbers

# input
D, N = map(int, input().split())

# initialization
ans = 0
tmp = 100**D

# count
i = 1
while i<=N:
    if i==100:
        ans = tmp * (i + 1)
        break
    ans = tmp * i
    i += 1

# output
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>

std::vector<int> tmp;

int merge_sort(std::vector<int> &S,int left,int right){
	if(left>=right) return 0;
	int cnt=0;
	int mid=(right+left)/2;
	cnt+=merge_sort(S,left,mid);
	cnt+=merge_sort(S,mid+1,right);
	for(int i=left;i<=mid;i++)
		tmp[i]=S[i];
	for(int i=mid+1;i<=right;i++)
		tmp[right+mid+1-i]=S[i];
	int i=left,j=right;
	for(int k=left;k<=right;k++){
		if(tmp[i]>tmp[j]){
			S[k]=tmp[j--];
		}else{
			S[k]=tmp[i++];
		}
		cnt++;
	}
	return cnt;
}

int main(void){
	int n;
	std::cin>>n;
	std::vector<int> S(n);
	tmp.resize(n);
	for(int i=0;i<n;i++)
		std::cin>>S[i];
	int cnt_cmp=merge_sort(S,0,S.size()-1);
	for(int i=0;i<S.size();i++)
		std::cout<<(i?" ":"")<<S[i];
	std::cout<<std::endl<<cnt_cmp<<std::endl;

	return 0;
}



Measured memory_bytes: 6684
#include <iostream>
#include <cmath>

using namespace std;

bool prime[1000000];

int main() {

  int n;

  int ans;


  prime[0]=prime[1]=false;

  for(int i=2;i<=1000000;i++) prime[i]=true;
  
  for(int i=2;i<=sqrt(1000000);i++) {

    if(prime[i]==true) {

      for(int j=2*i;j<=1000000;j+=i) {

	prime[j]=false;

      }

    }

  }
  
  while(1) {

    cin >> n;

    if(n==0) break;

    ans=0;

    for(int i=2;i<=n/2;i++) {

      if(prime[i]==true && prime[n-i]==true) ans++;

    }

    cout << ans << endl;

  }
  
  return 0;

}

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

int main() {
  int N, A;
  cin >> N >> A ;
  int number_of_500yencoin, amari;
  number_of_500yencoin = N / 500;
  amari = N - number_of_500yencoin * 500;
  if(amari <= A){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String str;
        Scanner sc = new Scanner(System.in);
        str = sc.nextLine();
        int N = str.length();
        String sub1 = str.substring(0,N/2);
        String sub2 = str.substring(((N+3)/2) -1  , N);
        System.out.println(sub1.equals(sub2)  ? "Yes" : "No");
    }
}


Measured memory_bytes: 35628
package main

import (
	"fmt"
)

func main() {
	var d, n int
	fmt.Scan(&d, &n)

	if n < 100 {
		fmt.Println(pow(100, d) * n)
	} else {
		fmt.Println(pow(100, d) * 101)
	}
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int A, B, C;    cin >> A >> B >> C;
            if(A >= B && B >= C){
                cout << A - C << endl;
            }else if(A >= C && C >= B){
                cout << A - B << endl;
            }else if(B >= A && A >= C){
                cout << B - C << endl;
            }else if(B >= C && C >= A){
                cout << B - A << endl;
            }else if(C >= A && A >= B){
                cout << C - B << endl;
            }else if(C >= B && B >= A){
                cout << C - A << endl;
            }else
    return 0;}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	static long tree[];
	static long arr[];

	public static void buildtree(int ss, int se, int idx) {
		// System.out.println(ss+" "+se+" "+idx);
		if (ss == se) {

			if (isPrime(arr[ss]) && isPrime((arr[ss]+1)/2))
				tree[idx] = 1;
			else
				tree[idx] = 0;
			return;
		}
		int mid = (ss + se) / 2;
		buildtree(ss, mid, idx * 2);
		buildtree(mid + 1, se, idx * 2 + 1);

		tree[idx] = tree[idx * 2] + tree[idx * 2 + 1];

	}

	public static void update(int ss, int se, int i, int inc, int idx) {
		if (ss > se || ss > i || se < i) {
			return;
		}
		if (ss == se) {

			tree[idx] = inc;
			return;
		}
		int mid = (ss + se) / 2;
		update(ss, mid, i, inc, idx * 2);
		update(mid + 1, se, i, inc, idx * 2 + 1);

		tree[idx] = tree[idx * 2] + tree[idx * 2 + 1];

	}

	static int max(int node, int start, int end, int l, int r) {

		if (r < start || end < l) {
			return 0;
		}
		if (l <= start && end <= r) {
			// range represented by a node is completely inside the given range
			return (int) tree[node];
		}
		// range represented by a node is partially inside and partially outside
		// the given range
		int mid = (start + end) / 2;
		int p1 = max(2 * node, start, mid, l, r);
		int p2 = max(2 * node + 1, mid + 1, end, l, r);
		return p1 + p2;

	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = 100008;
		arr = new long[n];
		tree = new long[n << 2];
		for (int i = 0; i < n; i++) {
			arr[i] = i;
		}
		buildtree(0, n - 1, 1);
		int q = sc.nextInt();
		while (q-- > 0) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			pr.println(max(1, 0, n - 1, l, r));
		}
		for(int i=1;i<n;i++)
		{
	//		System.out.println(i+" "+tree[i]);
		}
		pr.close();
		pr.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	static boolean isPrime(long arr2) {
		// Corner cases
		if (arr2 <= 1)
			return false;
		if (arr2 <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		if (arr2 % 2 == 0 || arr2 % 3 == 0)
			return false;

		for (int i = 5; i * i <= arr2; i = i + 6)
			if (arr2 % i == 0 || arr2 % (i + 2) == 0)
				return false;

		return true;
	}
}


Measured memory_bytes: 51528
#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)

     
     
int main(){

	int a , b;

	int max ;

	sd(a); sd(b); 

	max = a+b;

	if(max < a- b)max = a-b;

	if(max < a * b) max = max = a*b;

	pd(max);
           
     
     
        
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n,m[13],u=12;
    vector<int> v,w;
    cin>>n;
    for(int i=0;i<13;i++){
        m[i]=0;
    }
    m[0]=1;
    for(int i=0;i<n;i++){
        int d;
        cin>>d;
        m[d]++;
        if(m[d]>2||m[0]==2||m[12]==2){
            cout<<"0"<<endl;
            return 0;
        }else if(m[d]==2){
            for(int j=0;j<v.size();j++){
                u=min(u,abs(d-v[j]));
            }
            v.push_back(d);
            u=min(u,24-2*d);
        }
        u=min(u,d);
    }
    if(m[1]>=1){
        cout<<1<<endl;
        return 0;
    }
    if(m[12]==1){
        v.push_back(12);
        m[12]=2;
    }
    for(int i=1;i<=12;i++){
        if(m[i]==1){
            for(int j=0;j<v.size();j++){
                u=min(u,abs(i-v[j]));
            }
            w.push_back(i);
        }
    }
    int s=w.size(),t=0;
    for(int i=0;i<(1<<s);i++){
        vector<int> q;
        int p=u;
        for(int j=0;j<s;j++){
            if(((i>>j)&1)==1){
                q.push_back(w[j]);
            }else{
                q.push_back(-w[j]);
            }
        }
        for(int j=1;j<q.size();j++){
            for(int k=0;k<j;k++){
                p=min(p,min(abs(q[j]-q[k]), 24-abs(q[j]-q[k])));
            }
        }
        t=max(t,p);
        //cout<<i<<":"<<p<<endl;
    }
    //cout<<u<<","<<t<<endl;
    cout<<min(u,t)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(int argc, char *argv[]) {
    vector<int> arr = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << arr[K - 1] << endl;
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 1e9  //
#define INFLL 4e18  //
#define MOD (1e9)+7
#define MP make_pair
#define PB(a) push_back(a)
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

// a 0x61  z 0x7a  0 0x30

//------------------------------------------------------

int main() {
    char s[4];
    rep(i, 4) cin >> s[i];

    int a = (int) s[0] - (int) '0';
    int b = (int) s[1] - (int) '0';
    int c = (int) s[2] - (int) '0';
    int d = (int) s[3] - (int) '0';

    char op[3];
    if (a + b + c + d == 7) {
        op[0] = '+';
        op[1] = '+';
        op[2] = '+';
    } else if (a + b + c - d == 7) {
        op[0] = '+';
        op[1] = '+';
        op[2] = '-';
    } else if (a + b - c + d == 7) {
        op[0] = '+';
        op[1] = '-';
        op[2] = '+';
    } else if (a + b - c - d == 7) {
        op[0] = '+';
        op[1] = '-';
        op[2] = '-';
    } else if (a - b + c + d == 7) {
        op[0] = '-';
        op[1] = '+';
        op[2] = '+';
    } else if (a - b + c - d == 7) {
        op[0] = '-';
        op[1] = '+';
        op[2] = '-';
    } else if (a - b - c + d == 7) {
        op[0] = '-';
        op[1] = '-';
        op[2] = '+';
    } else if (a - b - c - d == 7) {
        op[0] = '-';
        op[1] = '-';
        op[2] = '-';
    }

    cout << a << op[0] << b << op[1] << c << op[2] << d << "=7" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 3003, mod = 998244353;

int n, m;
int a[N];
LL dp[N][N][3];

int main()
{
	//File("");
	n = gi(), m = gi();
	for (int i = 1; i <= n; i+=1) a[i] = gi();
	dp[1][0][0] = 1;
	for (int i = 1; i <= n; i+=1)
	    for (int j = 0; j <= m; j+=1)
	    {
	        dp[i + 1][j][0] = (dp[i + 1][j][0] + dp[i][j][0]) % mod;
	        dp[i + 1][j][1] = (dp[i + 1][j][1] + dp[i][j][0] + dp[i][j][1]) % mod;
	        dp[i + 1][j][2] = (dp[i + 1][j][2] + dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) % mod;
	        if (j + a[i] <= m)
	            (dp[i + 1][j + a[i]][1] += dp[i][j][0] + dp[i][j][1]) %= mod,
	            (dp[i + 1][j + a[i]][2] += dp[i][j][0] + dp[i][j][1]) %= mod;
	    }
	printf("%lld\n", dp[n + 1][m][2] % mod);
	return 0;
}


Measured memory_bytes: 211456