akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
s = gets.chomp
rL = 0 #require_Left
rR = 0 #require_Right
n.times do |i|
  if s[i] == '('
    rR += 1
  else
    if rR == 0
      rL += 1
    else
      rR -= 1
    end
  end
end
rL.times do
  s = "(" + s
end
rR.times do
  s = s + ")"
end
puts s

Measured memory_bytes: 14320
#include <iostream>
#include <queue>
#include <vector>
#include <utility>

using namespace std;

#define nil -1

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

vector<vector <char>> map;
vector<pair<int,int>> start;
int w,h;

int bfs(){
	queue<pair<int,int>> que;
	vector<vector <int>> d;
	d.resize(h);
	for(int i=0;i<h;++i){
		d[i].resize(w);
		for(int j=0;j<w;++j){
			d[i][j] = nil;
		}
	}
	for(int i=0;i<start.size();++i){
		d[start[i].first][start[i].second] = 0;
		que.push(start[i]);
	}
	while(que.size()){
		pair<int,int> p = que.front();
		que.pop();
		for(int i=0;i<4;++i){
			int ny = p.first + dy[i];
			int nx = p.second + dx[i];
			if(nx >= 0 && nx < w && ny >= 0 && ny < h){
				if(map[ny][nx] == '.' && d[ny][nx] == nil){
					d[ny][nx] = d[p.first][p.second] + 1;
					que.push(make_pair(ny,nx));
				}
			}
		}
	}
	int res = 0;
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			if(res < d[i][j])res = d[i][j];
		}
	}
	return res;
}

int main(){
	cin >> h >> w;
	map.resize(h);
	for(int i=0;i<h;++i){
		map[i].resize(w);
		for(int j=0;j<w;++j){
			cin >> map[i][j];
			if(map[i][j] == '#')start.push_back(make_pair(i,j));
		}
	}
	cout << bfs() << endl;
}

Measured memory_bytes: 21244
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s[500];
int row[]= {1,0,-1,0,1,-1,1,-1};
int colm[]={0,1,0,-1,1,-1,-1,1};
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,m;
    cin>>n>>m;
    for(int i=0; i<n; i++)
        cin>>s[i];
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            if(s[i][j]=='.')
            {
                int cnt=0;
                for(int k=0; k<8; k++)
                {
                    int u=i+row[k];
                    int v=j+colm[k];
                    if(0<=u && u<n && 0<=v && v<m)
                    {
                        if(s[u][v]=='#')
                            cnt++;
                    }
                }
                s[i][j]=(cnt+48);
            }

        }
    }
    for(int i=0; i<n; i++)
        cout<<s[i]<<endl;
    return 0;
}


Measured memory_bytes: 3644
import os
import sys

def main():
    A , B , K = map(int , input().split())
    if K >= A :
        KK = K - A
        A = 0

        if KK >= B :
            B = 0
        else :
            B = B - KK
    else :
        A = A - K
    print (str(A) + " " + str(B))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        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")
    };
}
fn main() {
    input!(n: usize, k: usize, d: [i32; k]);
    let mut answer = n;
    while d
        .iter()
        .map(|item| format!("{}", answer).contains(&item.to_string()))
        .fold(false, |acc, second| acc || second)
    {
        answer += 1;
    }
    println!("{}", answer);
}


Measured memory_bytes: 4352
n, k = map(int, input().split())
A = list(map(int, input().split()))

s = sum(A)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

G = make_divisors(s)

from itertools import accumulate

for g in G:
    B = [a%g for a in A]
    B.sort()
    B = [0] + B
    B = list(accumulate(B))
    p = 0
    q = 0
    for i in range(n-1):
        p = B[i+1]
        q = g*(n-1-i)-(B[-1]-B[i+1])
        if max(p, q) <= k and (p-q)%g == 0:
            break
    else:
        continue
    break
print(g)

Measured memory_bytes: 42220
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
bool judge(int x) {
    int head = 10000;
    rep(i, 2) {
        if(x/head != x%10) return false;
        x %= 10000;
        head = 100;
        x /= 10; 
    }
    return true;
}
int main() {
    int a, b; cin >> a >> b;
    int cnt = 0;
    for(int i=a; i<=b; i++) {
        if(judge(i)) cnt++;
    }
    cout << cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define N 100005
#define inf 1e18
#define mem(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << (#x) << " = " << x << endl;
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;

using namespace std;

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll mod = 1e9+7;

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return (temp*temp)%mod;
    else
        return (((x*temp)%mod)*temp)%mod;
}


/* nCr % mod
ll fact[6*N];
ll inv[6*N],invfac[6*N];
ll mod = 998244353;

void factorial()
{
    fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=5*N + 10;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
        invfac[i] = (invfac[i-1]*inv[i])%mod;
    }
}*/

vector<ll> primes;

void Sieve(int n)
{
    vector<bool> prime(n+1,true);
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primes.push_back(p);
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int Nmax = 1e6 + 6;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int x;
    cin >> x;
    if(x>=30)
        cout << "Yes";
    else 
        cout << "No";
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;

ll mod = 1000000007;

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

ll modcmb(int n, int r) {
    ll ans = 1;
    rep(i, r) {
        ans *= (n-i) * modpow(i+1, mod-2) % mod;
        ans %= mod;
    }
    return ans;
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    ll all_sum = modpow(2, n);
    ll exclusion = modcmb(n, a) + modcmb(n, b);
    all_sum = (all_sum+mod)%mod;
    exclusion = (exclusion+mod)%mod;
    ll ans = all_sum - exclusion;
    ans = (ans+mod)%mod;
    cout << ans-1 << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

ll problemCount(const vector<ll>& P, ll bit) {
    ll cnt = 0;
    for (ll i = 0; (bit >> i) > 0; ++i) {
        if (bit >> i & 1) {
            cnt += P[i];
        }
    }

    return cnt;
}

ll normalPoll(const vector<ll>& P, ll bit) {
    ll poll = 0;
    for (ll i = 0; (bit >> i) > 0; ++i) {
        if (bit >> i & 1) {
            poll += 100 * (i + 1) * P[i];
        }
    }
    return poll;
}

ll bonusPoll(const vector<ll>& C, ll bit) {
    ll poll = 0;
    for (ll i = 0; (bit >> i) > 0; ++i) {
        if (bit >> i & 1) {
            poll += C[i];
        }
    }
    return poll;
}

ll rightMostBitIndex(ll bit) {
    ll i = 0;
    while (bit >> i) {
        ++i;
    }

    return i - 1;
}

int main() {
    ll D, G;
    cin >> D >> G;

    vector<ll> P(D);
    vector<ll> C(D);

    for (ll i = 0; i < D; ++i) {
        cin >> P[i];
        cin >> C[i];
    }

    ll ans = 1 << 30;

    for (ll i = 0; i < (1 << D); ++i) {
        ll cnt = problemCount(P, i);
        ll score = normalPoll(P, i) + bonusPoll(C, i);

        ll j = rightMostBitIndex(((1 << D) - 1) & ~i);

        for (ll k = 0; k < P[j]; ++k) {
            if ((score + 100 * (j + 1) * k) >= G) {
                ans = min(ans, cnt + k);
                break;
            }
        }
    }

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

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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  map<int, int> a;
  range(i, 0, n) {
    int x;
    cin >> x;
    a[x]++;
  }
  int sz = a.size();
  if(sz > 3) {
    cout << "No";
    return 0;
  }
  if(sz == 1) {
    if(a.begin()->first) {
      cout << "No";
      return 0;
    }
  }
  if(sz == 2) {
    int x = a.begin()->first, sx = a[x];
    int y = next(a.begin())->first, sy = a[y];
    if(x || sy != 2 * sx) {
      cout << "No";
      return 0;
    }
  }
  if(sz == 3) {
    int cur = 0;
    for(auto it : a) {
      cur ^= it.first;
      if(it.second != a.begin()->second) {
        cout << "No";
        return 0;
      }
    }
    if(cur) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 3840
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <numeric>

int main()
{
  long long n;
  scanf("%lld", &n);
  long long a[200000];
  for (long long i = 0; i < n; ++i)
  {
    scanf("%lld", a + i);
    a[i] -= (i + 1);
  }
  std::sort(a, a + n);
  long long b = a[n / 2];
  long long ans = 0;
  for (int i = 0; i < n; ++i)
  {
    ans += std::abs(a[i] - b);
  }
  printf("%lld\n", ans);
  return 0;
}


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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<bool> q(n, false);
	vector<int> pen(n, 0);
	int ac = 0;
	for (int i = 0; i < m; i++) {
		int p_in;
		string s_in;
		cin >> p_in >> s_in;
		if (q.at(p_in - 1) == false) {
			if (s_in == "AC") {
				ac++;
				q.at(p_in - 1) = true;
			} else if (s_in == "WA") {
				pen.at(p_in - 1) += 1;
			}
		}
	}
	int wa = 0;
	for (int i = 0; i < n; i++) {
		if (q.at(i) == true) {
			wa += pen.at(i);
		}
	}

	cout << ac << " " << wa << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }


int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    map<ll, int> cnt;
    rep(i, n) cnt[a[i]]++;

    int ans = 0;
    map<ll, int> m;
    rep(i, n) {
        if (m[a[i]] > 0) continue;
        ll times = 1;
        if (cnt[a[i]] < 2) ans++;
        while (times * a[i] <= 1000000) {
            m[times * a[i]]++;
            times++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 79692
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([[1, 2], [5, 5], [-2, 8]]), 1)

    def test_2(self):
        self.assertEqual(think([[-3, 7, 8, 2], [-12, 1, 10, 2], [-2, 8, 9, 3]]), 2)

    def test_3(self):
        self.assertEqual(think([[1], [2], [3], [4], [5]]), 10)


def solve():
    x = read()
    result = think(x)
    write(result)


def read():
    n, d = read_int(2)
    x = []
    for _ in range(n):
        if d == 1:
            x.append([read_int(1)[0]])
        else:
            x.append(read_int(d))
    return x


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(x):
    n = len(x)
    max_d = 10
    max_x, min_x = 20, -20
    set_of_square_of_dist = create_set_of_square_of_dist(max_d, max_x, min_x)

    count = 0
    for i in range(n):
        for j in range(i + 1, n):
            square_of_dist = calc_square_of_dist(x[i], x[j])
            if square_of_dist in set_of_square_of_dist:
                count += 1
    return count


def write(result):
    print(result)


def create_set_of_square_of_dist(max_d, max_x, min_x):
    max_diff = max_x - min_x
    max_square_of_sum = (max_diff ** 2) * max_d

    set_of_square_of_dist = set()
    i = 0
    while True:
        if i ** 2 > max_square_of_sum:
            break
        set_of_square_of_dist.add(i ** 2)
        i += 1
    return set_of_square_of_dist


def calc_square_of_dist(x_1, x_2):
    diff_x = [0 for x in range(len(x_1))]
    for i in range(len(x_1)):
        diff_x[i] = x_1[i] - x_2[i]

    return sum([x ** 2 for x in diff_x])


if __name__ == '__main__':
    # unittest.main()
    solve()

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

int main()
{
    int N,Y;
    vector <int> ans={-1,-1,-1};
    cin >> N >>Y;
    for (int i=0;i<=Y/10000;i++)
    {
        for (int j=0;j<=(Y-10000*i)/5000;j++)
        {
            if ((i+j+(Y-10000*i-5000*j)/1000)==N)
            {
                ans[0]=i;
                ans[1]=j;
                ans[2]=(Y-10000*i-5000*j)/1000;
            }
        }
    }
    cout << ans[0] << " "<< ans[1] << " " << ans[2] << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
    int main(){
    int A,B;
    cin >> A >> B;
    if(A==1){A+=13;}
    if(B==1){B+=13;}
    if(A > B){
        cout << "Alice" << endl;
    }
    else if(A < B){
        cout << "Bob" << endl;
    }
    if(A == B){
        cout << "Draw" << endl;
    }
    return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN	100005
int n, l, t;
int x[MAXN], y[MAXN], type[MAXN], ans[MAXN];
int func(int x, int type) {
	if (type == 1) x += t;
	else x -= t;
	return (x % l + l) % l;
}
int main() {
	//freopen("008.in", "r", stdin);
	//freopen("008.out", "w", stdout);
	scanf("%d%d%d", &n, &l, &t);
	for (int i = 1; i <= n; i++)
		scanf("%d%d", &x[i], &type[i]);
	for (int i = 1; i <= n; i++)
		y[i] = func(x[i], type[i]);
	sort(y + 1, y + n + 1);
	int start = 1;
	for (int i = 1; i <= n; i++)
		if (type[i] == 1) {
			int tmp = l - x[i];
			if (tmp > t) continue;
			tmp = t - tmp;
			start -= 1 + tmp / l;
			start %= n;
		} else {
			int tmp = x[i];
			if (tmp >= t) continue;
			tmp = t - tmp - 1;
			start += 1 + tmp / l;
			start %= n;
		}
	start = (start % n + n) % n;
	if (start == 0) start = n;
	for (int i = 1; i <= n; i++) {
		ans[start] = y[i];
		start = start % n + 1;
	}
	for (int i = 1; i <= n; i++)
		printf("%d\n", ans[i]);
}

Measured memory_bytes: 2816
/**************************
*                         *
*  Nothing Is Impossible  *
*                         *
**************************/
#include <algorithm>
#include <pthread.h>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <thread>
#include <math.h>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <set>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for(int64_t i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
using namespace std;

void solve(){
	string s,t;	cin >> s >> t;
	Rep(i,0,s.size()){
		if(s[i] != t[i]){
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

int main(){
    ios::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //int t;  cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string S;
  cin >> S;

  vector<vector<ll>> dp(S.size(), vector<ll>(13, 0));

  // initialize
  if(S[0] == '?'){
    for(int i = 0; i <= 9; i++){
      dp[0][i] = 1;
    }
  } else {
    int tmp = S[0] - '0';
    dp[0][tmp] = 1;
  }

  for(int i = 0; i < S.size()-1; i++){
    if(S[i+1] != '?'){
      int tmp = S[i+1] - '0';
      for(int j = 0; j <= 12; j++){
        dp[i+1][(10*j+tmp)%13] += dp[i][j];
        dp[i+1][(10*j+tmp)%13] %= MOD;
      }
    } else { 
      for(int k = 0; k <= 9; k++){
        for(int j = 0; j <= 12; j++){
          dp[i+1][(10*j+k)%13] += dp[i][j];
          dp[i+1][(10*j+k)%13] %= MOD;
        }
      }
    }
  }

  cout << dp[S.size()-1][5] << endl;

}


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

using namespace std;

struct node
{
    int order;
    int num;
}stu[100005];

bool cmp(node &a,node &b)
{
    return a.num<b.num;
}

int main()
{
    int n,i;
    cin>>n;
    for(i=0;i<n;i++)
    {
        scanf("%d",&stu[i].num);
        stu[i].order=i;
    }
    sort(stu,stu+n,cmp);
    for(i=0;i<n-1;i++)
        printf("%d ",stu[i].order+1);
    printf("%d\n",stu[n-1].order+1);
    return 0;
}


Measured memory_bytes: 1536
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
// using ll = long long;
// using vi = vector<int>;
// using vvi = vector<vi>;
// using vl = vector<long long>;
// using vvl = vector<vl>;
// using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int kaijo (int a, int result) {
  if (a == 0) {
    return result;
  } else {
    return kaijo(a-1, result * a);
  }
}

int kaijo(int a) {
  return kaijo(a,1);
}

ll kaijo_ll (ll a, ll result) {
  if (a == 0) {
    return result;
  } else {
    return kaijo_ll(a-1, result * a);
  }
}

ll kaijo_ll(ll a) {
  return kaijo_ll(a,1);
}

int main () {
  int n;
  cin >> n;
  std::vector<int> a(n);
  double bunbo=0.0;
  rep(i,n) {
    cin >> a[i];
    bunbo += (double) 1/a[i];
  }
  double result = 1/ bunbo;

  printf("%.20lf\n", result);
}


Measured memory_bytes: 256
# ABC 079 C Train Ticket
S = input()

N = []; M=[];
for i in range(4):
    N.append(int(S[i]))
    N.append(-1 * int(S[i]))
    M.append("+")
    M.append("-")
    
def solve(M,N):
    for i in range(2):
        for j in range(2):
            for k in range(2):
                total = N[0]+N[2+i]+N[4+j]+N[6+k]
                if (total == 7):
                    ans = str(N[0])+M[2+i]+str(N[2])+M[4+j]+str(N[4])+M[6+k]+str(N[6])
                    return ans+"=7"

print(solve(M,N))

Measured memory_bytes: 3064
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I() + 1
A = LI()


fac = [1] * (n + 1)
inv = [1] * (n + 1)
for j in range(1, n + 1):
    fac[j] = fac[j-1] * j % mod


inv[n] = pow(fac[n], mod-2, mod)
for j in range(n-1, -1, -1):
    inv[j] = inv[j+1] * (j+1) % mod


def comb(n, r):
    if r > n or n < 0 or r < 0:
        return 0
    return fac[n] * inv[n - r] * inv[r] % mod


D = defaultdict(lambda:-1)
for i in range(n + 1):
    if D[A[i]] != -1:
        l = D[A[i]]
        r = n - i - 1
        break
    else:
        D[A[i]] = i


for k in range(1, n + 1):
    print((comb(n, k) - comb(l + r, k - 1)) % mod)

Measured memory_bytes: 60820
s = input()
f = 0
a = 0; b = 0; c = 0
if len(s)==3 and s[0]==s[2]:
    print('Yes')
else :
    
    for i in range(len(s)//2):
        if s[i]==s[-1-i]:
            a += 1
        if a == len(s)//2:
            f += 1
    for i in range(len(s)//4):
        if s[i]==s[(len(s)-1)//2-1-i]:
            b += 1
        if b == len(s)//4:
            f += 1
        if s[(len(s)+3)//2-1+i]==s[len(s)-1-i]:
            c += 1
        if c == len(s)//4:
            f += 1
    print('Yes' if f == 3 else 'No')

Measured memory_bytes: 38384
def isstrong(s):
    n = len(s)
    if s != s[::-1]: return False
    s1 = s[0:(n - 1)//2]
    s2 = s[(n + 1) // 2:]
    #print(s1)
    #print(s2)
    if s1 != s1[::-1]: return False
    if s2 != s2[::-1]: return False
    return True

s = input()
if isstrong(s):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
S = input()
T = input()

index = 0
tmp = 0
ans = float('inf')

loop_time = len(S) - len(T) + 1
T_len = len(T)
for i in range(loop_time):
    S_new = S[i:T_len+i]
    tmp = T_len
    for s,t in zip(S_new,T):
        if s == t:
            tmp -= 1
    ans = min(ans,tmp)
print(ans)

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

int main(){
  int n;
  cin>>n;
  int a[n],b[n],i;
  for(i=0;i<n;i++){
    cin>>a[i];
    b[a[i]-1]=i+1;
  }
  sort(a,a+n);
  for(i=0;i<n;i++){
    cout<<b[a[i]-1]<<' ';
  }
  cout<<endl;
}


Measured memory_bytes: 1536
import java.util.*;

public class Main {

    public static void main(String[] args) {
//        long startTime = System.currentTimeMillis();
        Scanner scanner = new Scanner(System.in);
        int r = scanner.nextInt();
        int D = scanner.nextInt();
        long x2000 = scanner.nextLong();
        scanner.close();

        // check
        Map<Integer, Long> map = new HashMap<>();
        map.put(2000, x2000);

        for (int i = 2001; i <= 2010; i++) {
            long x = r * map.get(i - 1) - D;
            map.put(i, x);
            System.out.println(x);
        }


//        System.out.println(System.currentTimeMillis() - startTime);
    }


}


Measured memory_bytes: 21844
n=int(input())
M=[list(map(int,input().split()))for _ in[0]*n]
d=[0]+[1e4]*~-n
b=[1]*n
a=0
while 1:
 u=-1
 for i in range(n):
  if b[i]and(u<0 or d[i]<d[u]):u=i
 if u<0:break
 b[u]=0
 a+=d[u]
 for v in range(n):
  t=M[u][v]
  if t+1 and d[v]>t:d[v]=t
print(a)


Measured memory_bytes: 5900
/* HARE KRSNA HARE KRSNA KRSNA KRSNA HARE HARE
    HARE RAMA HARE RAMA RAMA RAMA HARE HARE  */

#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define ff first
#define ss second
#define pp pop_back
#define pf pop_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define b_s binary_search
#define all(x) x.begin(),x.end()
#define test ll t; cin>>t; while(t--)
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define rloop(i,s,n) for(ll i=s;i>=n;i--)
#define fill(a,value) memset(a,value,sizeof(a))

#define debug2(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define debug4(a)  for(auto x : a)  cout<<x.ff<<" "<<x.ss<<nl;
#define debug1(a,n) loop(i,0,n)  cout<<a[i]<<" ";  cout<<nl;
#define debug3(a,n,m)  loop(i,0,n){ loop(j,0,m)	cout<<a[i][j]<<" ";	cout<<nl; }

typedef long long ll;
typedef long double ld;

typedef stack<ll> sll;
typedef queue<ll> qll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<ll, pll> ppll;
typedef vector<vector<ll>> vvll;
typedef priority_queue<ll> pqll;

const ll mod = 998244353; //1000000007;
const ld pi =  acos((ld) - 1);	//3.1415926535;

ll num_generator() 		{   return rand() % 1000;	}
void array_generator(ll a[], ll n)
{  loop(i, 0, n)	a[i] = rand() % 100;  }

void solve()
{
	ll n;	cin >> n;
	ll a[n];	loop(i, 0, n)		cin >> a[i];
	ll cnt = 0;
	loop(i, 0, n)
	{
		if (i % 2 == 0 && a[i] % 2 != 0)		cnt++;
	}
	cout << cnt << nl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// test
	solve();

	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;

int dp[2][1 << 22];

int main(void){
	while(1){
		int n, m; cin >> n >> m;
		if(!n && !m) break;

		int b[505][505]={0};
		for(int i=1; i<=n; i++){
			for(int j=0; j<m; j++){
				char c; cin >> c;
				b[i][j] = c - '0';
			}
		}

		int ans = 0;
		if(n <= 22){
			int S = 1 << n;
			for(int i=0; i<S; i++){
				int cnt = 0;
				int ingredient[501]={0};//材料
				for(int j=1; j<=n; j++){
					if((i & (1<<(j-1))) == 0) continue;
					cnt++;
					for(int k=0; k<m; k++) ingredient[k] ^= b[j][k];
				}
				bool flag = true;
				for(int j=0; j<m; j++){
					if(ingredient[j] == 1){
						flag = false;
						break;
					}
				}
				if(flag) ans = max(ans, cnt);
			}
		}else{
			int B[501]={0};
			for(int i=1; i<=n; i++){
				for(int j=0; j<m; j++){
					B[i] |= (b[i][j] << j);
				}
			}

			int S = 1 << m;
			for(int i=0; i<S; i++) dp[0][i] = dp[1][i] = INT_MIN;
			dp[0][0] = 0;
			for(int i=0; i<n; i++){
				for(int j=0; j<S; j++){
					dp[(i+1)%2][j^B[i+1]] = max(dp[(i+1)%2][j^B[i+1]], dp[i%2][j] + 1);
					dp[(i+1)%2][j] = max(dp[(i+1)%2][j], dp[i%2][j]);
				}
			}
			ans = dp[n%2][0];
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 20456
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
char str[max_n];
void reads(string& s){scanf(" %s",str);s=str;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
ll a;
string b;
int x[2],tot=0;
int main(){
    scanf("%lld",&a);
    reads(b);
    string res;
    for(auto c:b){
        if(c=='.'){
            x[tot++]=stoi(res);
            res="";
        }
        else res+=c;
    }
    x[tot++]=stoi(res);
    ll ans=a*x[0]+a*x[1]/100;
    printf("%lld\n",ans);
    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    cout << fixed << setprecision(15);
    
    ll M, K;
    cin >> M >> K;

    // M=0のときはK=0のみが解となる
    if(M == 0){
        if(K == 0){
            cout << 0 << " " << 0 << endl;
            return 0;
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }

    // M=1のときはK=0のみが解となる
    if(M == 1){
        if(K == 0){
            cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
            return 0;
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }

    if(K >= pow(2, M)){
        cout << -1 << endl;
        return 0;
    }

    for(ll i=0; i<pow(2,M); i++){
        if(i == K) continue;
        cout << i << " ";
    }
    cout << K << " ";
     for(ll i=pow(2,M) - 1; i>=0; i--){
        if(i == K) continue;
        cout << i << " ";
    }
    cout << K << endl;;

    return 0;
}

Measured memory_bytes: 4064
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a*b>=c*d){
    print(a * b);
  }
  else{
    print(c * d);
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  double a,b;
  int n,m;
  int i;
  cin>>a>>b;
  
  n=10*b;
  m=25*(a+1);
  
  for(i=0;i<=10;i++)
  {
    if(12.5*a<=n+i && n<12.5*(a+1)&& i!=10)
      break;
  }
  if(i==11)
    cout<<-1<<endl;
  else
    cout<<n+i<<endl;
  //cout<<i;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    int a, b, c, d, sum;
    cin >> a >> b >> c >> d;
  	sum = 0;
    if (a >= b ) sum = sum + b;
  	else sum = sum + a;
    if (c >= d ) sum = sum + d;
  	else sum = sum + c;
    cout << sum << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    double n, m, d;
    cin >> n >> m >> d;
    double ret = (m - 1) * 2.0 * (n - d) / (n * n);
    if (abs(d) < 1e-9)
        ret /= 2.0;
    cout << fixed << setprecision(10) << ret << "\n";
    return 0;
}

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

int main()
{
    int a;
    std::cin>> a;
    double b;
    std::priority_queue<double, std::vector<double>, std::greater<double> > que;
    
    for( int i = 0; i < a; i++ )
    {
        std::cin>> b;
        que.push( b );
    }

    long double c = que.top();
    que.pop();

    while( !que.empty() )
    {
        c = ( c + que.top() ) / 2;
        que.pop();
    }


    std::cout<< c;
}


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

namespace AtCoder
{
    public class Code20171216B
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            var ret = funcMain(s1, s2);
            Console.WriteLine(ret);
        }

        static public string funcMain(string arg1, string arg2)
        {
            int maxlen = Math.Max(arg1.Length, arg2.Length);
            var list1 = new string(arg1.ToCharArray().OrderBy(o => o).ToArray());
            var list2 = new string(arg2.ToCharArray().OrderByDescending(o => o).ToArray());
            string ret;

            if (list1.CompareTo(list2) < 0)
                ret = "Yes";
            else
                ret = "No";

            return ret;
        }
    }
}

Measured memory_bytes: 11488
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
//#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}

ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

int32_t main(){
  fastio;
  int n;
  cin>>n;
  n%=10;
  if(n==2 or n==4 or n==5 or n==5 or n==7 or n==9){
    cout<<"hon"<<endl;
  }else if(n==3){
    cout<<"bon"<<endl;
  }else cout<<"pon"<<endl;
  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 3636
#include <iostream>
#define ll long long
using namespace std;
int main() {
  ll n; cin >> n;
  int res = 0;
  for (ll i=2; i<1000010; i++) {
    int cnt = 0;
    while (n%i == 0) {
      cnt++;
      n /= i;
    }
    for (int j=1;;j++) {
      if ( cnt - j < 0) break;
      res++; cnt -= j;
    }
  }
  if (n > 1) res++;
  cout << res << endl;
}

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll a[n];
    int cnt = 0;
    ll mmin = INF;
    for(int i = 0; i < n; i++){
        ll tmp;
        cin >> tmp;
        a[i] = tmp;
        mmin = min(mmin,abs(tmp));
        if(tmp < 0){
            cnt++;
        }
    }
    ll ans = 0;
    if(cnt % 2 == 0){
        for(int i = 0; i < n; i++){
            ans += abs(a[i]);
        }
    }else{
        for(int i = 0; i < n; i++){
            ans += abs(a[i]);
        }
        ans -= (2 * mmin);
    }
    cout << ans << endl;
}

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

int main()
{
	char s[10005];
	int n;
	cin>>n;
	scanf("%s",s);
	for(int i=0;i<strlen(s);i++)
	{
		s[i]=(s[i]-'A'+n)%26+'A';
		printf("%c",s[i]);
	}printf("\n");
	return 0;
}

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

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

  int min_cost = 1e9;
  for (int a0 = -100; a0 <= 100; ++a0) {
    int cur_cost = 0;
    rep(i, n) cur_cost += pow(a[i] - a0, 2);
    min_cost = min(min_cost, cur_cost);
  }
  cout << min_cost << endl;
  return 0;
}

Measured memory_bytes: 3556
#include<iostream>
#include<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<stack>

using namespace std;

//科目選択

int main(){
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;

	if(e < f) e = f;

	int sum = a + b + c + d;

	if(a>b) a = b;
	if(a>c) a = c;
	if(a>d) a = d;

	cout << sum - a + e << endl;

	return 0;
}



Measured memory_bytes: 3136
#include <iostream>

using namespace std;

int main(){

  int A,B,C,D;

  int ans = 0;

  cin >> A >> B >> C >> D;

  if(A < B){
    ans += A;
  }
  else{
    ans += B;
  }

  if(C < D){
    ans += C;
  }
  else{
    ans += D;
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define rep(i,n) f(i,0,n)
#define rrep(i,n) rf(i,n-1,0)
#define w(t) ll t; cin>>t; while(t--)
#define vi vector<ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mii map<ll,ll>
#define mci map<char,ll>
using namespace std;

void fast_IO_file()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    fast_IO_file();
    char a;
    cin>>a;
    if(isupper(a))
    {
    	cout<<"A";
    }
    else
    {
    	cout<<"a";
    }
    return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>

const int INF = 1000000009;
const long LINF = 1123456789012345678;
const long MOD = 1000000007;

long n;
std::vector<long> edge[100005];

long dp[100005][2];//[i][0] : white, [1] : black

void dfs(long vis, long p){
	dp[vis][0] = 1;
	dp[vis][1] = 1;
	for(int i = 0; i < edge[vis].size(); i++){
		if(edge[vis][i] != p){
			long nx = edge[vis][i];
			dfs(nx, vis);
			dp[vis][0] *= (dp[nx][0] + dp[nx][1]);
			dp[vis][1] *= dp[nx][0];
			dp[vis][0] %= MOD;
			dp[vis][1] %= MOD;
		}
	}
	return;
}

int main(){
	scanf("%ld", &n);
	for(int i = 0; i < n-1; i++){
		long x, y;
		scanf("%ld %ld", &x, &y);
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	dfs(1, -1);
	/*
	for(int i = 1; i <= n; i++){
		printf("(%ld %ld)\n", dp[i][0], dp[i][1]);
	}
	//*/
	printf("%ld\n", (dp[1][0] + dp[1][1]) % MOD);
	return 0;
}
	


Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;



int main () {

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

	int a, b;
	cin >> a >> b;
	if (a > b) swap(a, b);
	if ((b-a) % 2 == 1) {
		cout << "IMPOSSIBLE";
	}
	else {
		cout << (a+b)/2;
	}

	return 0;
}

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

using namespace std;

using ll = long long;

#define MAX_NUM 1000000

int main(){
  ll a, b;
  cin >> a >> b;
  cin.ignore();

  ll tmp;
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }

  if(a == 1){ // 片方が1なら、公約数は1しかない
    cout << 1 << endl;
    return 0;
  }

  ll r;
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  // このループが終わったときの最大公約数は b

  if(b == 1){ // 最大公約数がb
    cout << 1 << endl;
    return 0;
  }

  //cout << "b = " << b << endl;

  //1は確実に公約数
  int cnt = 1;

  // bの素因数分解

  ll sqrt_b = sqrt(b);
  bool flag = false;
  while(b % 2 == 0){
    flag = true;
    b /= 2;
  }
  if(flag == true){
    ++cnt;
  }
  ll i = 3;
  for (i = 3; i <= sqrt_b; i+=2){
    flag = false;
    while(b % i == 0){
      flag = true;
      b /= i;
    }
    if(flag == true){
      ++cnt;
    }
  }
  // さいごに残ったb
  if(b > 1){
    cout << ++cnt << endl;
  } else {
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>)
{
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{ it.toInt() }.toIntArray()
    val m = mutableListOf<Pair<Int, Int>>()
    for (i in 0 until n) {
        m.add(Pair<Int, Int>(i+1, a[i])) // 出席番号、人数
    }

    m.sortBy{ selector -> selector.second }
    val ans = m.map{ it.first }.joinToString(separator=" ")
    println(ans)
}


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

using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;cin>>n;
    n%=10;
    if(n==3) cout<<"bon"<<'\n';
    else if(n==0||n==1||n==6||n==8) cout<<"pon"<<'\n';
    else cout<<"hon"<<'\n';
	return 0;
}


Measured memory_bytes: 3652
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}inline ll gcd(ll a,ll b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr if(0)cout
#endif
ll n,K,f[5000];const ll MOD=1e9+7;
ll qexp(ll x,ll e){ if(e==0)return 1; ll half=qexp(x,e/2); half*=half; half%=MOD; if(e&1)half*=x,half%=MOD; return half; }
ll mul_inv(ll x){ return qexp(x,MOD-2); }
ll choose(ll n,ll k){ if(n<k)return 0; 
	return f[n]*mul_inv(f[k])%MOD*mul_inv(f[n-k])%MOD;
}
int main()
{
	FAST
	cin>>n>>K; f[0]=f[1]=1; FOR(i,2,5000)f[i]=f[i-1]*i%MOD;
	FOR(k,1,K+1){
		ll b=K-k;
		ll r=n-K-k+1; if(r<0) {cout<<0<<'\n'; continue; }
		cout<<(choose(k+b-1,b)*choose(k+1+r-1,r))%MOD<<'\n';
	}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a, i;
  while (cin>>a) {
    for (i=0;i<=9;i++) {
      if (a&1<<i){
        cout<<(1<<i);
        if (a<2<<i)break;
        cout<<' ';
      }
    }
    cout<<endl;
  }
}

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

using std::cin;
using std::cout;
using std::cerr;

using std::abs;
using std::min;
using std::max;
using std::swap;

using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;

using std::sort;
using std::reverse;

using ll = long long;

#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())
#define endl '\n'

struct __init {
    __init() {
        cin.tie(nullptr);
        std::iostream::sync_with_stdio(false);
        cout << std::fixed << std::setprecision(10);
        cerr << std::fixed << std::setprecision(5);
        std::mt19937 rand(300);
    }

    ~__init() {
        #ifdef SEREZHKA
            cerr << "Time elapsed: " << static_cast<double>(clock()) / CLOCKS_PER_SEC << endl;
        #endif
    }
} init;

const ll inf = (ll) 1e9 + 7ll;
const int maxn = (int) 2e5 + 17;

int n;
ll a[maxn], b[maxn];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n)
        cin >> a[i];

    forn (i, n)
        cin >> b[i];

    return true;
}

int get(const vector<ll>& b, ll a, ll R) {
    return upper_bound(b.begin(), b.end(), R - a) - b.begin();
}

int get(const vector<ll>& b, ll a, ll L, ll R) { return get(b, a, R) - get(b, a, L - 1); }

void solve() {
    ll ans = 0;

    for (int bit = 29; bit >= 0; --bit) {
        vector<ll> bb(b, b + n);

        forn (i, n)
            bb[i] &= (1ll << (bit + 1)) - 1;

        sort(bb.begin(), bb.end());
        int res = 0;

        forn (i, n) {
            auto x = (a[i] & ((1ll << (bit + 1)) - 1));
            res += get(bb, x, (1ll << bit), (1ll << (bit + 1)) - 1);
            res += get(bb, x, (1ll << (bit + 1)) + (1ll << bit), (1ll << (bit + 2)) - 1);
        }

        if (res & 1)
            ans += (1ll << bit);
    }

    cout << ans << endl;
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 4992