akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  rep(i,n){
    if(a[i]%2==0){
      if(a[i]%3==0||a[i]%5==0){
        continue;
      }
      COUT("DENIED");
      return 0;
    }
  }
  COUT("APPROVED");
}

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

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second

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

const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	ios::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;

	map<string, int> f;
	int maxi = 0;
	vector<string> ans;

	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		f[s]++;

		if (f[s] > maxi) {
			maxi = f[s];
			ans.clear();
			ans.pb(s);
		} else if (f[s] == maxi) {
			ans.pb(s);
		}
	}

	sort(ans.begin(), ans.end());
	for (string& s : ans ) cout << s << '\n';

	return 0;
}

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

template<class T> class SqrtDecomposition {
    using Func = function<T(T, T)>;
    const Func f;
    const T def;
    const int cap = 512;
    int N, K;
    vector<T> data, bucket;
public:
    SqrtDecomposition(int n, T _def, const Func f) : N(n), def(_def), f(f) {
        K = (N + cap - 1) / cap;
        data.assign(K * cap, def);
        bucket.assign(K, def);
    }
    void update(int x, T y) {
        int k = x / cap;
        T val = data[x] = y;
        for(int i = k * cap; i < (k + 1) * cap; ++i) {
            val = f(val, data[i]);
        }
        bucket[k] = val;
    }
    T query(int x, int y) {
    T val = def;
    for(int k = 0; k < K; ++k) {
            int l = k * cap, r = (k + 1) * cap;
            if(r <= x || y <= l) continue;
            if(x <= l && r <= y) {
                val = f(val, bucket[k]);
            } else {
                for(int i = max(x, l); i < min(y, r); ++i) {
                    val = f(val, data[i]);
                }
            }
        }
        return val;
    }
};

int main() {
    int N, Q; string S;
    cin >> N >> S >> Q;
    SqrtDecomposition<int> sd(N, 0, [](int a, int b) { return a | b; });
    for(int i = 0; i < N; ++i) sd.update(i, 1 << (S[i] - 'a'));
    while(Q--) {
        int t; cin >> t;
        if(t == 1) {
            int i; char c;
            cin >> i >> c; i--;
            sd.update(i, 1 << (c - 'a'));
        } else {
            int l, r; cin >> l >> r; l--;
            cout << __builtin_popcount(sd.query(l, r)) << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 2820
from collections import defaultdict
def f(n):
    if memo[n]!=float('inf'):
        return memo[n]
    if n==0:
        return 0
    if n==1:
        return D
    ans=n*D
    for x,c in [(2,A),(3,B),(5,C)]:
        ans=min(ans,f(n//x)+c+n%x*D)
        if n%x:
            ans=min(ans,f(n//x+1)+c+(x-n%x)*D)
    memo[n]=ans
    return memo[n]
T=int(input())
for _ in range(T):
    N,A,B,C,D=map(int,input().split())
    memo=defaultdict(lambda :float('inf'))
    print(f(N))

Measured memory_bytes: 11340
#define ll long long
#define dd long double
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define mt make_tuple
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>   
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<bitset>
dd pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gdp(ll a , ll b){return (a - (a%b)) ;}
ll ld(ll a , ll b){if(a < 0) return -1*gdp(abs(a) , b) ; if(a%b == 0) return a ; return (a + (b - a%b)) ;} // least number >=a divisible by b
ll gd(ll a , ll b){if(a < 0) return(-1 * ld(abs(a) , b)) ;    return (a - (a%b)) ;} // greatest number <= a divisible by b
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll e_gcd(ll a , ll b , ll &x , ll &y){ if(b > a) return e_gcd(b , a , y , x) ; if(b == 0){x = 1 ; y = 0 ; return a ;}
ll x1 , y1 ; e_gcd(b , a%b , x1 , y1) ; x = y1 ; y = (x1 - ((a/b) * y1)) ; return e_gcd(b , a%b , x1 , y1) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r|| (n < 0) || (r < 0)) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
/*#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>*/
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n
// ll seed;
//mt19937 rnd(seed=chrono::steady_clock::now().time_since_epoch().count()); // include bits

void solve()
{
    string str ;
    cin >> str ;
    ll sum = 0 ;
    fo(i , str.size())
    {
        sum += (ll)(str[i] - '0') ;
    }
    if(sum%9 == 0)
        cout <<     "Yes" << '\n' ;
    else
        cout << "No" << '\n' ;
    return ;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
    
    ll t ;
    //cin >> t ;
    t = 1 ;
   
    while(t--)
    {
        solve() ;
    }
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}

Measured memory_bytes: 3456
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])

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

typedef long long LL;

LL gcd(LL a, LL b){
    if(a < b)   swap(a, b);
    LL c = a % b;
    while(c){
        a = b; b = c; c = a % b;
    }
    return b;
}

LL lcm(LL a, LL b){
    LL g = gcd(a, b);
    return a / g * b;
}

int n;
LL s, x;

int main(){
    scanf("%d", &n);
    s = 1;
    while(n--){
        scanf("%lld", &x);
        s = lcm(s, x);
    }
    printf("%lld\n", s);
    return 0;
}


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

int main() {
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
    if (a < b) {
        if(a+v*t >= b+w*t) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    if (a > b ){
        if(v*t-a >= w*t-b) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    

    return 0;
}

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

int main(){
  int n,ans=0,flag=0;
  int num[101];
  int idx;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  for(int i=0;i<n;i++){
    idx=i;
    for(int j=i+1;j<n;j++){
      if(num[idx]>num[j]){
	flag=1;
	idx=j;
      }
    }
    int temp=num[i];
    num[i]=num[idx];
    num[idx]=temp;
    if(flag)ans++;
    flag=0;
  }
  for(int i=0;i<n;i++){
    cout<<num[i];
    if(i==n-1)cout<<endl;
    else cout<<" ";
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;

int val(int n){
	return n*(n+1)/2;
}

void solve(){
	int n;
	cin>>n;
	vector<int> v;
	for(int i=2;i*i<n;i++){
		if(n%i == 0){
			int c = 0;
			while(n%i == 0){
				c++;
				n/=i;
			}
			v.pb(c);
		}
	}
	if(n!=1){
		v.pb(1);
	}
	int ans = 0;
	for(int x:v){
		int k = 0;
		while(val(k+1) <= x){
			k++;
		}
		ans += k;
	}
	cout<<ans;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}



Measured memory_bytes: 3656
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  string s;cin>>s;
  ll n=s.size();
  rep(i,n-1){
    if(s[i]==s[i+1]){
      cout<<i+1<<" "<<i+2<<endl;
      return 0;
    }
  }
  rep(i,n-2){
    if(s[i]==s[i+2]){
      cout<<i+1<<" "<<i+3<<endl;
      return 0;
    }
  }
  cout<<-1<<" "<<-1<<endl;
}

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

string s;

int sum,prod=1;
map<int,int> dp[20][3][155];

int dfs(int idx,int tight=true,int A=0,int B=1){
  if(idx==s.size()){
    if(A<sum)return 1;
    else if(A==sum&&B<prod)return 1;
    else if(A==sum&&B==prod&&tight==0)return 1;
    return 0;
  }
  if(dp[idx][tight][A].count(B))return dp[idx][tight][A][B];
  int x=s[idx]-'0';
  int r=(tight?x:9);
  for(int i=0;i<=9;i++){
    if(tight==2||tight==1&&r<i)dp[idx][tight][A][B]+=dfs(idx+1,2,A+i,B*(i+1));
    else dp[idx][tight][A][B]+=dfs(idx+1,tight&&i==r,A+i,B*(i+1));
  }
  return dp[idx][tight][A][B];
}

signed main(){
  cin>>s;
  r(i,s.size())sum+=(s[i]-'0');
  r(i,s.size())prod*=(s[i]-'0'+1);
  cout<<dfs(0)<<endl;
}



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

const int MAXN = 2e5+2;
int dis[MAXN];//距离

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

    for (int i=0; i<n; i++) {
        scanf("%d", &dis[i]);
    }

    int maxx = INT_MIN;
    for (int i=1; i<n; i++) {
        maxx = std::max(maxx, dis[i]-dis[i-1]);
    }
    maxx = std::max(maxx, k-dis[n-1]+dis[0]);

    printf("%d\n", k-maxx);

    return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    la = rli()
    s = sum(la)
    half = s/2
    l = 0
    m = s
    for a in la:
        l += a
        m = min(m, abs(l-half))
    print(int(m*2))



if __name__ == '__main__':
    main()


Measured memory_bytes: 26024
# D - Gathering Children
import re

s = input()
sList = list(s)

# RR...RLL...Lは、「RL」の部分に子供が集約される
# RLそれぞれの連続する個数が
# ・同じ   → 同値
# ・異なる → 入れ替えごとに交互に余りを足していく
#          → 差が偶数なら同値
#             差が奇数ならいずれかを1大きくする
retList = []
matchList = re.findall('R+L+', s)

for match in matchList:
    rCnt = match.count('R')
    lCnt = len(match) - rCnt
    
    half = len(match) // 2
    dif = abs(rCnt - lCnt)

    # まずは均等配分する
    ret = [0] * len(match)
    ret[rCnt - 1] = half
    ret[-lCnt] = half
    
    # 個数が同じ         → 既に同値にしているので終了
    # 奇数だけど差が偶数 → 既に同値にしているので終了
    # 奇数かつ  差が奇数
    if dif % 2 != 0:

        # 集約完了までに動かした回数を計算
        changeCnt = (rCnt if rCnt < lCnt else lCnt) - 1 + dif
        
        # 集約完了時点で連続する個数が多かった側が1大きくなっている
        # → 残りの試行回数が奇数なら逆転、偶数ならそのまま
        if (rCnt < lCnt and changeCnt % 2 != 0) or (rCnt > lCnt and changeCnt % 2 == 0):
            ret[rCnt - 1] = half + 1
            ret[-lCnt] = half
        else:
            ret[rCnt - 1] = half
            ret[-lCnt] = half + 1
    retList.extend(ret)
print(' '.join(map(str, retList)))

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

int main(){

  cin.tie(0); //cin高速化
  ios::sync_with_stdio(false); //cin高速化
  
  string s;
  cin >> s;
  int ans = 0;
  rep(i,4){
    if(s[i]=='+'){
      ans++;
    }else{
      ans--;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}
    

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

using namespace std;

int main()
{
	const int MAX_N = 100000;
	int n;
	cin >> n;
	int em[MAX_N + 1];
	int pl[MAX_N];
	for (int i = 0; i < n + 1; i++)
		cin >> em[i];
	for (int i = 0; i < n; i++)
		cin >> pl[i];

	long long answer = 0;
	for (int i = 0; i < n; i++)
	{
		// 街にいる敵のほうが多い場合
		if (pl[i] <= em[i])
		{
			// 倒せるだけ倒す
			em[i] -= pl[i];
			answer += pl[i];
			pl[i] = 0;
			continue;
		}
		// 街にいる敵以上に倒せる場合
		else
		{
			// まず今いる街を全滅
			int kill = em[i];
			em[i] = 0;
			answer += kill;
			pl[i] -= kill;


			// --- 次の街へ遠征 ---

			// 敵の数を上回らない
			if (pl[i] <= em[i+1])
			{
				// 倒せるだけ倒す
				em[i + 1] -= pl[i];
				answer += pl[i];
				continue;
			}
			else
			{
				// 全滅する
				answer += em[i + 1];
				em[i + 1] = 0;
				continue;
			}
		}
	}

	cout << answer;

	return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<int> x(n),y(n),h(n);
    rep(i,n){
        cin >> x.at(i) >> y.at(i) >> h.at(i);
    }

    int ax,ay,ah;
    rep(cx,101){
        rep(cy,101){
            int th = -1;
            bool ok_fl = true;
            ll maxh = INF;
            rep(i,n){
                int tth = h.at(i) + abs(x.at(i)-cx) + abs(y.at(i)-cy);
                if(h.at(i) == 0){
                    maxh = min(maxh,(ll)tth);
                    continue;
                }
                if(th == -1){
                    th = tth;
                }else if(th != tth) {
                    ok_fl = false;
                    break;
                }
            }
            if(th > maxh){
                ok_fl = false;
            }

            if(ok_fl){
                ax = cx;
                ay = cy;
                ah = th;
            }
        }
    }
    cout << ax << " " << ay << " " << ah << endl;
    return 0;
}

Measured memory_bytes: 256
a = list(map(int, input().split()))



if a[0] == a[1]:
    if a[0] == a[2]:
        print("No")
    else:
        print("Yes")
else:
    if a[0] == a[2]:
        print("Yes")
    else:
        if a[1] == a[2]:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 3060
#![allow(clippy::needless_range_loop)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

struct Bits(usize);

impl Bits {
    fn at(&self, index: usize) -> bool {
        self.0 & 1 << index > 0
    }
}

macro_rules! n_bits_range {
    ($bits:expr) => {
        (0..(1 << $bits)).map(Bits)
    };
}

fn main() {
    input! {
        h: usize,
        w: usize,
        k: usize,
        c: [chars; h]
    }
    let mut ans = 0;
    for bits in n_bits_range!(h + w) {
        let mut cnt = 0;
        for x in 0..w {
            for y in 0..h {
                if bits.at(x) && bits.at(y + w) && c[y][x] == '#' {
                    cnt += 1;
                }
            }
        }
        if cnt == k {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

int main(){
	string s;
	cin>>s;
	for(int i=0; i<s.size()/2; i++)
		if(s[i]!=s[s.size()-1-i]) {
			cout<<"No"<<endl;
			return 0;
		}
	int n=(s.size()-1)/2;
	for(int i=0; i<=n/2; i++)
		if(s[i]!=s[n-1-i]) {
			cout<<"No"<<endl;
			return 0;
		}
	n=(s.size()+3)/2;
	for(int i=0; i<s.size()-n+1; i++)
		if(s[n+i-1]!=s[s.size()-i-1]) {
			cout<<"No"<<endl;
			return 0;
		}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	return c - '0';
}
int keta(int a) {
	return to_string(a).size();
}
int s[5], d[5];
int a[10][10];
int b[110];
int na = 0, nb = 0;
signed main(){
	rep(i, 3) {
		rep(j, 3) {
			cin >> a[i][j];
		}
	}
	int n;
	cin >> n;
	rep(i, n) {
		cin >> b[i];
	}
	rep(i, n) {
		rep(j, 3) {
			rep(k, 3) {
				if (a[j][k] == b[i]) {
					s[j]++;
					d[k]++;
					if ((j == 0 && k == 0) || (j == 2 && k == 2))na++;
					if ((j == 0 && k == 2) || (j == 2 && k == 0))nb++;
					if (j == 1 && k == 1) {
						na++; nb++;
					}
				}
			}
		}
	}
	bool bin = false;
	rep(i, 3) {
		if (s[i] == 3)bin = true;
		if (d[i] == 3)bin = true;
	}
	if (na == 3 || nb == 3)bin = true;
	if (bin == true) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}


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

int main() {
 int N,count = 1000000000;
  cin >> N;
  for(int i=0;i<N;i++){
    int x,c = 0; 
    cin >> x;
    while(x%2 == 0){
      x /= 2;
      c++;
    }
    if(count>c)
        count = c;
  }
  cout << count << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a,b,inp;
 
  int i,c=0,d=0;   
   cin>>a>>b; 
  

   cin>>c>>d; 
  
  cin>>inp;
  if(inp.compare(a)==0){
   c--; 
  }
  else{
   d--; 
  }
  cout<<c<<" "<<d<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int A[111];

int main() {
    int n, ans = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &A[i]);
    for(int i = 1, nxt; i <= n; i = nxt + 1) {
        for(nxt = i; nxt < n && A[nxt + 1] == A[i]; nxt++);
        ans += (nxt - i + 1) / 2;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll n, in[210000], s[210000], to[210000], ans = 0;
int main() {
	REP(i, 210000) to[i] = -1;
	cin >> n;
	REP(i, n) {
		cin >> in[i];
		s[in[i] - 1] = i;
	}
	REPR(i, n - 1) {
		ll l = s[i], r = s[i] + 1;
		REPR(j, l) {
			if (to[j] != -1 and to[j] < j) j = to[j] + 1;
			else if (j == 0 or in[max(j - 1, 0ll)] < i + 1) {
				l = j;
				break;
			}
		}
		FOR(j, r, n + 1) {
			if (to[j] != -1 and to[j] > j) j = to[j] - 1;
			else if (j == n or in[min(j, n - 1)] < i + 1) {
				r = j;
				break;
			}
		}
		to[l] = r;
		to[r] = l;
		ans += ((abs(s[i] - l) + 1) * (abs(s[i] + 1 - r) + 1)) * (i + 1);
	}
	cout << ans << endl;
}



Measured memory_bytes: 5120
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 998244353;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
int a[305];
int dp[302][90505];
int dp2[302][90505];

int modpow(int x, int n, int md) {
	if (!n)return 1;
	int res = modpow(x*x%md, n / 2, md);
	if (n & 1)res = res*x%md;
	return res;
}

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> a[i];
	dp[0][0] = 1;
	rep(i, n) {
		rep(j, 90000) {
			dp[i + 1][j] += 2 * dp[i][j];
			dp[i + 1][j] %= mod;
			dp[i + 1][j + a[i]] += dp[i][j];
			dp[i + 1][j + a[i]] %= mod;
		}
	}
	int sum = modpow(3, n, mod);
	int S = 0;
	rep(i, n)S += a[i];
	for (int i = (S + 1) / 2; i <= S; i++) {
		sum -= 3 * dp[n][i];
		sum += mod*4;
		sum %= mod;
	}
	dp2[0][0] = 1;
	rep(i, n) {
		rep(j, 90000) {
			dp2[i + 1][j] += dp2[i][j];
			dp2[i + 1][j] %= mod;
			dp2[i + 1][j + a[i]] += dp2[i][j];
			dp2[i + 1][j + a[i]] %= mod;
		
		}
	}
	if(S%2==0)sum += 3*dp2[n][S / 2];
	sum %= mod;
	cout << sum << endl;
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int mi = -1;
  int ma = a[0]+1;
  int p;
  while(mi < ma) {
    int med = (mi+ma)/2;

    int now = med;
    rep(i, n) {
      now = (a[i]-now);
    }
    if (now == med) {
      p = med;
      break;
    }
    if (now > med) {
      mi = med;
    } else {
      ma = med;
    }
  }

  cout << p*2 << ' ';
  rep(i, n-1) {
    p = a[i]-p;
    cout << p*2 << ' ';
  }
  cout << endl;
}

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

using namespace std;
using ll = long long;
const long long MOD = 1e9+7;


ll kaij(ll n) {
    if(n == 1) {
        return 1;
    }
    return n*kaij(n - 1)%MOD;
}

int main() {
    ll N = 0;
    cin >> N;

    cout << kaij(N) << endl;


    return 0;
}

Measured memory_bytes: 5072
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n;
    cin >> n;
    ll count=0;
    for (ll i=1;i<=n;i++){
        count+=i;
        if (count>=n){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


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

int main(){ 
  string s;
  cin>>s;
  int n = s.size();
  vector<int> a(2019);
  a[0] = 1;
  int res = 0;
  int p = 1;
  rep(i,n){
    res += (s[n-1-i]-'0')*p;
    p = p*10%2019;
    res%=2019;
    a[res]++;
  }
  
  int ans = 0;
  rep(i,2019){
    ans += a[i]*(a[i]-1)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3708
#include <iostream>

int tax(int rate, int price)
{
    return static_cast<int>(price * (100 + rate) / 100);
}

int main()
{
    int x, y, s = 0;

    while (std::cin >> x >> y >> s && s > 0) {
        int max = 0;
        for (int i = 1; i < s; i++) {
            for (int j = i; j < s; j++) {
                if (tax(x, i) + tax(x, j) == s) {
                    if (tax(y, i) + tax(y, j) > max) {
                        max = tax(y, i) + tax(y, j);
                    }
                }
            }
        }
        std::cout << max << '\n';
        max = 0;
    }
    return 0;
}



Measured memory_bytes: 3072
N,K,Q = map(int,input().split())

import numpy as np

points=np.array([K]*N)
dis = np.array([0]*N)
for i in range(Q):
    a = int(input())
    a=a-1
    dis[a]+=1

points-=Q
points += dis

for j in points:
    if j>0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 16956
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f

int main()
{
    ll n,r;
    while(~scanf("%lld%lld",&n,&r))
    {
        if(10-n<=0)
            printf("%lld\n",r);
        else
            printf("%lld\n",r+100*(10-n));
    }
}


Measured memory_bytes: 256
N=int(input())
hlist=list(map(int,input().split()))

cnt=0
while(True):
  if max(hlist) == 0:
    break
  
  left = 0
  right = N-1
  
  maxh = max(hlist)
  inseq = False
  for i in range(N):
    if hlist[i] == maxh:
      if not inseq:
        inseq = True
        left = i
    else:
      if inseq:
        right = i-1
        break

  #print(left,right)
  for i in range(left,right+1):
    hlist[i] -= 1
  cnt += 1
  
print(cnt)

Measured memory_bytes: 3064
n = int(input())

aa = 0
bb = 0
cc = 0 

for i in range(n):
    a,b,c = map(int,input().split())
    aa,bb,cc = max(bb + a, cc + a),max(aa + b, cc + b),max(aa + c, bb + c)

print(max(aa,bb,cc))

Measured memory_bytes: 74476
#include <iostream>
using namespace std;
int main()
{
	int a,b,ans;
	cin >> a >> b;
	if(1<=a && 9>=a && 1<=b && 9>=b){
		ans = a*b;
	}
	else{
		ans = -1;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n - 1);
    vector<int> result(n, 0);
    for(int i = 0; i < n - 1; i++){
        cin >> a.at(i);
        result.at(a.at(i) - 1) += 1;
    }
    for(int i = 0; i < n; i++){
        cout << result.at(i) << endl;
    }

}

Measured memory_bytes: 4840
/*  -*- coding: utf-8 -*-
 *
 * 1609.cc: Look for the Winner!
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int M = 26;

/* typedef */

/* global variables */

int cs[MAX_N], vts[M];

/* subroutines */

/* main */

int main() {
  for (int n; scanf("%d", &n) > 0 && n > 0;) {
    for (int i = 0; i < n; i++) {
      char s[4];
      scanf("%s", s);
      cs[i] = s[0] - 'A';
    }

    memset(vts, 0, sizeof(vts));

    int k = 0, maxv = 0, maxc = -1;
    for (; k < n; k++) {
      vts[cs[k]]++;
      if (maxv < vts[cs[k]]) maxv = vts[cs[k]], maxc = cs[k];

      bool fin = true;
      for (int i = 0; fin && i < M; i++)
	if (i != maxc) {
	  int fv = vts[i] + n - k - 1;
	  fin = (maxv > fv);
	}
      if (fin) break;
    }

    if (k >= n) puts("TIE");
    else printf("%c %d\n", maxc + 'A', k + 1);
  }
  return 0;
}



Measured memory_bytes: 3156
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
void solve()
{
	bool flag=1;
	string s;
	cin>>s;
	int len=s.length();
	if(len%2==0) flag=0;
	else
	{
		string temp=s;
		reverse(temp.begin(),temp.end());
		if(temp!=s) flag=0;
		else
		{
			string t;
			int pos=(len-1)/2-1;
			int i;
			for(i=0;i<=pos;i++) t+=s[i];
			string temp=t;
			reverse(t.begin(),t.end());
			if(t!=temp) flag=0;
			else
			{
				string t;
				int pos=(len+3)/2-1;
				for(i=pos;i<s.length();i++) t+=s[i];
				string temp=t;
				reverse(t.begin(),t.end());
				if(t!=temp) flag=0;
			}
		}
		
	}
	if(flag) puts("Yes");
	else puts("No");
}
int main()
{
	solve();
	return 0;
}

Measured memory_bytes: 256
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
N, M = map(int, input().split())
A = list(map(int, input().split()))

# 使うマッチ棒の本数が等しい場合は大きい数だけ考えれば良い
A.sort(reverse=True)
s = set()
candidates = [] # [a, nums[a]]
for a in A:
  if nums[a] in s:
    continue
  s.add(nums[a])
  candidates.append([a, nums[a]])


dp1 = [0] * (N+1)
dp2 = [-1] * (N+1)
d = {}
for a, n in candidates:
  if n <= N:
    dp1[n] = 1
    dp2[n] = 0
    d[n] = a

for i in range(N+1):
  for a, n in candidates:
    if i >= n and dp1[i-n]:
      if dp1[i] < dp1[i-n] + 1:
        dp1[i] = dp1[i-n] + 1
        dp2[i] = i-n

ans = []
idx = N
while idx:
  next_idx = dp2[idx]
  ans.append(d[idx - next_idx])
  idx = next_idx

ans.sort(reverse=True)
print(''.join(list(map(str, ans))))

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

const int maxN = 2e5+5;
int A[maxN];
int n, k;

bool check(int cut){
    int curr = k;
    for(int i = 0; i < n; i++){
        curr -= A[i]/cut;
        if(A[i] % cut == 0) curr++;
        if(curr < 0) return false;
    }
    return true;
}

void solve(){
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> A[i];
    int p = 1, q = (*(max_element(A, A+n)));
    while(p != q){
        int m = (p+q)/2;
        if(check(m))
            q = m;
        else
            p = m+1;
    }
    cout << p << "\n";
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    bool multitest = false;
    //multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 4392
#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define REP(i, k, n) for (signed long long int i = (signed long long int)(k); i < (signed long long int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define loop(n) rep(looping, n);
#define rREP(i, k, n) for (signed long long int i = (signed long long int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) std::sort(all(x))
#define REV(x) std::reverse(all(x))
#define UNIQUE(x) x.erase(std::unique(all(x)), x.end())
#define MAX(x) *std::max_element(all(x))
#define MIN(x) *std::min_element(all(x))
#define LOWitr(x, n) std::lower_bound(all(x), n)
#define UPRitr(x, n) std::upper_bound(all(x), n)
#define cii(x) int x; std::cin >> x
#define cill(x) signed long long int x; std::cin >> x
#define cis(x) std::string x; std::cin >> x
#define co(x) std::cout << x << "\n"
#define pb push_back
#define mp std::make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) if(DEBUG) std::cout<<#x<<" : "<<(x)<<"\n"
using std::cin;
using std::cout;
using std::string;
using std::min;
using std::max;
using std::abs;
using std::next_permutation;
template<class T>using V = std::vector<T>;
template<class T>using VV = std::vector<std::vector<T>>;
template<class T>using Q = std::queue<T>;
template<class T>using PQ = std::priority_queue<T>;
template<class T,class U>using P = std::pair<T, U>;
template<class T,class U>using M = std::map<T, U>;
template<class T,class U>using UM = std::unordered_map<T, U>;
using LL = signed long long int;
using VL = V<LL>;
using VVL = V<VL>;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f; //1061109567
const LL LLINF = 0x3f3f3f3f3f3f3f3fLL; //4557430888798830399
const double PI = M_PI;
template<class T,class U>inline LL min(T a, U b){return std::min((LL)a, (LL)b);}
template<class T,class U>inline LL max(T a, U b){return std::max((LL)a, (LL)b);}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T>inline void vcin(T &v){for(auto&& i : v) std::cin >> i;}
template<class T>inline void dumpv(const T& v, std::ostream& os = std::cout){
    if(DEBUG){
        os<<"{";std::for_each(all(v),[&os](typename T::value_type p){os<<p<<',';});os<<"}\n";
    }
}

void Main(){
    cis(a);
    if ('a' <= a[0] && a[0] <= 'z'){
        co("a");
    }else{
        co("A");
    }
}


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

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <set>
#include <math.h>
using namespace std;
int n;
set<int> ans,sosu;
vector<int> v;
void make_gd(){
	v.clear();
	for(int i = 7;i <= 50000;i += 7){
		if(i != 7){
			v.push_back(i-6);
		}
			v.push_back(i-1);
	}

	sosu.clear();
	sosu.insert(6);
	bool flag;
	for(int i = 0;i < v.size();i++){
		flag = true;
		for(set<int>::iterator ite = sosu.begin();ite != sosu.end();ite++){
			if(v[i]%(*ite) == 0)flag = false;
		}
		if(flag){
			sosu.insert(v[i]);
		}
	}
}

void check(int x){
	int a = x;
	ans.clear();
	for(set<int>::iterator ite = sosu.begin();ite != sosu.end();ite++){
		if(a < *ite)break;
		if(a%(*ite) == 0){
			ans.insert(*ite);
//			a = a/(*ite);
//			ite = sosu.begin();
		}
	}
	if(ans.empty())ans.insert(x);
}

int main(){
	make_gd();
	while(1){
		cin >> n;
		if(n == 1)break;
		check(n);
		cout << n << ':';
		for(set<int>::iterator ite = ans.begin();ite != ans.end();ite++){
			cout << " " <<*ite;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1592
#include <iostream>
using namespace std;
#define MAX 100
void print(int A[],int n){
		for(int i=0;i<n;i++){
			if(i>0)
				cout<<" ";
			cout<<A[i];	
		}
		cout<<endl;	
}
int main(){
	int n,A[MAX],v,j;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>A[i];
	print(A,n);	
	for(int i=1;i<n;i++){
		v=A[i];
		j=i-1;
		while(j>-1 && A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		print(A,n);	
	}
	
	return 0;
}


Measured memory_bytes: 3116
nums = input().split()
W = int( nums[0])
H = int( nums[1])
x = int( nums[2])
y = int( nums[3])
r = int( nums[4])
 
if (x - r) >= 0 and (x + r) <= W:
    if (y - r) >= 0 and (y + r) <= H:
        print( "Yes")
    else:
        print( "No")
else:
    print( "No")

Measured memory_bytes: 7668
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

// AOJ 0036
public class Main {

	static Scanner sc = new Scanner(System.in);
	static final double EPS = 1e-10;
	public static void main(String[] args) {
		while (sc.hasNext()) {
			char[][] cs = new char[20][20];
			int[][][] fg = {
				{{1, 0}, {0, 1}, {1, 1}},
				{{1, 0}, {2, 0}, {3, 0}},
				{{0, 1}, {0, 2}, {0, 3}},
				{{1, 0}, {1, -1}, {2, -1}},
				{{0, 1}, {1, 1}, {1, 2}},
				{{1, 0}, {1, 1}, {2, 1}},
				{{1, 0}, {0, 1}, {1, -1}}
			};
			for (int i = 0; i < 20; i++) fill(cs[i], '0');
			int i,j,k,l,x,y;
			for (i = 2; i < 10; ) {
				String buf = sc.next();
				if (buf.equals("")) break;
				for (j = 2; j < 10; j++) 
					cs[i][j] = buf.charAt(j - 2);
				
				i++;
			}
			if (i == 0) break;
			for (i = 2; i < 10; i++) {
				for (j = 2; j < 10; j++) {
					if (cs[i][j] == '1') {
						for (k = 0; k < 7; k++) {
							for (l = 0; l < 3; l++) 
								if (cs[i + fg[k][l][0]][j + fg[k][l][1]] == '0') break;

							if (l == 3) 
								System.out.println((char)('A' + k));
						}
					}
				}
			}
		}
	}
}

Measured memory_bytes: 12000
object Main {
  def main(args: Array[String]): Unit = {
    import java.util.Scanner
    val in = new Scanner(System.in)
    val n = in.nextInt
    val odd = n / 2 + (if (n % 2 != 0) 1 else 0)
    val answer = odd / n.toDouble
    println(answer)
  }
}

Measured memory_bytes: 27336
#include<stdio.h>
#include<ctype.h>
main(){
  int i;
  char string;

//  scanf("%s",string);
  i=0;
  scanf("%c",&string);
  while(string!='\n'){
    if(isupper(string)!=0) printf("%c",tolower(string));
    else printf("%c",toupper(string));
    i++;
    scanf("%c",&string);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 1808
#include<iostream>
using namespace std;
const int maxn=10000;
int main()
{
	long long a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int flag=1;
	int cnt=0;
	int h=0,i;
	if(a%2==1||b%2==1||c%2==1){
		flag=0;
		printf("0\n");
		return 0;
	}
	//if(a==b&&b==c){
//			flag=0;
	//	printf("-1\n");
//	}
	int A,B,C;
	A=a;B=b;C=c;
	for(i=0;i<maxn;i++){	
		a=B/2+C/2;
		b=A/2+C/2;
		c=B/2+A/2;
		cnt++;
		A=a;B=b;C=c;
		h=1;
		if(a%2==1||b%2==1||c%2==1){
			break;
		}
	}
	if(i==maxn){
		printf("-1\n");
	}
	if(h==1&&i!=maxn)
	printf("%d\n",cnt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    int A[N+1];
    rep2(i, 1, N){
        int P;
        cin >> P;
        A[P] = i;
    }
    int len = 0, i = 1;
    while(i <= N){
        int j = 0;
        while(i+j < N && A[i+j] < A[i+j+1]) j++;
        len = max(len, j+1);
        i += j+1;
    }
    cout << N-len << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front
#define ll long long

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    multiset<int> ms;
    int x,n,val,ans=INT_MAX,num=0;

    cin>>x>>n;
    for(int i=0; i<n; i++){
        cin>>val;
        ms.insert(val);
    }
    for(int i=-200; i<=200; i++){
        if(ms.find(i) == ms.end()){
            if(abs(i-x) < ans){
                ans = abs(i-x);
                num = i;
            }
        }
    }

    cout << num << "\n";

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;

const int maxn=2e5+7;

const int N=1e5+10;
vector <int> E[N];
int color[N],cnt[3];

int main(){
    queue <int> que;
    int n,x,y;
    cin>>n;
    for(int i=1;i<n;i++){
        cin>>x>>y;
        E[x].push_back(y);
        E[y].push_back(x);
    }
    color[1]=1,color[n]=2;//标记颜色
    que.push(1);//1点先手
    que.push(n);//n点后手
    while(!que.empty()){
        int tmp=que.front();
        que.pop();
        cnt[color[tmp]]++;//记录标记颜色的数量
    //遍历相邻的所有点,因为把对手堵住后这些点还是需要染色的.
        for(int i=0;i<E[tmp].size();i++){
            int v=E[tmp][i];
            if(color[v]) continue;
            color[v]=color[tmp];
            que.push(v);
        }
    }
    //因为1点先手,所以数量相同的时候,1点会输.
    if(cnt[2]>=cnt[1]) cout<<"Snuke"<<endl;
    else cout<<"Fennec"<<endl;
    return 0;
}


Measured memory_bytes: 6272
A, B, K = [int(i) for i in input().split()]
result_list = []

def divisor_list(n):
    i = 1
    array = []
    while i * i <= n:
        if n % i == 0:
            array.append(i)
            array.append(n//i)
        i += 1
    array = list(set(array))
    return array


for i in range(1, min(A, B) + 1):
    if A % i == 0 and B % i == 0:
        result_list.append(i)

print(sorted(result_list)[-K])

Measured memory_bytes: 9016
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Aman
 */


#include<bits/stdc++.h>

using namespace std;

#include <iostream>


#define ll   long long
#define F first
#define S second
#define pll pair<ll, ll>

void __print(int x) { cout << x; }

void __print(long x) { cout << x; }

template<typename T, typename V>
void __print(const pair<T, V> &x) {
    cout << '{';
    __print(x.first);
    cout << ',';
    __print(x.second);
    cout << '}';
}

template<typename T>
void __print(const T &x) {
    int f = 0;
    cout << '{';
    for (auto &i: x) cout << (f++ ? "," : ""), __print(i);
    cout << "}";
}

void _print() { cout << "]\n"; }

template<typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cout << ", ";
    _print(v...);
}


#ifdef LOCAL
#else
#define dbg(x...)
#endif


class BGoToJail {
public:

    void solve2(std::istream &cin, std::ostream &cout) {
        ll n, ans = 0, cnt = 0;
        cin >> n;
        vector<pll > v(n);
        for (auto &i:v) cin >> i.F >> i.S;
        pll prv = {-1, -1};
        for (auto i:v)
            if (i.F == i.S) cnt++;
            else ans |= (cnt >= 3), cnt = 0;

        cout << ((ans | (cnt >= 3)) ? "Yes" : "No");
    }

    void solve(std::istream &cin, std::ostream &cout) {
        ll t = 1;
//            cin >> t;
        while (t--) {
            solve2(cin, cout);
        }
    }

};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    BGoToJail solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main(){
  int m,nmin,nmax;
  while(cin>>m>>nmin>>nmax,m){
    int score[m];
    int Maxnum=0;
    for(int i=0;i<m;i++)
      cin>>score[i];
    for(int i=nmin,Max=0;i<=nmax;i++)
      if(score[i-1]-score[i]>=Max){
	Max=score[i-1]-score[i]; Maxnum=i;
      }
    cout<<Maxnum<<endl;
  }
}


Measured memory_bytes: 1160
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n"),t=[],n=0;n<5;n++)t.push(Number(r[n]));for(var o=Number(r[5]),u=0;u<5;u++)for(var i=4;i>u;i--){var f=t[i]-t[u];if(Math.abs(f)>o)return void console.log(":(")}console.log("Yay!")}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 7372