akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const bool debug = 0;

int main() {
	int h1, h2, k1, k2;
	int a, b, c, d;
	cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
	
	int s1 = h1 * a + h2 * b + (h1 / 10) * c + (h2 / 20) * d;
	int s2 = k1 * a + k2 * b + (k1 / 10) * c + (k2 / 20) * d;
	
	if (s1 == s2) puts("even");
	else if (s1 < s2) puts("kenjiro");
	else puts("hiroshi");
	
	return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  string a,b,c;
  ll x,y,z,q;
  cin >> a >> b >> c;
  x=0;
  y=0;
  z=0;
  q=0;
  while(1){
    if(q==0){
      q=a[x]-'a';
      x++;
      if(x==a.length()+1){
        printf("A");
        return 0;
      }
    }
    else if(q==1){
      q=b[y]-'a';
      y++;
      if(y==b.length()+1){
        printf("B");
        return 0;
      }
    }
    else if(q==2){
      q=c[z]-'a';
      z++;
      if(z==c.length()+1){
        printf("C");
        return 0;
      }
    }
  }
}

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

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 200000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on
int N;
int a[MAX_N + 1];

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  REP(i, N) cin >> a[i + 1];

  int ans = 0;
  int cnt = 1;
  for (int i = 1; i <= N; i++) {
    if (a[i] == cnt) {
      cnt++;
    } else {
      ans++;
    }
  }

  if (ans == N) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

int main()
{

    lint a, b, c;
    cin >> a >> b >> c;

    lint ans;
    ans =c- min(a-b, c);

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "sort"
)


func foo(h, k int, a []int) int {
  if k >= h {
    return 0
  }
  sort.Sort(sort.IntSlice(a))
  a = a[:len(a)-k]
  sum := 0
  for _, e := range a {
    sum += e
  }
  return sum
}

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
  var h int
  fmt.Scan(&h)
  
  sc.Split(bufio.ScanWords)
  k := nextInt()
  var a []int
  for i := 0; i < h; i++ {
    a = append(a, nextInt())
  }
  fmt.Println(foo(h, k, a))
}


Measured memory_bytes: 9216
#include <stdio.h>
#include <map>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>

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

using namespace std;

typedef pair<int,int> s;
typedef long long int ll;

int abs(int x){
  return x > 0 ? x : -x;
}

int length(char c[]){
  int cnt=0;
  for(cnt=0;c[cnt]!='\0';cnt++){
  }
  return cnt;
}

int n,m;
int l, r, d;
int p[100001];
ll x[100001];
typedef vector
 vec;
map<int,vec> mp;
int main(){
  scanf("%d %d",&n,&m);
  REP(i,n+1){
    p[i] = 0;
    x[i] = INF;
  }
  REP(i,m){
    scanf("%d %d %d",&l, &r, &d);
    p[l] = 1;
    p[r] = 1;
    if(mp.find(l) != mp.end()){
      mp[l].push_back(s(r,d));
    }else{
      vec v;
      v.push_back(s(r,d));
      mp[l] = v;
    }
    if(mp.find(r) != mp.end()){
      mp[r].push_back(s(l,-d));
    }else{
      vec v;
      v.push_back(s(l,-d));
      mp[r] = v;
    }
  }
  FOR(l,1,n){
    if(p[l] == 0) continue;
    x[l] = 0;
    queue<int> qu;
    qu.push(l);
    while(!qu.empty()){
      int l = qu.front();
      vec v = mp[l];
      qu.pop();
      if(p[l] == 0) continue;
      p[l] = 0;
      for(int i = 0;i<v.size();i++){
        int r = v[i].first;
        int d = v[i].second;
      //printf("%d %d %d %d\n",l,r,p[l],p[r]);
        if(p[r]==0) continue;
        if(x[r]==INF){
          x[r] = x[l] + d;
          //printf("l=%d r=%d x[l]=%d x[r]=%d d=%d\n",l,r,x[l],x[r],d);
        }else{
          if(x[r]!=x[l]+d){
            //printf("l=%d r=%d x[l]=%d x[r]=%d d=%d\n",l,r,x[l],x[r],d);
            printf("No\n");
            return 0;
          }
        }
          //printf("l=%d r=%d x[l]=%d x[r]=%d d=%d\n",l,r,x[l],x[r],d);
        //printf("l=%d r=%d x[l]=%d x[r]=%d\n",l,r,x[l],x[r]);
        qu.push(r);
      }
    }
  }
  printf("Yes\n");
}


Measured memory_bytes: 16500
use text_io::*;
use std::process::exit;
use std::collections::HashSet;

fn main() {
    let n: isize = read!();
    let mut a: usize = 0;
    let mut b: usize = 0;
    let mut c: usize = 0;
    let mut d: usize = 0;
    for i in 0..n {
        let ai: String = read!();
        if ai == "AC" {
            a = a + 1;
        } else if ai == "WA" {
            b = b + 1;
        } else if ai == "TLE" {
            c = c + 1;
        } else if ai == "RE" {
            d = d + 1;
        }
    }
    println!("AC x {}
WA x {}
TLE x {}
RE x {}
",a,b,c,d);
}

Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define rep1(i, n) for (int i = 1; i < int(n); ++i)
#define repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    int ans_a = 0, ans_z = 0;
    rep(i, s.size())
    {
        if (s[i] == 'A')
        {
            ans_a = i;
            break;
        }
    }
    for (int i = s.size() - 1; i >= 0; --i)
    {
        if (s[i] == 'Z')
        {
            ans_z = i;
            break;
        }
    }
    cout << ans_z - ans_a + 1 << endl;
    return 0;
}


Measured memory_bytes: 640
n = int(input())
s = list(input())
    
ans = 0
before_c = None
    
for c in s:
    if before_c is None:
        before_c = c
    elif c == before_c:
        continue
    else:
        before_c = c
        ans += 1
            
if c == before_c:
    ans += 1
    
print(ans)

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

void solve(){

}
int main(){
  vector<int > v;
  for(int i = 0 ; i < 5; i++){
    int d;
    cin >> d;
    v.push_back(d);
  }
  sort(v.begin(), v.end(), greater<int>());
  for(int i = 0; i < (int)v.size(); i++){
    if(i)cout << " ";
    cout << v[i];
  }
  cout << endl;
  return 0;
}

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

using namespace std;

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  COMinit();
  long N;
  cin>>N;
  long ans=modpow(10,N,MOD)-modpow(9,N,MOD);
  ans=mod(ans,MOD);
  ans-=modpow(9,N,MOD);
  ans=mod(ans,MOD);
  ans+=modpow(8,N,MOD);
  ans=mod(ans,MOD);
  cout<<ans<<endl;
}


Measured memory_bytes: 15584
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int>m(N);
  for(int i = 0;i < N;i++){
    cin >> m.at(i);
  }
  int cou = 1;
  int x = m.at(0);
  for(int i = 1;i < N;i++){
    if(m.at(i) >= x){
    cou++;
    x = m.at(i);
  }
}
cout << cou <<endl;    
    
  }
    

Measured memory_bytes: 256
sd = input()
t = input()
sl = len(sd)
tl = len(t)
pos = []
for i in range(sl-tl+1):
    tmp = sd[i:i+tl]
    n = 0
    for j, k in zip(tmp, t):
        if j == '?':
            n += 1
        elif j == k:
            n += 1
        else:
            break
    if n == tl:
        ans = sd[:i] + t + sd[i+tl:]
        ans = ans.replace('?', 'a')
        pos.append(ans)
pos.sort()
if len(pos) == 0:
    print('UNRESTORABLE')
else:
    print(pos[0])

Measured memory_bytes: 3064
N,W = map(int, input().split())

wv = [tuple(map(int, input().split())) for _ in range(N)]

dp = [[0 for _ in range(W+1)] for _ in range(N)]
#dp[i][j]：i番目の品物まで選べる時、重さjまで運べる時の最大価値

for i in range(N):
    for j in range(W+1):
        if j >= wv[i][0]:
            # 前者はi番目の品を選ばないとき、後者は選ぶとき
            dp[i][j] = max(dp[i-1][j], dp[i-1][j - wv[i][0]] + wv[i][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[-1][-1])

Measured memory_bytes: 171656
#include <iostream>

int main()
{
    int a[3][3];
    for (int i = 0; i < 3; i++) {
       std::cin >> a[i][0] >> a[i][1] >> a[i][2];
    }  

    int n = 0;
    std::cin >> n;
    
    int b[n];
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (b[i] == a[j][k]) {
                    a[j][k] = 0;
                }
            }
        }
    }
    for (int i = 0; i < 3; i++) {
        if (a[i][0] + a[i][1] + a[i][2] == 0) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    for (int i = 0; i < 3; i++) {
        if (a[0][i] + a[1][i] + a[2][i] == 0) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    if (a[0][0] + a[1][1] + a[2][2] == 0) {
        std::cout << "Yes" << std::endl;
        return 0;
    }

    if (a[0][2] + a[1][1] + a[2][0] == 0) {
        std::cout << "Yes" << std::endl;
        return 0;
    }

    std::cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    vector <int> h(n + 1);
    forn (i, 1, n + 1)
        cin >> h[i];
    h[0] = -1e9;
    vector <int> dp(n + 1);
    dp[1] = 0;
    forn (i, 2, n + 1) {
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)

func main() {
	list := getStdinIntArr()
	N := list[0]
	K := list[1]
	S := getStdin()

	rtn := ""
	for i := 0; i < N; i++ {
		if i != K-1 {
			rtn += S[i : i+1]
		} else {
			switch {
			case S[i] == 'A':
				rtn += "a"
			case S[i] == 'B':
				rtn += "b"
			case S[i] == 'C':
				rtn += "c"
			case S[i] == 'a':
				rtn += "A"
			case S[i] == 'b':
				rtn += "B"
			case S[i] == 'c':
				rtn += "C"
			}
		}
	}

	fmt.Printf("%s\n", rtn)
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 1024*1024*10)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 3328
#include <stdio.h>
int main(void){
    int n,i;
  	int a[1000000];
  	double sum=0;
  	scanf("%d",&n);
  	for(i=0;i<n;i++){
      scanf("%d",&a[i]);
      sum+=1.0/a[i];
    }
  	printf("%.5f\n",1/sum);
    return 0;
}

Measured memory_bytes: 128
n=gets.to_i
a=Array.new(n,0)
n.times do |i|
    a[i]=gets.to_i
end

a_max=a.max
a_second=a.max(2)[1]
n.times do |i|
    if a[i]==a_max
        puts a_second
    else
        puts a_max
    end
end


Measured memory_bytes: 15860
count = 0
data = []
while True:
  count += 1
  h, x = map(int,(input().split()))
  data.append([h, x])
  if x == 0 and h == 0:
    break
for i in range(count-1):
  h, x = data[i]
  for j in range(h):
    print("#" * x)
  print("")


Measured memory_bytes: 5624
#include <iostream>
#include <iomanip>

using namespace std;

int main(){
    int N;
    cin >> N;
    cout << fixed << setprecision(15);
    double a, b;
    a = N / 3;
    b = N % 3;
    double ans = 1;
    for (int i = 0; i < 3;i++){
        ans *= (a + b / 3);
    }
        cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
const int MAXN = 100010;
int n, a[MAXN];
bool isLucky() {
	int num1 = 0, num4 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] % 4 == 0) {
			num4++;
		}
		if (a[i] % 2 != 0) {
			num1++;
		}
	}
	if (num4 >= n / 2) {
		return true;
	} 
	if (num4 == num1) {
		return true;
	}
	return false;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	if (isLucky()) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=1e5+5;
const int M=1e9+7;
void solve()
{
	
	int n,m;
	cin>>n>>m;
	int a[n+1];
	f(i,1,n) cin>>a[i];
	sort(a+1,a+n+1);
	vector<pair<int,int>> v;
	while(m--)
	{
		int b,c;
		cin>>b>>c;
		v.pb(mp(c,b));
	}
	sort(all(v));
	reverse(all(v));
	int j=1;
	for(int i=0;i<v.size();){
		if(j==n+1)
		{
			break;
		}
		if(v[i].ff>a[j])
		{
			a[j]=v[i].ff;
			v[i].ss--;
			j++;
		}
		else
		{
			break;
		}
		if(v[i].ss==0)
		i++;
	}
	int sum=0;
	f(i,1,n) sum+=a[i];
	cout<<sum;
}

signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}




Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    ll sum = 1000;
    ll stock = 0;
    vector<int> a(n+2);
    a[0] = 1000;
    a[n+1] = -1;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    for(int i=1; i<=n; i++){
        if(a[i-1] > a[i] && a[i] <= a[i+1]){
            stock = sum / a[i];
            sum -= stock * a[i];
        }
        else if(a[i-1] <= a[i] && a[i] > a[i+1]){
            sum += stock * a[i];
            stock = 0;
        }
    }
    cout << sum;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N =1000;

int lcs(string X,string Y){
  int c[N+1][N+1];
  int m=X.size();
  int n=Y.size();
  int maxl=0;
  X=' '+X;
  Y=' '+Y;
  for(int i=0;i<=m;i++)c[i][0]=0;
  for(int j=1;j<=n;j++)c[0][j]=0;

  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      if(X[i]==Y[j]){
        c[i][j]=c[i-1][j-1]+1;
      }else{
        c[i][j]=max(c[i-1][j],c[i][j-1]);
      }
maxl=max(maxl,c[i][j]);
    }
  }
return maxl;
}

int main(){
  string s1,s2;
  int n;cin>>n;
  for(int i=0;i<n;i++){
    cin>>s1>>s2;
    cout<<lcs(s1,s2)<<endl;
  }
return 0;
}



Measured memory_bytes: 7076
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vecll>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}


    
void go();

main(){
    ios
    int tc=1;
    // tc=in();
    while(tc--){
        go();
    }
    return 0;
}


void go(){
    int x=in();
    int s=0;
    rep2(i,1,1000000){
        s+=i;
        if(s>=x){
            cout<<i<<endl;
            return;
        }
    }
        
}





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

using namespace std;
typedef long long ll;
int main(void) {
  ll a, b, c, d, ans;
  cin >> a >> b >> c >> d;
  ans = a * c;
  ans = max(ans, b * c);
  ans = max(ans, a * d);
  ans = max(ans, b * d);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main() {
	int n, a[3], i;
	scanf("%d", &n);
	a[0] = n / 100;
	a[1] = (n %100)/10;
	a[2] = n % 10;
		for (i = 0; i < 3; i++) {
			if (a[i] == 9)
				a[i] = 1;
			else if (a[i] == 1)
				a[i] = 9;
		}
	printf("%d%d%d\n", a[0], a[1], a[2]);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 100005
#define X first
#define Y second
#define MOD 1000000007
#define inf 1e18
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
ll n,i,j,t;

int main()
{
    fastio;
    cin>>n;
    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            if(i*j==n){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
// Gear4        
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define SZ(a) ((int)((a).size()))
#define printCase() "Case #" << caseNum << ": "
#define pb push_back
#define mp make_pair
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
#define ff first
#define ss second
template<typename T> using V = vector<T>;
template<typename T, typename U> using P = pair<T,U>;
using ld = long double;
using ll = long long;
#define endl '\n'
const int inf = 1e9, mod = 1e9 + 7;
const ll INF = 9e18;
const ld EPS = 1e-9, PI = acosl(-1.0);
const int N = 1e5 + 5;
int n, m, p[N], x, y;
V<V<int>> g(N);
int par[N];
int findPar(int u) {
    return u == par[u] ? u : (par[u] = findPar(par[u]));
}
int sameSet(int u, int v) {
    return findPar(u) == findPar(v);
}
void unite(int u, int v) {
    u = findPar(u), v = findPar(v);
    par[u] = v;
}
int main() {
    SYNC
    map<int, int> loc;
    cin >> n >> m;
    FOR(i, 1, n + 1) par[i] = i;
    FOR(i, 1, n+1) {
        cin >> p[i];
        loc[p[i]] = i;
    }
    FOR0(i, m) {
        cin >> x >> y;
        unite(x, y);
    }
    int ans = 0;
    FOR(i, 1, n + 1) {
        ans += sameSet(i, loc[i]);
    }
    cout << ans;
}

Measured memory_bytes: 8064
import java.util.HashMap;
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		HashMap<String,String> map = new HashMap<String,String>();

		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		int n = Integer.parseInt(str);

		str = scan.nextLine();
		String[] substr = str.split(" ", 0);
		String ans = "YES";
		for (int i=0; i<n; i++) {
			if (map.containsKey(substr[i])) {
				ans = "NO";
				break;
			}  else {
				map.put(substr[i], "1");
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 68168
#include <cstdio>
#include <cmath>
 
using namespace std;
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        if(i % 3 == 0){
            printf(" %d", i);
            continue;
        }
        for(int j = 0; i / (int)pow(10, j) > 0; j++){
            if(i / (int)pow(10, j) % 10 == 3){
                printf(" %d", i);
                break;
            }
        }
    }
    printf("\n");
    return 0;
}

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

int main(void) {
  int N;
  vector<int> A;
  int tmp;
  
  cin >> N;
  for (int i = 0; i < N; i++) {
	cin >> tmp;
    A.push_back(tmp);
  }
  sort(A.begin(), A.end());
  int diff = A[N-1] - A[0];
  cout << diff << endl;
  
  return 0;
}

Measured memory_bytes: 256
t = [int(input()) for i in range(5)]
r = [0] * 5
q = 0

for i in range(5):
    tr = t[i] % 10
    tq = t[i] // 10
    if tr == 0:
        r[i] = 10
        q += tq
    else:
        r[i] = tr
        q += tq + 1

if min(r) != 10:
    q -= 1
else:
    r = [0] * 5

print(q * 10 + min(r))

Measured memory_bytes: 3064
#include<iostream>
#include<queue>
#include<vector>
using namespace std;

const int INF = 1<<30;

bool adj[5001][5001];

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

    int c[n], r[n];
    for(int i = 0; i < n; i++)  cin >> c[i] >> r[i];

    vector<int> path[n];
    int a, b;

    for(int i = 0; i < k; i++){
        cin >> a >> b;
        a--, b--;
        path[a].push_back(b);
        path[b].push_back(a);
    }

    // make adjacency list O(n^2)
    for(int i = 0; i < n; i++){
        queue<pair<int,int>> q;
        q.push({i, r[i]});
        while(!q.empty()){
            pair<int,int> p = q.front();    q.pop();
            if(adj[i][p.first]) continue;
            adj[i][p.first] = true;
            if(p.second == 0)   continue;
            for(int next : path[p.first]){
                if(!adj[i][next])   q.push({next, p.second-1});
            }
        }
    }

    int d[n];
    for(int i = 0; i < n; i++)  d[i] = INF;

    // cost, pos
    priority_queue<pair<int,int>> pq;
    pq.push({0, 0});

    // worst O(n^2)
    while(!pq.empty()){
        pair<int,int> p = pq.top(); pq.pop();
        int cost = -p.first;
        
        if(cost >= d[p.second])  continue;
        
        d[p.second] = cost;
        
        if(p.second == n-1){
            cout << cost << endl;
            return 0;
        }

        for(int next = 0; next < n; next++){
            if(!adj[p.second][next])    continue;
            if(d[next] > cost+c[p.second])  pq.push({-(cost+c[p.second]), next});
        }

    }

}


Measured memory_bytes: 28584
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <algorithm>

struct Section {
	long long x;
	long long l;
	bool operator<(const Section& sec) const {
		return x + l < sec.x + sec.l;
	}
};

int main() {
	long long N;
	std::cin >> N;
	std::vector<Section> XL(N);
	for (int i = 0; i < N; i++) {
		long long x, l;
		std::cin >> x >> l;
		XL[i] = {x, l};
	}
	std::sort(XL.begin(), XL.end());
	long long sum = 0;
	long long last = -2e9 - 1;
	for (int i = 0; i < N; i++) {
		auto left = XL[i].x - XL[i].l;
		if (left >= last) {
			sum++;
			last = XL[i].x + XL[i].l;
		}
	}
	std::cout << sum << std::endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int gcd(int a, int b)
{
	if (b) {
		if (a >= b)
			return gcd(b, a%b);
		else
			return gcd(b, a);
	} else {
		return a;
	}
}
int main()
{
	int a, b, g, l;
	while (scanf("%d%d", &a, &b)>0) {
		g = gcd(a, b);
		l = a / g * b;
		printf ("%d %d\n", g, l);
	}
	return 0;
}

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

const int maxn=1e5+10;
int n,m,k;
int A[maxn],B[maxn],C[maxn],D[maxn];
int id[maxn],ret[maxn];
int root(int u){
    return id[u]<0?u:id[u]=root(id[u]);
}
void join(int u,int v){
    if((u=root(u))==(v=root(v))) return;
    if(id[u]<id[v]) swap(u,v);
    id[u]+=id[v];
    id[v]=u;
    return;
}

main()
{
    memset(id,-1,sizeof id);
    cin>>n>>m>>k;
    forinc(i,1,m)
    {
        cin>>A[i]>>B[i];
        ret[A[i]]--,ret[B[i]]--;
        join(A[i],B[i]);
    }
    forinc(i,1,k) cin>>C[i]>>D[i];
    forinc(i,1,n) ret[i]+=abs(id[root(i)])-1;
    forinc(i,1,k) if(root(C[i])==root(D[i])) ret[C[i]]--,ret[D[i]]--;
    forinc(i,1,n) cout<<ret[i]<<" ";
}


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

using namespace std;

#define MAX 21
typedef vector<int> Vec;
typedef vector<Vec> Mat;

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

int memo[MAX][MAX][MAX][MAX];

int grundy(int x1, int y1, int x2, int y2, Mat &f)
{
    if (x1 > x2 || y1 > y2) {
        return 0;
    }

    if (memo[y1][x1][y2][x2] != -1) {
        return memo[y1][x1][y2][x2];
    }
        
    unordered_set<int> st;
    for (int i = y1; i <= y2; i++) {
        for (int j = x1; j <= x2; j++) {
            if (f[i][j] == 0) {
                st.insert(grundy(x1, y1, j-1, i-1, f) ^
                          grundy(j+1, y1, x2, i-1, f) ^
                          grundy(x1, i+1, j-1, y2, f) ^
                          grundy(j+1, i+1, x2, y2, f));
            }
        }
    }   
    
    int res = 0;
    while (st.count(res)) res++;
    return (memo[y1][x1][y2][x2] = res);
}

int main()
{    
    cin >> H >> W;
    Mat f(H);
    for (int i = 0; i < H; i++) {
        f[i].resize(W);
        for (int j = 0; j < W; j++) {
            char ch;
            cin >> ch;
            f[i][j] = (ch == 'X');
        }
    }
    memset(memo, -1, sizeof(memo));
    cout << (grundy(0, 0, W-1, H-1, f) != 0 ? "First" : "Second") << endl;
    return 0;
}

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

#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 550;
const long long Q = 10100;
const long long mod = 998244353;
const long long MAGIC = 30;

using namespace std;

string s;

void solve()
{
        cin >> s;
        int cnt = 0, dif = 0;
        for(int i = 0; i < s.size(); i++){
                if(s[i] == 'g'){
                        if(cnt > 0){
                                cnt--;
                                dif++;
                        }
                        else{
                                cnt++;
                        }
                }
                else{
                        if(cnt > 0){
                                cnt--;
                        }
                        else{
                                cnt++;
                                dif--;
                        }
                }
        }
        cout << dif << "\n";
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("island.in");
        //fout("island.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





int main() {
	int in;
	while (cin >> in) {
		bitset<10> b(in);
		int hit = 0;
		for_(i, 0, 10) {
			if (b[i]) {
				if (hit>0) cout << " ";
				cout << pow(2, i);
				hit++;
			}
		}
		cout << endl;
	}
	
	return 0;
}

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

int main() {
  ll k;
  cin >> k;
  ll count=2;
  
  if(k==2){
    cout << 1 << endl;
    return 0;
  }
  
  for(int i=2; i<=pow(k,0.5); i++){
    ll K=k;
    if(K%i==0){
      while(K%i==0){
        K/=i;
      }
      if(K==1) count++;
      else if(K%i!=0 && (K-1)%i==0) count++;
    }
    
    else if(K%i!=0 && (K-1)%i==0){
      if((K-1)/i==i)count++;
      else count+=2;
    }
  }
  
  cout << count << endl;
  
}


Measured memory_bytes: 256
#abc 057 c
import math
n=int(input())

def keta(x):
    cnt=0
    while int(x)>0:
        x/=10
        cnt+=1
    return cnt
limit_a=int(math.sqrt(n))
ans=n
for a in range(1,limit_a+1):
    if n%a==0:
        b=int(n/a)
        f=max(keta(a),keta(b))
    if ans>f:
        ans=f
print(ans)


Measured memory_bytes: 3060
def main(piece, c):
    for h in range(n-m+1):
        for w in range(n-m+1):
            if f(piece, h, w):
                break
    if c != 4:
        move(piece, c)
    else:
        if ans:
            print ans[0], ans[1]
        else:
            print 'NA'

def f(piece, h, w):
    global ans
    coordinate = None
    for _h in range(m):
        for _w in range(m):
            if piece[_h][_w] != '-1':
                if piece[_h][_w] == picture[h+_h][w+_w]:
                    if coordinate is None:
                        coordinate = (int(w+_w+1), int(h+_h+1))
                else:
                    return
    else:
        if ans is None:
            ans = coordinate
        elif coordinate[1] < ans[1]:
            ans = coordinate
        elif coordinate[1] == ans[1]:
            if coordinate[0] < ans[0]:
                ans = coordinate
        return True
    
def move(piece, c):
    _piece = []
    for w in range(m):
        lis = []
        for h in range(m):
            lis.append(piece[h][w])
        else:
            lis.reverse()
            _piece.append(lis)
    else:
        main(_piece, c+1)

while True:
    n, m = map(int, raw_input().split())
    if n == m == 0: break
    picture = [raw_input().split() for i in range(n)]
    piece = [raw_input().split() for i in range(m)]
    ans = None
    main(piece, 1)

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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_debug(...) do { printf("DEBUG: line %d: %s: ", __LINE__, __PRETTY_FUNCTION__); printf(__VA_ARGS__); } while(0)
  #define pr_vars(...) do { pr_debug(" "); pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_debug(...) do { } while(0)
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;
#define X first
#define Y second
#define pb push_back

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fout << vec[i] << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cout << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cout << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr double INF = 2e18;
constexpr ll MOD = 1e9 + 7;

using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

constexpr ll MAX = 1e5 + 5;

int main()
{
    vector<string> v(3); cin >> v;
    cout << v[0][0] << v[1][1] << v[2][2] << endl;
    return 0;
}


Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int D,N;
    R(D,N);
    LL an=1;
    REP(i,D)an*=100;
    if(N<100)W(an*N);
    else W(an*101);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cstdio>

using namespace std;
int main()
{
	int ret = 0;;
	string s;
	cin >> s;

	
	if (s[0] != s[1] && s[1] != s[2] && s[2] != s[0])
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
		
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, M, X, Y;
		N = sc.nextInt();
		M = sc.nextInt();
		X = sc.nextInt();
		Y = sc.nextInt();
		int x[] = new int[N];
		int y[] = new int[M];
		int max = X;
		int min = Y;
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
			if (max < x[i]) {
				max = x[i];
			}
		}
		for (int i = 0; i < M; i++) {
			y[i] = sc.nextInt();
			if (min > y[i]) {
				min = y[i];
			}
		}
		sc.close();
		int a = max + 1;
		if (min - max > 0) {
			System.out.println("No War");
		} else {
			System.out.println("War");
		}
	}
}


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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N; cin >> N;
    int b[N-1];
    for(int i=0;i<N-1;i++){
        cin >> b[i];
    }
    int a[N];
    a[0]=b[0];
    for(int i=1;i<N-1;i++){
        a[i]=min(b[i-1],b[i]);
    }
    a[N-1]=b[N-2];
    int ans=0;
    for(int i=0;i<N;i++){
        ans+=a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int m=s.nextInt();
		int k[]=new int[n];
		int a[]=new int[m];
		
		for(int i=0;i<m;i++) {
			a[i]=0;
		}
		
		for(int i=0;i<n;i++) {
			k[i]=s.nextInt();
			for(int ii=0;ii<k[i];ii++) {
				a[s.nextInt()-1]++;
			}
			
		}
		
		int count =0;
		for(int i=0;i<m;i++) {
			if(a[i]==n){
				count++;
				}
			}
		
		
		System.out.println(count);
		s.close();
	}

}


Measured memory_bytes: 24276
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/range/numeric.hpp>

#ifdef _MSC_FULL_VER
#include"randomizer.hpp"
#include"debug_print.hpp"
#endif

#include<cstdlib>
#include<ctime>

namespace lib
{
	template<class T>using pair = std::pair<T, T>;
	template<class T>constexpr T pow(T base, std::size_t p)
	{
		if (p <= 2)
		{
			return
				p == 0 ? T(1) :
				p == 1 ? base : base * base;
		}
		auto r = pow(pow(base, p / 2), 2);
		if (p % 2 != 0)
		{
			r *= base;
		}
		return r;
	}
	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

	struct union_find
	{
		std::vector<int> upper;
		union_find(std::size_t size):upper(size, -1) {}

		int group(int index)
		{
			if (upper[index] == -1)
			{
				return index;
			}
			else
			{
				return upper[index] = group(upper[index]);
			}
		}

		bool merge(int x, int y)
		{
			auto gx = group(x);
			auto gy = group(y);
			if (gx != gy)
			{
				upper[gx] = gy;
				return true;
			}
			return false;
		}

		auto get()
		{
			std::map<int, std::set<int>> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret[group(i)].emplace(i);
			}
			return ret;
		}

		auto tops()
		{
			std::set<int> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret.emplace(group(i));
			}
			return ret;
		}

		bool is_same_group(int x, int y)
		{
			return group(x) == group(y);
		}
	};
	template<class T>using dual_array = boost::multi_array<T, 2>;
}

namespace out
{
	namespace detail
	{
		template<class>struct void_out
		{
			typedef void type;
		};
		template<class T>auto write(std::ostream& ost, T const& val)
			->typename void_out<decltype(ost << val)>::type
		{
			ost << val;
		}
		template<class T, class... Ts>void write(std::ostream& ost, T const& val, Ts const&... nexts)
		{
			write(ost, val);
			ost << " ";
			write(ost, nexts...);
		}
	}
	void write_line()
	{
		std::cout << std::endl;
	}
	template<class...Ts>void write_line(Ts const&... args)
	{
		detail::write(std::cout, args...);
		write_line();
	}
	template<class Range>void write_range(Range const& rng)
	{
		for (auto const& v : rng)
		{
			write_line(v);
		}
	}
}

namespace adaptor = boost::adaptors;

void Main()
{
	int N;
	std::cin >> N;
	std::vector<double> vec(N);
	for (auto& v : vec)
	{
		std::cin >> v;
	}
	auto h = boost::accumulate(vec, 0.0) / vec.size();
	std::vector<std::pair<double, int>> check(N);
	for (int i : boost::irange(0, N))
	{
		check[i] = std::make_pair(std::abs(vec[i] - h), i);
	}
	boost::sort(check);
	out::write_line(check[0].second);
}

int main()
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(5);
	Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define y1 y122
/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/STACK: 20000000005")
*/

using namespace std;

const ll N = 100005, MOD = 1e9 + 7;


main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    int m, d;
    cin >> m >> d;
    int ans = 0;
    for (int a = 2; a < 10; a++)
    for (int b = 2; b < 10; b++){
        if (a * 10 + b > d)
            continue;
        if (a * b <= m)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256