akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

long long GetMin(long long a, long long b)
{
  if (a>b) return b;
  return a;
}

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

  long long B[101];
  for (int i=1; i<=N; i++) scanf("%lld", B+i);


  long long ret = 0;
  for(int i=1; i<=N; i++)
  {
    long long plus = 0;
    
    if (i == 1)
    {
      plus = B[1];
    }
    else if (i==N)
    {
      plus = B[N-1];
    }
    else
    {
      plus = GetMin(B[i-1], B[i]);
    }
    ret += plus;
  }
    
  printf("%lld\n", ret);
  return 0;  
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t="abcdefghijklmnopqrstuvwxyz";
  cin >> s;
  sort(s.begin(),s.end());
  for(int i=0;i<t.size();i++){
  	int a=0;
  	for(int j=0;j<s.size();j++){
  		if(t[i]==s[j]){
  			a++;
  		}
  	}
  	if(a==0){
  		cout << t[i] << endl;
  		return 0;
  	}
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
int n, k;
string s = "";
void solve() {
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (i == (k - 1)) {
            transform(s.begin() + i, s.begin() + (i + 1), s.begin() + i, ::tolower);
        }
    }
    cout << s << endl;
    return;
}
//逆元を求める関数
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(int args, char* argv[]) {
    solve();
}

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

using namespace std;
#define ll long long int

int main()
{
    ll t;
    t = 1;
    //cin t;
    while (t--)
    {
        ll n;
        cin >> n;
        vector<string> s;
        vector<pair<int, int>> v , v1;
        for (int i = 0; i < n; i++)
        {
            string temp;
            cin >> temp;
            s.push_back(temp);
            int l = temp.length();
            int c1 = 0, c2 = 0;
            int a = 0, b = INT_MAX;

            for (int j = 0; j < l; j++)
            {
                if (temp[j] == '(')
                    c1++;
                else
                    c1--;
                a = min(a , c1);
            }
            if(c1 >=0 )
            v.push_back({ -a , c1});
            else
            v1.push_back({ -(a - c1) , -1 * c1});
            //cout << -a << " " << -(a - c1) <<" "<< c1 << endl;

        }
        sort(v.begin() , v.end());
        sort(v1.begin() , v1.end());
        int x = 0 , y = 0;
        bool check = true;
        for(auto x1 : v)
        {
            if(x - x1.first < 0)
            check = false;

            x += x1.second;
        }

        for(auto x1 : v1)
        {
            if(y - x1.first < 0)
            check = false;

            y += x1.second;
        }

        if( x != y)
        check = false;

        if(check)
        cout << "Yes" << endl;
        else
        cout << "No" << endl;

    }
}


Measured memory_bytes: 47976
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
 
for ia in 0..a do
  for ib in 0..b do
    for ic in 0..c do
      if x == ia*500 + ib*100 + ic*50
        cnt = cnt + 1
      end
    end
  end
end
 
puts cnt

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

class D
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int n = h[0], x = h[1], y = h[2];

		var q =
			from i in Enumerable.Range(1, n)
			from j in Enumerable.Range(i + 1, n - i)
			select Math.Min(j - i, Math.Abs(i - x) + 1 + Math.Abs(j - y));
		var d = q.ToLookup(v => v);
		Console.WriteLine(string.Join("\n", Enumerable.Range(1, n - 1).Select(v => d[v].Count())));
	}
}


Measured memory_bytes: 47056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int a[N];
    bool flag = true;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] == 1) flag = false; 
    }
    if (flag) {
        cout << "-1\n";
        return 0;
    }
    int cnt = 0;
    int t = 1;
    for (int i = 0; i < N; i++) {
        if (a[i] == t) t++;
        else cnt++;
    }
    cout << cnt << "\n";
    return 0;
}

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

using namespace std;

int main(){
    int n;

    cin >> n;

    std::vector<int> a(n);

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

    cout << accumulate(a.begin(), a.end(), 0) - n << endl;

}


Measured memory_bytes: 256
N,K,*ds=$<.read.split.map(&:to_i)
ns = ((0..9).to_a - ds).map(&:to_s)

x = Math.log10(N).to_i + 1

min = 10**9
ns.repeated_permutation(x) do |s|
    n = s.join.to_i
    min = n if n < min && N <= n
end

if min == 10**9
    if ns[0] == '0'
        puts ns[1] + '0' * x
    else
        puts ns[0] * (x+1)
    end
else
    puts min
end

Measured memory_bytes: 14524
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
    int x;
    scanf("%d", &x);
    int a, b, c;
    a = x % 10;
    b = (x / 10) % 10;
    c = x / 100;
    if(a == 7 || b == 7 || c == 7) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
int main(void)
{
    char S[100];
    int c = 0, n = 0;
    scanf("%s", S);
    while (S[n] != 0)
    {
        n++;
    }
    for (int i = 0; i < n / 2; i++)
    {
        if (S[i] != S[n - i-1])
            c++;
    }
    printf("%d", c);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }

int h, w;
string a[1000];
int dp[1000][1000];

int f(int i, int j)
{
    if (i == h || j == w) return 0;
    if (a[i][j] == '#') return 0;
    if (i == h - 1 && j == w - 1) return 1;
    if (dp[i][j] != -1) return dp[i][j];
    return dp[i][j] = add(f(i + 1, j), f(i, j + 1));
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w;
    for (int i = 0; i < h; ++i)
        cin >> a[i];

    memset(dp, -1, sizeof dp);
    cout << f(0, 0);
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

//xが
int x_mod(string s,int cnt){
    if(cnt==0) return 0;

    int ans=0;
    int n=s.length();

    int p=1;

    for(int i=n-1;i>=0;i--){
        if(s[i]=='1'){
            ans=(ans+p%cnt)%cnt;
        }
        p*=2;
    }

    return ans;
}


const int maxn = 100010;
int dp[2 * maxn][2];
int pre[2];

//整数nが与えられたときに、何回で0になるかを求める関数。cntはこれまでの回数。
int mod_n(int n){
    if(n==0) return 0;
    return mod_n(n % __builtin_popcount(n))+1LL; 
}

signed main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n; cin>>n;
    string s; cin>>s;
    //vector<vector<int>> dp(200001,vector<int>(2));
    //vector<int> pre(2);//cnt+-1でxを合ったあまりを格納する。

    int cnt=count(s.begin(),s.end(),'1');
    
    int pl=cnt+1,mi=cnt-1;

    if(mi!=0) dp[n-1][0]=1%mi;
    dp[n-1][1]=1%pl;

    //dpは各ケタをcnt+-1で割った値を保持する。
    for(int i=n-2;i>=0;i--){
        if(mi!=0) dp[i][0] = (2*dp[i+1][0]) % mi;
        dp[i][1] = (2*dp[i+1][1]) % pl;
    }

    //cout<<1%0<<endl;
    //割ったあまりを計算する。
    for(int i=0;i<n;i++){
        if(s[i]=='1'){

            if(mi!=0){
                pre[0]+= dp[i][0];
                pre[0] %= mi;
            }

            pre[1] += dp[i][1];
            pre[1] %= pl;
        }
    }

    for(int i=0;i<n;i++){
        int now=0;
        //1を変更する場合
        if(s[i]=='1'){
            now=pre[0]-dp[i][0];//合計値からそのケタだけ引く。
            if(now<0) now+=mi;
        }else{
            now=(pre[1]+dp[i][1])%pl;
        }
        if(s[i]=='1'&&cnt==1) cout<<'0'<<endl;
        else cout<<(mod_n(now)+1)<<endl;
    }
}


Measured memory_bytes: 6880
#!/usr/bin/env python3
import sys


def solve(K: int, A: int, B: int):
    for i in range(A,B+1):
        if i%K==0:
            print('OK')
            return
    
    print('NG')
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(K, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
 
#define maxn -20000000000 //negative value to break code and force you to put right constraint
#define mod 1073741824
#define md(x) (x) % mod;
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define prt(x) cout << (#x) << " is " << (x) << endl
#define EPS 1e-9
#define INF 100000000000
#define INFd 1e9
typedef int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<double> vd;



int main()
{
	ll a[3];
	ll s=0;
	for(ll i=0;i<3;i++)
	{
		cin>>a[i];
		s+=a[i];
	}
	if(s>=22)
		cout<<"bust";
	else
		cout<<"win";
}


Measured memory_bytes: 256
#[allow(dead_code)]
fn main() {
    let (n, k) = i::u2();
    let mut set = HashSet::new();
    for i in 1..=n {
        set.insert(i);
    }
    for _ in 0..k {
        let d = i::u();
        let a = i::uv(d);
        for i in a {
            set.remove(&i);
        }
    }
    println!("{}", set.len());
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 2188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S>
void print(vector<S> &v){
	for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }


int main(){
	ll n; cin >> n;
	map<pair<ll,ll>, ll> s;
	Rep(n){
		ll a,b; cin >> a >> b;
		if(a==0 && b == 0);
		else if(a==0){
			b=1;
		}else if(b==0){
			a=1;
		}else{
			if(a<0){
				a=-a;
				b=-b;
			}
			ll g = gcd(a,abs(b));
			if(g>1){
				a/=g;
				b/=g;
			}
		}
		s[P(a,b)]++;
	}
	mint ans(1);
	for(auto [k,v]: s){
		if(v){
			if(k.fs == 0 && k.sc == 0) continue;

			auto u = max(s[P(k.sc, -k.fs)], s[P(-k.sc, k.fs)]);
			//cerr << k.fs << k.sc << u << v << endl;
			if(u){
				if(k.sc > 0){
					ans *= (mint(-1) + mint(2).pow(v) + mint(2).pow(u));
				}
			}else{
					ans *= mint(2).pow(v);
			}
		}
	}
	ans -= mint(1);
	ans += mint(s[P(0,0)]);
	cout << ans << endl;

}

Measured memory_bytes: 41132
class Heap
  def initialize(xs = [], &block)
    @que = []
    @size = 0
    @cmp = block || lambda{ |a,b| a < b }
    xs.each do |x| push(x) end
  end

  def push(x)
    i = @size
    while i > 0 do
      j = (i - 1) / 2
      break unless @cmp.call(x, @que[j])
      @que[i] = @que[j]
      i = j
    end
    @que[i] = x
    @size += 1
  end

  def replace
    m = @que[0]
    x = yield m
    i = 0
    while (ii = i * 2 + 1) < @size do
      j1 = ii
      j2 = ii + 1
      j1 = j2 if j2 < @size && @cmp.call(@que[j2], @que[j1])
      break unless @cmp.call(@que[j1], x)
      @que[i] = @que[j1]
      i = j1
    end
    @que[i] = x
    m
  end
end

def get_target(l, h, n, fs)
  r = 0
  fs.each do |f| r += h / f end

  # t0 = (l*h/r).ceil, t = (l*h/(r+n)).ceil
  lh = l * h
  t0 = (lh + r - 1) / r
  t = (lh + r + n - 1) / (r + n)

  raise if (t0 >= t + 2)

  t
end

n, k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
fs = gets.split.map(&:to_i)
 
l = as.inject(:+) - k

if (l <= 0)
  p 0
  exit
end

# O(n * log(n))
afs = as.sort.zip(fs.sort.reverse).sort_by do |item| item[0]*item[1] end

# O(n * log(n))
sum = afs.map do |a, f|
  a
end
for i in (0...n-1)
  sum[i+1] += sum[i]
end
left = -1
right = n - 1
while right - left > 1 do
  mid = (left + right) / 2
  s = 0
  af = afs[mid][0] * afs[mid][1]
  #afs.each do |a,f| s += [af / f, a].min end
  for i in (0...n-1-mid)
    s += af / afs[n-1-i][1]
  end
  s += sum[mid]
  if(s > l)
    right = mid
  else
    left = mid
  end
end
m = right
# p ["m:",m]
if (m > 0)
  afs = afs.drop(m)
  n -= m
end
 
l = -k
max_f = 0
 
# O(n)
fs = afs.map do |a, f|
  l += a
  max_f = f if f > max_f
  f
end
 
# O(n)
t = get_target(l, l * max_f * max_f, n, fs)
# p ["t:", t]
max_af = 0
 
# O(n)
xs = fs.map do |f|
  l -= (a = t / f)
  af = a * f
  max_af = af if af > max_af
  [af + f, f]
end
if (l == 0)
  p max_af
else
  # O(n * log(n))
  # xs = xs.sort_by do |item| item.first end
  q = Heap.new(xs) do |a,b| a.first < b.first end
 
  # assert: l <= 2*n
  # O(n * log(n))
  af, = q.replace do |a| [a[0] + a[1], a[1]] end while (l -= 1) >= 0
  p af
end



Measured memory_bytes: 62648
#include <iostream>

int main(int argc, const char * argv[]) {
    int N = 0;
    std::cin >> N;

    int div = N % 10;
    std::string unit = "";
    switch (div) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            unit = "hon";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            unit = "pon";
            break;
        default:
            unit = "bon";
    }

    std::cout << unit;

    return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
  int a,b;
  cin >> a >> b;
  cout << (a+b+1)/2 << endl;

  return 0;
}

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

int main(){
  int i,j,n,ans[100000],calc[100000];

  calc[0]=2;
  for(i=1;i<100000;i++)calc[i]=calc[i-1]+1;
  ans[1]=2;
  for(i=2;i<100000;i++)ans[i]=ans[i-1]+calc[i-2];

  while(cin >> n){
    cout << ans[n] << endl;




  }

}

Measured memory_bytes: 0
#pragma warning (disable : 4996 4018)

//#include <thread>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <bitset>
#include <limits>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;

int n, arr[100001];

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int ans = 0;
	bool f = 0;
	for (int i = 0; i < n; i++) {
		if (i + 1 == arr[i]) {
			if (!f) {
				ans++;
				f = 1;
				continue;
			}
		}
		f = 0;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    
    cin>>a>>b>>c;
    
    if(a==b&& b==c)
    cout<<1<<endl;
    else if(a==b ||a==c||b==c)
        cout<<2<<endl;
    else
    cout<<3<<endl;
}


Measured memory_bytes: 256
//Digits in Multiplication

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;cin>>n;
    int ans = 20;
    rep(i,1,ceil(sqrt(n))+1){
        if(n%i==0){
            string s = to_string(i);
            string t = to_string(n/i);
            ans = min(ans,(int)max(s.size(),t.size()));
        }
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 3764
S=input()
Q=int(input())
qls=[list(map(str,input().split())) for _ in range(Q)]
N=len(S)
res=['']*(2*Q+N)
res[Q:Q+N]=S
ins = [Q+N, Q-1]
flg=0 #0:right, 1:left
for q in qls:
    if q[0]=='1':
        flg = (flg+1)%2
    else:
        x = (flg+int(q[1]))%2
        idx = ins[x]
        res[idx] = q[2]
        if x==0:
            ins[x]+=1
        else:
            ins[x]-=1
if flg==0:
    print(''.join(res))
else:
    print(''.join(res[::-1]))


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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		String[] ok = {"AKIHABARA",
				"KIHBR",
				"KIHBRA",
				"KIHBAR",
				"KIHBARA",
				"KIHABR",
				"KIHABRA",
				"KIHABAR",
				"KIHABARA",
				"AKIHBR",
				"AKIHBRA",
				"AKIHBAR",
				"AKIHBARA",
				"AKIHABR",
				"AKIHABRA",
				"AKIHABAR",
//				"AKIHABARA",
		};

		String s = sc.next();

		for (int i = 0; i < ok.length; i++) {
			if (s.equals(ok[i])) {
				pr.println("YES");
				return;
			}
		}

		pr.println("NO");
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;
public class Main{
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);

		int count1 = 0;
		int count2 = 0;
		int a = sc.nextInt();
		if(a == 5) {
			count1 += 1;
		}
		if(a == 7) {
			count2 += 1;
		}
		int b = sc.nextInt();
		if(b == 5) {
			count1 += 1;
		}
		if(b == 7) {
			count2 += 1;
		}
		int c = sc.nextInt();
		if(c == 5) {
			count1 += 1;
		}
		if(c == 7) {
			count2 += 1;
		}
		if(count1 == 2 && count2 == 1) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}

	}
}

Measured memory_bytes: 35560
N, L = map(int, input().split())

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

ans_index = -1
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        ans_index = i
        break

if ans_index == -1:
    print('Impossible')
    exit()
print('Possible')

ans_index += 1
for i in range(1, ans_index):
    print(i)
for i in range(N-1, ans_index, -1):
    print(i)

print(ans_index)


Measured memory_bytes: 14060
#include<algorithm>
#include<iostream>
#include<string.h>
#include<utility>
#include<stdio.h>
#include<vector>
#include<string>
#include<math.h>
#include<cmath>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#pragma warning(disable:4244)
#define PI 3.1415926536
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll ll_inf = 9223372036854775807;
const int int_inf = 2147483647;
const short short_inf = 32767;
const char char_inf = 127;
ll GCD(ll a, ll b) { return a ? GCD(b, a % b) : a; }
inline ll read() {
	ll c = getchar(), Nig = 1, x = 0;
	while (!isdigit(c) && c != '-')c = getchar();
	if (c == '-')Nig = -1, c = getchar();
	while (isdigit(c))x = ((x << 1) + (x << 3)) + (c ^ '0'), c = getchar();
	return Nig * x;
}
inline void out(ll a)
{
	if (a < 0)putchar('-'), a = -a;
	if (a >= 10)out(a / 10);
	putchar(a % 10 + '0');
}
ll qpow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1)res = (res * x) % mod;
		x = (x * x) % mod; n >>= 1;
	}
	return res;
}
#define read read()
ll a[1000000];
ll b[1000000];
int main()
{
	int n = read;
	for (int i = 0; i < n; i++) { a[i] = read, b[i] = read; }
	ll ans = 0;
	for (int i = n - 1; i >= 0; i--)
	{
		if ((a[i] + ans) % b[i])
		{
			ll temp = (((a[i] + ans) / b[i]) + 1) * b[i] - a[i] - ans;
			ans += temp;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5120
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;

string ans;

void ps(int n,char a){
    for(int i=0;i<n;i++) ans+=a;
    return;
}

int sumd(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

int main(){
    int x;cin>>x;
    if(x%sumd(x)==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}    

Measured memory_bytes: 888
import java.util.*;
class Main{
    public static void main(String[]args){
        Scanner cin=new Scanner(System.in);
        long input;
        long larger;
        int min=11;
        input=cin.nextLong();
        for(long i=1;i*i<=input;i++){
            if(input%i==0){
                larger=(long)input/i;
                if(min>String.valueOf(larger).length()){
                    min = String.valueOf(larger).length();
                }
            }
        }
        System.out.println(min);
    }
}


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

int N,K;
int dp[2002][2002][2];
string S;
int dx[]={1,1,-1,-1};
int dy[]={1,-1,1,-1};
int gcost(int d,char c,int k,int f){
  if( c == 'U' ){
    if( (k-f) & 1 ) return dy[d];
    else return dy[d]*-1;
  } else if( c == 'D') {
    if( (k-f) & 1 ) return dy[d]*-1;
    else return dy[d];
  } else if( c == 'L' ) {
    if( f ) return dx[d];
    else return dx[d]*-1;
  } else {
    if( f ) return dx[d]*-1;
    else return dx[d];
  }
}

const int INF = (1<<29);
void update(int &a,int b){
  a = max( a, b );
}
int solve(int d){
  fill( dp[0][0],dp[N+1][K+1], -INF );
  dp[0][0][0] = 0;
  for(int i=0;i<N;i++){
    for(int k=0;k<=K;k++){
      for(int f=0;f<2;f++){
        if( dp[i][k][f] == -INF ) continue;
        if( k < K ) {
          update( dp[i][k+1][1-f], dp[i][k][f]);
          update( dp[i][k+1][f], dp[i][k][f]);
        }
        update( dp[i+1][k][f],
                dp[i][k][f] + gcost(d,S[i],k,f) );
      }
    }
  }
  int res = -INF;
  for(int k=0;k<=K;k++)
    for(int f=0;f<2;f++)
      res = max( res, dp[N][k][f] );
  return res;
}

int main() {
  cin >> S;
  cin >> K;
  N = S.size();
  int res = 0;
  for(int i=0;i<4;i++)
    res = max( res, solve(i) );
  cout << res << endl;
}

Measured memory_bytes: 34452
using System;

namespace ABC049C
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();

            Console.WriteLine(Inspect(input, 0) ? "YES" : "NO");
        }

        private static string[] targets = new[] { "dream", "dreamer", "erase", "eraser" };

        private static bool Inspect(string str, int start)
        {
            if (start == str.Length)
            {
                return true;
            }

            if (start > str.Length)
            {
                return false;
            }

            var result = false;

            for (int i = 0; i < targets.Length; i++)
            {
                if (IsMatch(str, targets[i], start))
                {
                    result = Inspect(str, start + targets[i].Length);
                    if (result)
                    {
                        break;
                    }
                }
            }

            return result;
        }

        private static bool IsMatch(string str, string target, int start)
        {
            for (int i = 0; i < target.Length && start + i < str.Length; i++)
            {
                if(target[i] != str[start + i])
                {
                    return false;
                }
            }

            return true;
        }
    }
}


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

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  int arr[n];
  for(int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  int dp[n];
  dp[0] = 0;
  dp[1] = abs(arr[0] - arr[1]);
  for(int i = 2; i < n; ++i) {
    dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
  }
  cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int N, A, B;
int main() {
  cin >> N >> A >> B;
  int ans = 0;
  for (int i=0; i<N; i++) {
    int x;
    cin >> x;
    if (!(x >= A && x < B)) {
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 100010, LOG=20;

int h, w, n, u, v, x, y, t, a, b, ans;
int A[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>h>>w>>n;
	if (h<w) swap(h, w);
	cout<<(n+h-1)/h<<'\n';
	
	
	return 0;
}


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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


void run_case() {
    int n;
    cin >> n;
    vi a(n), b(n);
    loop(i, n)cin >> a[i] >> b[i];
    sort(ALL(a));
    sort(ALL(b));
    if (n % 2 == 0) {
        cout << (b[n / 2] + b[n / 2 - 1]) - (a[n / 2] + a[n / 2 - 1]) + 1 << endl;
    } else {
        cout << b[n / 2] - a[n / 2] + 1 << endl;
    }
}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T = 1;
    while (T--)run_case();

    return 0;
}


Measured memory_bytes: 4772
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	vector<int> candidates(n);
	for (int i = 0; i < n; ++i) {
		cin >> candidates[i];
	}	

	int m;
	cin >> m;	
	vector<int> problem_set(m);
	for (int i = 0; i < m; ++i) {
		cin >> problem_set[i];
	}

	if (m > n) {
		cout << "NO\n";
		return 0;
	}

	sort(candidates.begin(), candidates.end());
	sort(problem_set.begin(), problem_set.end());

	int i = 0, j = 0;
	while (i < n && j < m) {
		if (candidates[i] > problem_set[j]) {
			cout << "NO\n";
			return 0;
		}

		if (candidates[i] == problem_set[j]) {
			++j;
		}

		++i;
	}

	cout << "YES\n";

	return 0;

}

Measured memory_bytes: 1792
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long
#define ll long long
#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	vector<vector<bool>>t(n+1, vector<bool>(m+1, 0));
	vector<bool>pk(n*m+1, false);
	int ck = 0;
	rup(i, 0, n+1) {
		rup(j, 0, m+1) {
			pk[m*i + n*j - 2*i*j] = true;
		}
	}
	if (pk[k])cout << "Yes";
	else cout << "No";
	return 0;
}





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

class Main {
	
	public static void main(String[] args) throws IOException {

		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		
		ArrayList<Integer> ans = new ArrayList<Integer>();
		
		while (true) {
			
			int n = Integer.parseInt(br.readLine());
			if (n == 0) break;
			
			int div = 5;
			int sum = 0;
			
			while (div <= n) {
				
				sum += n / div;
				div *= 5;
				
			}
			ans.add(sum);
		}
		
		for (int a : ans) {
			System.out.println(a);
		}

	}

}

Measured memory_bytes: 9336
#include<bits/stdc++.h>
using namespace std;
int main(){
  double n,a,b;
  cin>>n;
  while(n--){
    scanf("%lf:%lf",&a,&b);
    double c=abs(a*30+b/2-b*6);
    double d=min(c,360-c);
    if(d<30)cout<<"alert"<<endl;
    else if(d<90)cout<<"warning"<<endl;
    else cout<<"safe"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
#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 rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    if(s=="ABC")cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int n, a[MAX], b[MAX];

int main(){
    scanf("%d", &n);
    rep(i, n) scanf("%d%d", &a[i], &b[i]);

    int m, M;
    sort(a, a+n);
    sort(b, b+n);
    if(n%2 == 1){
        m = a[n/2];
        M = b[n/2];
    }
    else{
        m = a[n/2-1] + a[n/2];
        M = b[n/2-1] + b[n/2];
    }
    printf("%d\n", M-m+1);
}

Measured memory_bytes: 5392
N, M = list(map(int, input().split()))
V = 10 ** 9 + 7
a = [int(input()) for _ in range(M)]
A = set(a)
ANS = [0 for _ in range(100000 + 5)]

ANS[0] = 1
for i in range(N):
    #ANS[i] %= V
    if not i + 1 in A:
        ANS[i + 1] += ANS[i]
        #ANS[i + 1] %= V
    if not i + 2 in A:
        ANS[i + 2] += ANS[i]
        #ANS[i + 2] %= V
print(ANS[N] % V)


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    int H, W, N;
    cin >> H >> W >> N;
    int a = max(H, W);
    cout << (N + (a - 1))/ a << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        long[] b = new long[a];
        long total = 1;
        for(int i =0; i<a; i++) {
            b[i] = sc.nextLong();
            if(b[i] == 0) {
                System.out.println("0");
                return;
            }
        }
        long c = (long) Math.pow(10, 18);
        for(int i =0; i<a; i++) {
            if(b[i] > c/total ) {
                System.out.println("-1");
                return;
            }
            total *= b[i];
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 50352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(j, m) for (int j = 0; j < (int)(m); j++)
#define rep2(i, l, n) for (int i = l; i < (int)(n); i++)


int main() {
    ll N;
    cin >> N;
    ll i = 0;
    while((i + 1)*(i + 1) <= N) {
        i++;
    }
    cout << i*i << endl;
}



Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int a,b;
  cin>>a>>b;
  string s(a,'0'+b);
  string t(b,'0'+a);
  if(a<b){
    cout<<t<<endl;
  }
  else cout<<s<<endl;
}


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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int m = Integer.parseInt(str[1]);
    System.out.println((n-1)*(m-1));
  }
}

Measured memory_bytes: 32724
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc087_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int A, B, C, X;
  cin >> A >> B >> C >> X;

  ll ans = 0;
  rep(i, A+1) rep(j, B+1) rep(k, C+1){
    if (500 * i + 100 * j + 50 * k == X) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  map<int,int> a;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    a[x]++;
  }
  int c=0;
  for(auto x:a)
    c+=x.second%2;
  cout<<c<<endl;
}

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

int main() {
    while (true) {
        char r[5], a[5];
        cin >> r >> a;
        if (r[0] == '0' && a[0] == '0' && !isdigit(r[1])) {
            break;
        }
        int hit = 0, blow = 0;
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (r[i] == a[j]) {
                    if (i == j) {
                        hit++;
                    } else {
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

Measured memory_bytes: 864
N,M = list(map(int,input().split()))

e_list = [[] for i in range(N)]

for i in range(M):
    a,b = list(map(int,input().split()))
    a,b = a-1,b-1
    e_list[a].append(b)
    e_list[b].append(a)

from collections import deque

vi = 0  #change
INF = float('inf')

Q = deque([vi])

checked_list = [False]*N
checked_list[vi]=True
parent_list = [-1]*N


while len(Q)>0:
    v = Q.pop()
    for v1 in e_list[v]:
        if not checked_list[v1]:
            checked_list[v1]=True
            Q.appendleft(v1)
            parent_list[v1] = v

print("Yes")

for i in range(1,N):
    print(parent_list[i]+1)


Measured memory_bytes: 94588
// ABC001C.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>

using namespace std;




int main()
{
	int old;
	cin>>old;
	if(old == 3 || old == 5 || old == 7){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int n,i;
	scanf("%d",&n);
	while(1){
		int m=n;
		while(1){
			if(m%2==0||m==1){m=m>1?m/2:1;if(m==1){printf("%d",n);return 0;}}
			else{break;}
		}
		n--;
	}
}

Measured memory_bytes: 128
import bisect
import collections
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7

N,K = map(int,(input().split()))
A = list(map(int,(input().split())))
F = list(map(int,(input().split())))
A.sort(reverse=True)
F.sort()
time = []
for i in range(N):
    time.append((A[i]*F[i],F[i]))

l = -1
r = 10**12
ans = 0
tmp = -1
while ans != tmp:
    c = 0
    tmp = ans
    for i in range(N):
        if time[i][0] > ans:
            c += (time[i][0] - ans -1)//time[i][1] +1
    if c > K:
        l = ans
    else:
        r = ans
    ans = (l+r+1)//2
print(ans)

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

void trace(int a[], int n)
{
  int i;
  for (i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

int bubbleSort(int a[], int n)
{
  int count = 0;
  for (int i = 0; i < n; i++)
    for (int j = n - 1; j > i; j--)
      if (a[j] < a[j - 1])  {
        swap(a[j], a[j - 1]);
        count++;
      }
  return count;
}

int main(void)
{
  int n, count, *a;
  cin >> n;
  a = new int[n];
  for (int i = 0; i < n; i++) cin >> a[i];

  count = bubbleSort(a, n);
  trace(a, n);
  cout << count << endl;

  return 0;
}

Measured memory_bytes: 1188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// 標準入力からデータを読み込む準備
		Scanner sc = new Scanner(System.in);
		// 2つの文字の固まりをそれぞれ整数値と想定して読み込む
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		if (x >= r && y >= r && x + r <= W && y + r <= H) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
}


Measured memory_bytes: 26436
#include <bits/stdc++.h>
const int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
typedef long long ll;
const int N=20;
const ll inf=1ll<<60;
int n,m,g[N][N],ST;
int dp[40000][N],sum[40000];
using namespace std;

/*struct node
{
	int t,next;
}adj[N<<1];
void add(int s,int t)
{
	adj[++now]=(node){t,head[s]};
	head[s]=now;
}*/
inline int read()
{
	char c;int x;
	while (c=getchar(),c<'0' || c>'9');x=c^'0';
	while (c=getchar(),c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x;
}
void write(int x)
{
	if (x==0) return;
	write(x/10);
	putchar((x%10)+'0');
}
void upd(int& x,int y){if (x==-1) x=y;else x=max(x,y);}
int main()
{
	#ifdef Kay
		freopen ("code.in","r",stdin);
		freopen ("code.out","w",stdout);
	#endif
	cin>>n>>m;
	int i,s,t,w,j,k,l,tot=0;
	for (i=1;i<=m;i++)
	cin>>s>>t>>w,g[s][t]=g[t][s]=w,tot+=w;
	ST=1<<n;
	memset(dp,-1,sizeof(dp));
	for (i=1;i<ST;i++)
	for (s=1;s<=n;s++)
	if ((i>>(s-1))&1)
	for (t=s+1;t<=n;t++)
	if ((i>>(t-1))&1) sum[i]+=g[s][t];
	for (i=0;i<ST;i++)
	if ((i&1)) dp[i][1]=sum[i];
	for (i=1;i<ST;i++)
	for (j=1;j<=n;j++)
	if (dp[i][j]!=-1)
	{
		int x=(i^(ST-1));
		for (k=x;k;k=(k-1)&x)
		for (l=1;l<=n;l++)
		if (((k>>(l-1))&1) && g[j][l]) upd(dp[k|i][l],dp[i][j]+sum[k]+g[j][l]);
	}
	printf ("%d",tot-dp[ST-1][n]);
	return 0;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

bool used[2000000];
int main(){
	int K;cin>>K;
	ll d=7%K;
	int cnt=1;
	while(1){
		if(d==0){
			cout<<cnt<<endl;
			return 0;
		}
		used[d]=true;
		d=(d*10+7)%K;
		if(used[d]){
			puts("-1");return 0;
		}
		cnt++;
	}
}

Measured memory_bytes: 4592