akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

class RmQ {
  public:
  int N;
  vi segtree;
  RmQ(int n) {
    N = 1;
    int len = 1;
    while(N < n) {
      N *= 2;
      len += N;
    }
    segtree = vi(len,INF);
  } 
  void build(int idx,int val) {
    int s = sz(segtree) - (N-idx);
    segtree[s] = val;
    while(1) {
      if(s == 0) break;
      s = (s-1)/2;
      segtree[s] = min(segtree[s*2+1],segtree[s*2+2]);
    }
  }
  int _query(int a,int b,int idx,int l,int r) {
    if(a <= l && r <= b) return segtree[idx];
    if(r <= a || b <= l) return INF;
    int vl = _query(a,b,idx*2+1,l,(l+r)/2);
    int rl = _query(a,b,idx*2+2,(l+r)/2,r);
    return min(vl,rl);
  }
  // min(A[i] | l <= i <= r)
  int query(int l,int r) {
    return _query(l,r+1,0,0,N);
  }
};
class rMq {
  public:
  int N;
  vi segtree;
  rMq(int n) {
    N = 1;
    int len = 1;
    while(N < n) {
      N *= 2;
      len += N;
    }
    segtree = vi(len,-INF);
  } 
  void build(int idx,int val) {
    int s = sz(segtree) - (N-idx);
    segtree[s] = val;
    while(1) {
      if(s == 0) break;
      s = (s-1)/2;
      segtree[s] = max(segtree[s*2+1],segtree[s*2+2]);
    }
  }
  int _query(int a,int b,int idx,int l,int r) {
    if(a <= l && r <= b) return segtree[idx];
    if(r <= a || b <= l) return -INF;
    int vl = _query(a,b,idx*2+1,l,(l+r)/2);
    int rl = _query(a,b,idx*2+2,(l+r)/2,r);
    return max(vl,rl);
  }
  // max(A[i] | l <= i <= r)
  int query(int l,int r) {
    return _query(l,r+1,0,0,N);
  }
};

int main() {
  int N,K;
  cin >> N >> K;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  RmQ r = RmQ(N);
  rMq c = rMq(N);
  rep(i,N) {
    r.build(i,A[i]);
    c.build(i,A[i]);
  }
  vi dp(N,1);
  rep(i,N-1) {
    if(A[i] < A[i+1]) {
      dp[i+1] = dp[i]+1;
    }
  }
  int a = 0;
  int b = 0;
  rep(i,N-K+1) {
    if(dp[i+K-1] >= K) {
      a++;
    } else {
      if(i==0) continue;
      int x = A[i-1];
      int y = A[i+K-1];
      int x2 = r.query(i,i+K-2);
      int y2 = c.query(i,i+K-2);
      if(x < x2 && y2 < y) {
        b++;
      }
    }
  }
  int ans = N-K+1;
  ans -= max(0,a-1);
  ans -= max(0,b);
  cout << ans << endl;
  return 0;
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理 from: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n, k;
    cin >> n >> k;
    COMinit();
    int ma = COM(n - 1, 2);
    if (k > ma) {
        out(-1);
        return 0;
    } else {
        int cnt = 0;
        vector<pair<int, int>> ans;
        repeat(i, 2, n + 1) {
            ans.push_back(make_pair(1, i));
            cnt++;
        }
        int res = COM(n - 1, 2) - k;
        int add = 0;
        int u = 2, v = 2;
        while (res > add) {
            v++;
            if (v > n) {
                u++;
                v = u + 1;
            }
            // debug(u);
            // debug(v);
            // debug(add);
            ans.emplace_back(u, v);
            add++;
        }
        cnt += add;

        out(cnt);
        for (auto p : ans) {
            cout << p.first << " " << p.second << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2688
from itertools import product
import numpy as np
h,w,k = map(int,input().split())
c = np.array([[*input()] for _ in range(h)])
c = np.where(c=="#",1,0)

all_black = c.sum()
ans = 0
for row in product((0,1), repeat = h):
    for col in product((0,1), repeat = w):
        row = np.array(row)
        col = np.array(col)
        if (c * col).sum() + (c.T * row).sum() - ((c*col).T * row).sum() + k == all_black:
            ans += 1

print(ans)

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

int n,a[16],x[16][16],y[16][16];

int couter(int x)
{
	if(x == 0) return 0;
	return couter(x >> 1) + (x & 1);
}

int main()
{
	
	std::ios::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; ++i){
		cin >> a[i];
		for(int j = 0; j < a[i]; ++j){
			cin >> x[i][j] >> y[i][j];
		}
	}
	int ans = 0;
	for(int i = 1; i < (1 << n); ++i){
		bool ok = true;
		for(int j = 1; j <= n; j++){
			if(i & (1 << (j - 1))) {
				for(int k = 0; k < a[j]; ++k) {
					if(((i >> (x[j][k] - 1)) & 1) ^ y[j][k]) ok = false;
				}
			}
		}
		if(ok){
			ans = max(ans,couter(i));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    ans = 0;

    while(cin >> n)
    {
		for(ll i = 1; i <= n; i++)
		{
			if(i % 3 && i % 5) ans += i;
		}

		cout << ans << "\n";
    }


}





Measured memory_bytes: 3500
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
 
typedef struct node * NodePointer;
 
NodePointer nil;
 
NodePointer listSearch(int key){
  NodePointer x;
  x=nil->next;
  while (x!=nil && x->key!=key){
    x=x->next;
  }
  return x;
}
 
int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
    if ( com[6] == 'F' ) deleteFirst();
    else if ( com[6] == 'L' ) deleteLast();
      } else {
    delete(key); nd++; 
      }
      size--;
    }
  }
 
  printList();
  return 0;
}void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
 
void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}
 
void deleteNode(NodePointer t){
  t->prev->next=t->next;
  t->next->prev=t->prev;
}
 
void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}
 
void deleteLast(){
  NodePointer t=nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}
 
void delete(int key){
  NodePointer t;
  if((t=(listSearch(key)))!=NULL){
    if ( t == nil ) return;
    deleteNode(t);
  }
}
 
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

Measured memory_bytes: 34976
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
 
int main(){
    int i;
    int res;
    string S,T;
    res = 0; 
    cin >> S >>T;
    for(int i = 0;i<3;i++){
        if(S[i] == T[i]) res += 1;
    }
    cout << res << endl; 
}

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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const set<T> &v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T,S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T,S> &v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "TRACE ON! (Line: " << __LINE__ << ")\n"; auto _stream = istringstream{string{#args}}; d_f(_stream, args); } while(0)
	void d_f(__attribute__((unused)) istringstream& _stream) {}
	template<typename Head, typename... Tails> void d_f(istringstream& _stream, Head H, Tails... T) { string _name; _stream >> _name; if(_name.back() == ',') _name.pop_back(); cerr << "\t" << _name << " <=> [" << H << "]\n"; d_f(_stream, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	int n; ll k;
	cin >> n >> k;

	vector<ll> arr(n);
	for(auto& i: arr) cin >> i;
	sort(arr.begin(), arr.end());

	vector<ll> f(n);
	for(auto& i: f) cin >> i;
	sort(f.begin(), f.end(), greater<>());

	ll lb = 0, ub = 1e15;
	ll ans;

	while(lb <= ub){
		ll mid = (lb + ub) / 2;

		ll taken = 0;
		for(int i = 0; i < n; ++i){
			// arr[i] * f[i] <= mid
			// arr[i] <= mid / f[i]
			taken += max(0LL, arr[i] - (mid / f[i]));
		}

		if(taken <= k){
			ans = mid;
			ub = mid - 1;
		}
		else{
			lb = mid + 1;
		}
	}

	cout << ans << "\n";
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


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

int main() {
	cin>>s;
	long long a=0;
	long long m=s.size()-1;
	for(int i=0;i<(1<<m);i++) {
		long long sum=0,pr=0;
		for(int j=0;j<s.size();j++) {
			pr*=10ll;
			pr+=s[j]-'0';
			if(j==s.size()-1) {
				sum+=pr;
				break;
			}
			if((i>>j)&1) {
				sum+=pr;
				pr=0;
			}
		}
		a+=sum;
	}
	cout<<a<<endl;
	return 0;    
} 

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

int main() {
    int N;
    cin >> N;
    vector <int> d(N);
    for (int i = 0; i < N; i++){
        cin >> d.at(i);
    }
    int ans = 0;
    for (int i = 0; i < N; i++){
        for (int j = i+1; j < N; j++){
                ans += d.at(i) * d.at(j);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
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)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

S = S()
K = I()
n = len(S)
ind = 0
num = 1
for i in range(n):
  if S[i] != "1":
    ind = i
    num = S[i]
    break
if K>ind:
  P(num)
else:
  P(1)


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>

#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 pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;
static const int INF = 1000000000;


int ans, H, W;
char maze[25][25];
map<pair<int, int>, int> m;
int d[405][405];

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

int main(void) {
    scanf("%d %d", &H, &W);
    rep(i, 0, H) {
        scanf("%s", maze[i]);
    }
    int c = 0;
    rep(y, 0, H) {
        rep(x, 0, W) {
            m[mp(y, x)] = c++;
        }
    }

    rep(i, 0, c) {
        rep(j, 0, c) {
            if (i==j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }


    rep(y, 0, H) {
        rep(x, 0, W) {

            if (maze[y][x] == '#') continue;

            rep(r, 0, 4) {
                int sx = x + dx[r];
                int sy = y + dy[r];
                if (x<0 || x>=W || y<0 || y>=H) continue;

                int src = m[mp(y, x)];
                int dst = m[mp(sy, sx)];

                if (maze[sy][sx] == '.') {
                    d[src][dst] = d[dst][src] = 1;
                }
                
            }
        }
    }

    rep(k, 0, c) {
        rep(i, 0, c) {
            rep(j, 0, c) {
                if (d[i][j] != INF || d[i][k] != INF || d[k][j] != INF) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    rep(i, 0, c) {
        rep(j, 0, c) {
            if (d[i][j] != INF) ans = max(ans, d[i][j]);
        }
    }


   

  
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 896
#include <iostream>

using namespace std;


void weather_predicition()
{
  string s;
  cin >> s;

  if (s == "Sunny") cout << "Cloudy\n";
  else if (s == "Cloudy") cout << "Rainy\n";
  else if (s == "Rainy") cout << "Sunny\n";
}


void odds_of_oddness()
{
  int n;
  cin >> n;

  int cnt = 0;
  for (int i = 1; i <= n; ++i)
  {
    if (i % 2 != 0) ++cnt;
  }

  cout << (float)cnt / (float)n << "\n";
}


int main()
{
  //weather_predicition();
  odds_of_oddness();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<ios>
#include<algorithm>
using namespace std;
#include<vector>
struct UF{
	int n;
	vector<int>parent,rank;
	UF(int n_=0):n(n_),parent(n_),rank(n_,0)
	{
		for(int i=0;i<n_;i++)parent[i]=i;
	}
	int find(int a)
	{
		return parent[a]!=a?parent[a]=find(parent[a]):a;
	}
	bool same(int a,int b)
	{
		return find(a)==find(b);
	}
	bool unite(int a,int b)
	{
		a=find(a),b=find(b);
		if(a==b)return false;
		if(rank[a]<rank[b])
		{
			parent[a]=b;
		}
		else
		{
			parent[b]=a;
			if(rank[a]==rank[b])rank[a]++;
		}
		return true;
	}
};
main()
{
    int n;
    while(cin>>n,n)
    {
        int m;cin>>m;
        int ans=0;
        vector<pair<int,pair<int,int> > >e;
        for(;m--;)
        {
            int a,b,c;scanf("%d,%d,%d",&a,&b,&c);
            c=c/100-1;
            e.push_back(make_pair(c,make_pair(a,b)));
        }
        UF uf(n);
        sort(e.begin(),e.end());
        for(int i=0;i<e.size();i++)
        {
            int a=e[i].second.first,b=e[i].second.second,c=e[i].first;
            if(uf.same(a,b))continue;
            uf.unite(a,b);
            ans+=c;
        }
        cout<<ans<<endl;
    }
}


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

void dfs(int n, string now, vector<string> &vec, int d=1){
  if(now.size() == n){
    vec.push_back(now);
    return;
  }
  for(int i = 0; i <= d; i++){
    string next = now+char('a'+i);
    int m=d;
    if(i==d) m++;
    dfs(n,next,vec,m);
  }
}

int main(){
  int n;
  cin>>n;
  vector<string> ans;
  dfs(n,"a",ans);
  for(auto x : ans) cout<<x<<endl;
}


Measured memory_bytes: 7248
package main

import (
	"fmt"
	"os"
)

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)
	tasks := scanIntSlice(m)

	for _, t := range tasks {
		n -= t
		if n < 0 {
			fmt.Println("-1")
			os.Exit(0)
		}
	}

	fmt.Printf("%d\n", n)
}

func scanIntSlice(size int) []int {
	input := []int{}
	for i := 0; i < size; i++ {
		var in int
		fmt.Scanf("%d", &in)
		input = append(input, in)
	}
	return input
}


Measured memory_bytes: 2984
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

n = int(readline())
a = list(map(int,readline().split()))

cum = [0]*n

for i in range(n-2,-1,-1):
    cum[i] += cum[i+1] + a[i+1]
    cum[i] %= mod

ans = 0

for i in range(n):
    ans = (ans + a[i]*cum[i])%mod

print(ans)






Measured memory_bytes: 31596
#include<stdio.h>

int main()
{
    int i, flag = 1;
    char str[5];
    scanf("%s", str);
    for(i = 0; i < 3; ++i) {
        if(str[i] == str[i+1]) { flag = 0; break;}
    }
    if(flag == 1) { printf("Good\n"); } else { printf("Bad\n"); }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(ll b=1;b<=n;b++){
		ll p=n/b;
		ll zero=0;
		ll pko=max(zero,b-k);
		ans+=p*pko;
		ll s=b*(p)+k;
		ans+=max(zero,n-s+1);
	}
	if(k==0){
		ans=ans-n;
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 256
def bubble_sort(arr, n):
    count = 0
    for j in range(n - 1):
        for i in reversed(range(j, n - 1)):
            if arr[i] > arr[i + 1]:
                arr[i], arr[i + 1] = arr[i + 1], arr[i]
                count += 1
    return arr, count


def main():
    n = int(input())
    arr = list(map(int, input().split()))
    # n = 5
    # arr = [5, 3, 2, 4, 1]
    sorted_arr, count = bubble_sort(arr, n)
    print(" ".join(map(str, sorted_arr)))
    print(count)
    # print(sorted_arr)


if __name__ == "__main__":
    main()



Measured memory_bytes: 5600
#include<stdio.h>
int main()
{
    int N,i,j=0,k=0;
    scanf("%d",&N);
    int ar[N];
    for(i = 0;i<N;i++)
    {
        scanf("%d",&ar[i]);
    }
    for(i = 0;i < N;i++)
    {
        if(ar[i] == i+1)
        {
            j++;
        }
        else if(ar[i] != i+1)
        {
            k++;
        }
    }
    if(j == N)
    {
        printf("YES\n");
    }
    else if(k == 2)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}



Measured memory_bytes: 1640
def bfs():
      global flag
      if len(que)==0:
         flag=False
      else:
         now=que.popleft()
         now_step=steps[now[0]][now[1]]
         for dx,dy in (0,-1),(1,0),(0,1),(-1,0):
            ny=now[0]+dy
            nx=now[1]+dx
            if 0<=ny<=H-1 and 0<=nx<=W-1:
               if maze[ny][nx]==".":
                  if ([ny,nx] in que)==False:
                     maze[ny][nx]="A"
                     que.append([ny,nx])
                     steps[ny][nx]=now_step+1
               else:
                  pass

import copy
from collections import deque

H,W=map(int,input().split())
maze=[]
for i in range(H):
   S=input()
   S=[c for c in S]
   maze.append(S)

maze_copy=copy.deepcopy(maze)
max_step=0

for s_i in range(H):
   for s_j in range(W):
      if maze[s_i][s_j]=="#":
         continue
            
      maze=copy.deepcopy(maze_copy)
      maze[s_i][s_j]="S"
      que=deque([[s_i,s_j]])
      steps=[[-1]*W for c in range(H)]
      steps[s_i][s_j]=0
      flag=True

      while(flag):
         bfs()

      toriaezu_max=0
      for i in range(H):
         toriaezu_max=max(toriaezu_max,max(steps[i]))
      max_step=max(max_step,toriaezu_max)

print(max_step)

Measured memory_bytes: 3444
using System;
using System.Collections.Generic;
using System.Linq;
namespace CsProgramSpace
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int[]> list = new List<int[]>();
            bool mode = false;
            while(true)
            {
                int[] i = new int[2];
                i = (Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray());
                if (i[0] == 0 && i[1] == 0) break;
                list.Add(i);
            }
            foreach(int[] i in list)
            {
                for(int j = 0; j<i[0];j++)
                {
                    if (j % 2 == 0) mode = false;
                    else mode = true;
                    for(int k = 0; k<i[1];k++)
                    {
                        if (!mode)
                        {
                            mode = true;
                            Console.Write("#");
                        }
                        else
                        {
                            mode = false;
                            Console.Write(".");
                        }
                    }
                    Console.WriteLine("");
                }
                Console.WriteLine("");
            }
        }
    }
}


Measured memory_bytes: 16372
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string N;
    cin >> N;
    ll res=0;
    rep(i,N.size()){
        res+=N[i]-'0';
    }
    cout << (res%9==0?"Yes":"No") << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl '\n'
int main() {
//#ifndef ONLINE_JUDGE
  //  freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "w", stdout);
//#endif
    fast
    int n, m;
    cin>>n>>m;
    vector<int> v(n, -1);
    if(n==1){
    	int a=-1;
    	if(m==0){
    		cout<<0;return 0;
    	}
    	while(m--){
    		int s,c;cin>>s>>c;
    		// if(s==1 && c==0){
    		// 	cout<<-1;return 0;
    		// }
    		if(s==1 && a==-1){
    			a=c;
    		}else if(s==1 && c!=a){
    			cout<<-1;return 0;
    		}else {
    			continue;
    		}
    	}
    	
    	cout<<a;
    	return 0;
    }
    while(m--){
    	int s,c;cin>>s>>c;
    	s--;
    	if(v[s]==-1 || v[s]==c){
    		v[s]=c;
    		continue;
    	}
    	if(v[s]!=c){
    		cout<<-1;return 0;
    	}

    }
    if(v[0]==0){cout<<-1;}
    else{
    	int ans=0;
    	if(v[0]==-1) v[0]=1;
    	for(int i=0; i<n; ++i){
    		if(v[i]==-1) v[i]++;
    		ans=ans*10+v[i];
    		//cout<<v[i]<<" "<<ans<<endl;
    	}
    	cout<<ans;
    }

    


    return 0;
}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
r, g, b = M()
temp = str(r) + str(g) + str(b)
rgb = int(temp)
if rgb % 4 == 0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 74164
#include <iostream>
using namespace std;
#define int long long int

signed main() {
    
    int x,d,k;
    cin>>x>>k>>d;
    x = abs(x);
    
    int steps = x/d;
    
    int rem = x - steps*d;
    
    if(steps > k)
    cout<<x - k*d<<"\n";
    else
    {
        int r_s = k - steps;
        if(r_s&1)
        cout<<abs(rem - d)<<"\n";
        else
        cout<<abs(rem)<<"\n";
    }
    
	return 0;
}

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

const double pi = acos(-1);

int main(){ 
  ll N,K; cin >> N >> K;
  vector<ll> A(N); vector<ll> F(N);
  for(ll i = 0; i < N; i++){ cin >> A[i];}
  for(ll j = 0; j < N; j++){ cin >> F[j];}
  
  sort(A.begin(),A.end()); sort(F.rbegin(),F.rend());
  
   
  
  ll l = -1; ll r = 1LL << 60;
  
  while( r-l > 1){ 
    ll mid = l + (r-l)/2;
    ll cnt = 0;
    for(ll k = 0; k < N; k++){ 
      cnt += (max(A[k]*F[k]-mid,0LL)+F[k]-1)/F[k];
    }
    
    if( cnt <= K){ r=mid;}
    else{ l=mid;}
    
  }
  
  cout << r << endl; return 0;
}
     

Measured memory_bytes: 3328
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = sc.next()
    println(problem167a(s, t))
}

fun problem167a(s: String, t: String): String {
    return if (s == t.dropLast(1)) "Yes" else "No"
}

Measured memory_bytes: 37716
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
map<ll,ll> res;
void factorize(ll x){
	for(ll i=2;i*i<=x;i++){
        ll d=0;
		while(x%i==0){
			x/=i;
			d++;
		}
        chmax(res[i],d);
	}
	if(x!=1) chmax(res[x],1ll);
}
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(int n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
 int n;
 cin>>n;
 V<ll> a(n),b(n);
 for(int i=0;i<n;i++){
     cin>>a[i];
     factorize(a[i]);
 }
mint ans=0;
mint d=1;
for(auto p:res){
    for(int i=0;i<p.se;i++)d*=p.fi;
}
//cout<<d<<endl;
for(int i=0;i<n;i++){
    ans+=d/mint(a[i]);
}
cout<<ans<<endl;
}



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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    Int(n);
    vi data(n);
    rep(i, n) cin >> data[i];

    deque<int> ans;
    rep(i, n) {
        if (i % 2) {
            ans.push_front(data[i]);
        } else {
            ans.pb(data[i]);
        }
    }

    if (n % 2) {
        reverse(all(ans));
        rep(i, ans.size()) {
            cout << ans[i] << " ";
        }
        cout << endl;
    } else {
        rep(i, ans.size()) {
            cout << ans[i] << " ";
        }
        cout << endl;
    }


    return 0;
}



Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main(){
  int num[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int n;
  cin >> n;
  cout << num[n-1] << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split(' ');
		int A = int.Parse(str[0]);
		int B = int.Parse(str[1]);
		int K = int.Parse(str[2]);
		int cnt = 0;
		int ans;

		for (int i = 100;; i--)
		{
			if(A%i == 0 && B%i == 0)
			{
				cnt++;
				if(cnt == K)
				{
					ans = i;
					break;
				}	
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,i,h;
  cin>>N;
  int A[N];
  int B[N];
  int C[N];
  int Ah[N];
  int Bh[N];
  int Ch[N];
  for(i=0;i<N;i++){
  cin>>A[i]>>B[i]>>C[i];
  }
  Ah[0]=A[0];
  Bh[0]=B[0];
  Ch[0]=C[0];
  for(i=1;i<N;i++){
    
    Ah[i]=max(A[i]+Bh[i-1],A[i]+Ch[i-1]);
    Bh[i]=max(B[i]+Ah[i-1],B[i]+Ch[i-1]);
    Ch[i]=max(C[i]+Bh[i-1],C[i]+Ah[i-1]);
    
  }
  h=max(Ah[N-1],Bh[N-1]);
  h=max(h,Ch[N-1]);
  cout<<h<<endl;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> D(N);
	for (int i = 0; i < N; i++) cin >> D[i];
	sort(D.begin(), D.end());
	cout << D[N / 2] - D[N / 2 - 1] << endl;
}


Measured memory_bytes: 640
def main():
    S = list(input())
    chars = list(set(S))

    if len(chars) != 2:
        print('No')
        return

    def count_a_char(c):
        return len([s for s in S if s == c])

    if count_a_char(chars[0]) != 2 or count_a_char(chars[1]) != 2:
        print('No')
        return 
    
    print('Yes')
    

main()

Measured memory_bytes: 3060
n = int(input())
robot = []
for _ in range(n):
    x, l = map(int, input().split())
    arm_left = x - l
    arm_right = x + l
    robot.append([arm_left, arm_right])

robot.sort(key=lambda x: x[1])
count = 0
current_right = -1000000000
for i in range(n):
    if robot[i][0] >= current_right:
        count += 1
        current_right = robot[i][1]

print(count)

Measured memory_bytes: 21336
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

use std::iter::Iterator;

fn main() {
    input! {
        s:chars
    }

    let mut cs = s.iter().map(|c| c.to_digit(10).unwrap() ).collect::<Vec<u32>>();

    cs.reverse();

    let mut total: u64 = 0;
 
    for b in 0..2u32.pow((cs.len() - 1) as u32) {
        let mut keta = 1;
        let mut stack = 0;
 
        for (i, c) in cs.clone().into_iter().enumerate() {
            if (b >> i) & 1 == 1 {
                stack += (c as u64) * keta;
                keta *= 10;
            } else {
                total += stack + (c as u64) * keta;
                stack = 0;
                keta = 1;
            }
        }
    }
 
    println!("{}", total);
}


Measured memory_bytes: 4352
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

L, R, d = mi()

cnt = 0

for i in range(L, R+1):
    if i % d == 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 9068
#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(){
  ll h,w;
  cin>>h>>w;
  if(h%3==0 || w%3==0){
    cout<<0<<endl;
    return 0;
  }
  ll ans=10000000000;
  if(w>2) ans=h;
  if(h>2) ans=min(ans,w);
  if(h%2==0) ans=min(ans,h/2);
  if(w%2==0) ans=min(ans,w/2);
  if(h%2==1){
    for(int i=1;i<w;i++){
      ll res=max(abs(3*i*h-h*w-w+i)/2,abs(3*i*h-h*w+w-i)/2);
      res=max(res,w-i);
      ans=min(ans,res);
    }
  }
  if(w%2==1){
    for(int i=1;i<h;i++){
      ll res=max(abs(3*i*w-h*w-h+i)/2,abs(3*i*w-h*w+h-i)/2);
      res=max(res,h-i);
      ans=min(ans,res);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;

int main()
{
	string s, c;
	cin >> s;
	cin >> c;

	int j = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == c[i])
		{
			j++;
		}
	}
	cout << j;
}


Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <cassert>
using namespace std;
using VI = vector<int>;

int main() {
    string s;
    cin >> s;
    cout << s.front() << s.size() - 2 << s.back() << endl;
}


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

int main() {
        int n, k;
        cin >> n >> k;
        int cnt = 0;
        double ans;
        int point;
        for (int i = 1; i <= n; i++){
            cnt = 0;
            point = i;

            for (int j=0; j<pow(10,9); j++){
                if (point * pow(2,j) >= k){

                    ans += 1.0 / (pow(2,cnt) * n);
                    break;
                }
                cnt++;
            }
        }
        printf("%.12f\n",ans);

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include<iostream>
// #include<stack>
// #include<string>
// #include<vector>
// #include<queue>
// #include<map>
// #include<algorithm>
// #include<iomanip>
// #include<set>
// #include<bitset>
// #include<cmath>
// #include<numeric>
// #include<limits>
// #include<functional>
// #include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;
static const int MAX = 100005;
// static const int NMAX = 5005;

// typedef priority_queue<int, greater<int>> RevQ;
int N, L;
// vector<ll> a(MAX);



int main(){
  cin >> N;
  vector<ll> a(N);
  rep(i, N) {
    cin >> a[i];
  }
  ll s = 0;
  rep(i, N) s ^= a[i]; // bit-wise XOR (total XOR)
  ll ans = s;
  rep(i, N) a[i] &= ~s; // bit-wise AND
  // A[i]'s j-th digit takes value 1 only if A[i]'s j-th digit is 1 and
  // s's j-th digit is zero.

  // 掃き出し法
  int r = 0; // rank
  vector<int> top(N); // 先頭ビットが何 bit 目か
  for(int i = 60; i >= 0; --i){
    int j = r;
    for(; j < N; ++j) {
      if (a[j] >> i & 1) { // A[j]'s j-th digit is 1
        swap(a[r], a[j]);
        break;
      }
    }
    if (j == N) continue; // We cannot find 
    top[r] = i;
    rep(k, N) {
      if ( r == k ) continue;
      if ( a[k] >> i & 1) a[k] ^= a[r];
    }
    ++r;
  }

  ll x = 0;
  for ( int i = 60; i >= 0; --i) {
    ll nx = x | (1ll << i);
    {
      ll b = nx;
      rep(j, r) {
        if (b >> top[j] & 1) b ^= a[j];
      }
      if ((b&nx) == 0) {
        x = nx;
      }
    }
  }
  ans += x*2;
  cout << ans << endl;
  return 0;
}


/* standard input
19
strangexyxxorangexx

*/


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

using namespace std;

const int M = 1e9+7;
int n, k;
long long ans;
vector<int> edge[110000];
bool done[110000];

void dfs(int u)
{
  done[u] = true;
  int sibling = 0;
  for (int v: edge[u]) {
    if (done[v]) continue;
    done[v] = true;
    int color = k - sibling - 1;
    sibling++;
    if (u != 1) color--;
    ans = ans * color % M;
    dfs(v);
  }
}

int main()
{
  cin >> n >> k;
  
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  
  ans = k;
  dfs(1);
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

const int N = 1001010;

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

  int n; cin >> n;
  vector<int> v(n);
  bool ok = true;
  for(int i = 0; i < n; ++i) {
    cin >> v[i];
    if(v[i] % 2 == 0) {
      ok &= (v[i] % 3 == 0) || (v[i] % 5 == 0);
    }
  }
  cout << (ok ? "APPROVED": "DENIED") << endl;
}


Measured memory_bytes: 256
n = int(input())
s = input()

al = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
news = ""
for i in range(len(s)):
    for j in range(len(al)):
        if s[i] == al[j]:
            news += al[(j+n)%26]

print(news)


Measured memory_bytes: 3060
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, X, T):
    ans = N // X * T
    if N % X > 0:
        ans += T
    print(ans)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    N, X, T = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, X, T)


Measured memory_bytes: 9156
// Jump, and you will find out how to unfold your wings as you fall.

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

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

const int maxn=2e5+10,Src=maxn-3,Snk=maxn-2,inf=1e8;

vector<pii>v[maxn];
vector<int>vid[maxn];
bool mark[maxn];
pii ans[maxn];
int n,h[maxn],pt[maxn];

void add_edge(int a,int b){
    vid[a].PB(sz(v[b]));
    vid[b].PB(sz(v[a]));
    v[a].PB({b,1});
    v[b].PB({a,0});
}

bool bfs(){
    memset(mark,0,sizeof mark);
    queue<int>q; q.push(Src); mark[Src]=1;
    while(sz(q)){
	int u=q.front();
	if(u==Snk) return 1;
	q.pop();
	for(pii p:v[u]){
	    if(p.S>0 && mark[p.F]==0){
		h[p.F]=h[u]+1;
		mark[p.F]=1;
		q.push(p.F);
	    }
	}
    }
    return 0;
}
int dfs(int u,int flw=inf){
    if(u==Snk) return flw;
    int ans=0,&i=pt[u];
    while(i<sz(v[u])){
	int y=v[u][i].F,&w=v[u][i].S,&w2=v[y][vid[u][i]].S;
	if(w>0 && h[u]+1==h[y]){
	    int num=dfs(y,min(flw-ans,w));
	    w-=num,w2+=num,ans+=num;
	    if(ans==flw) return ans;
	}
	++i;
    }
    return ans;
}
int flow(){
    int ans=0;
    while(bfs()){
	memset(pt,0,sizeof pt);
	ans+=dfs(Src);
    }
    return ans;
}

void go(int u,int par=-1){
    mark[u]=1;
    if(u>=n && u!=Src && u!=Snk){
	int y=-1;
	for(pii p:v[u]){
	    if(p.S!=0)
		y=p.F;
	}
	ans[u-n]={par+1,y+1};
    }
    for(pii p:v[u]){
	if(p.S!=0 && mark[p.F]==0)
	    go(p.F,u);
    }
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie();
    cin>>n;
    for(int i=0;i<n-1;i++){
	int N;cin>>N;
	while(N--){
	    int x;cin>>x;
	    add_edge(--x,i+n);
	}
    }
    for(int i=0;i<n;i++){
	add_edge(Src,i);
    }
    for(int i=n;i<2*n-1;i++){
	add_edge(i,Snk);
    }
    int num=flow();
    if(num!=n-1) return cout<<-1<<endl,0;
    memset(mark,0,sizeof mark);
    go(Src);
    for(int i=0;i<n-1;i++){
	if(ans[i].F==0)
	    return cout<<-1<<endl,0;
    }
    for(int i=0;i<n-1;i++){
	cout<<ans[i].F<<" "<<ans[i].S<<"\n";
    }
}

// Deathly mistakes:
//  * Read the problem curfully.
//  * Check maxn.
//  * Overflows.


Measured memory_bytes: 42092
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define int long long
#define print(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = (1LL << 30);
const ll MOD = 1000000007;
//=============================================================
//=============================================================

int N, M;
int H, W;
int ans = 0;
int dfs(int cur, bool a, bool b, bool c){
    if (cur > N) return 0;
    else {
        if (a&&b&&c) ans++;
        dfs(cur*10+3,true,b,c);
        dfs(cur*10+5,a,true,c);
        dfs(cur*10+7,a,b,true);
    }
}


void solve(){
    dfs(0, false,false,false);
}

signed main()
{
    cin >> N;
    solve();
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256