akhauriyash/Code-Regression huggingface dataset:
count = 0

#in: list1 int
#global count
def merge(list1, list2):
    global count
    output = []
    p1 = 0
    p2 = 0
    l1 = len(list1)
    l2 = len(list2)
    while p1<l1 and p2<l2:
        num1 = list1[p1]
        num2 = list2[p2]
        if num1 <= num2:
            output.append(num1)
            p1 += 1
        else:
            output.append(num2)
            p2 += 1
            count += l1 - p1
    return output+list1[p1:]+list2[p2:]

#counting_merge_sort
#in: list1
def counting_merge_sort(list1):
    if len(list1) <= 1:
        return list1
    pivot = len(list1)//2
    return merge(counting_merge_sort(list1[:pivot]), counting_merge_sort(list1[pivot:]))

n = int(input())
list1 = list(map(int, input().split(' ')))
counting_merge_sort(list1)
print(count)


Measured memory_bytes: 27468
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool line(string s){
	lli size = s.size();
	if(DEBUG)cout<<s<<endl;
	for(lli i=0;i<size/2;i++){
		if(s.at(i)!=s.at(size-1-i)){
			if(DEBUG)cout<<"false"<<endl;
			return false;
		}
	}
	if(DEBUG)cout<<"true"<<endl;
	return true;
}

signed main(){

	string s;
	cin>>s;
	set<string> ans;

	lli data[26]={0};
	REP(i,0,s.size())data[s.at(i)-'a']++;

	/*とりあえず全探索で部分文字列が点対称かどうかチェックする*/
	lli cnt=0;
	/*
	ans.insert(s);
	for(lli i=0;i<s.size();i++){
		for(lli j=i+1;j<s.size();j++){
			if(s[i]==s[j])cnt++;
			swap(s[i],s[j]);
			ans.insert(s);
			swap(s[i],s[j]);
			//if(line(s.substr(i,j-i+1)))cnt++;
		}
	}*/

	REP(i,0,26){
		if(data[i]<2)continue;
		cnt += (data[i])*(data[i]-1)/2;
	}

	lli sum = (s.size())*(s.size()-1)/2 + 1;

	//cout<<"sum="<<sum<<" cnt="<<cnt<<endl;

	cout<<sum-cnt<<endl;
	//cout<<ans.size()<<endl;

	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define setp(x) setprecision(x)
#define nep(x) next_permutation(x);
using namespace std;
using ull = unsigned long long;
using ll = long long;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    for(int i = 0; i < N; i++) cin >> H[i];
    for(int i = 1; i < N; i++){
        if(H[i - 1] < H[i]) H[i]--;
        if(H[i - 1] > H[i]){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int n,k, s, a[N];
int main()
{
	int i;
	cin >> n >> k;
	if (k * 2 - 1 <= n) cout << "YES";
	else cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

LL N, M;
vector<LL> v(400000, 0);

//[x,y)にAdd
void AddRange(LL x, LL y) {
	while (true) {


		if (x == y) {
			break;
		}
		LL j = 1;
		LL nazo = 1024 * 128;
		LL ind = 0;
		for (j = 1; j <= 1024*128; j *= 2) {
			if (x + j*2 <= y&&x%(j*2)==0) {
				ind += nazo;
				nazo /= 2;
			}
			else {
				break;
			}
		}
		v[ind + x/j] += 1;
		x += j;
	}
}

LL Kakunin(LL x) {
	LL sum = 0;
	LL j = 1;
	LL nazo = 1024 * 128;
	LL ind = 0;
	REP(i, 18) {
		sum += v[ind + x / j];
		ind += nazo;
		nazo /= 2;
		j *= 2;

	}
	return sum;
}

int main() {
	cin >> N >> M;

	REP(hoge, M) {
		LL a, b;
		cin >> a >> b;
		if (a > b) {
			LL c = a;
			a = b;
			b = c;
		}
		AddRange(a-1, b - 1);
	}
	
	bool flag=true;
	REP(i, N) {
		if (Kakunin(i) % 2 == 1) {
			flag = false;
			break;
		}
	}
	if (flag) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
enum class Direction {
	Horizontal, Vertical
};
Direction as_direction(int d) {
	switch (d) {
	case 1: return Direction::Horizontal;
	case 2: return Direction::Vertical;
	default: throw 0;
	}
}
struct Block {
	Direction direction;
	int length;
	int position;
	int height() const {
		switch (direction) {
		case Direction::Horizontal: return 1;
		case Direction::Vertical: return length;
		default: throw 0;
		}
	}
	int width() const {
		switch (direction) {
		case Direction::Horizontal: return length;
		case Direction::Vertical: return 1;
		default: throw 0;
		}
	}
};
struct Line {
	int state = 0;
	void write(Block block) {
		state |= (1 << (block.position + block.width())) - (1 << block.position);
	}
	bool can_put(Block block) const {
		return (state & ((1 << (block.position + block.width())) - (1 << block.position))) == 0;
	}
	bool is_filled() const {
		return state + 2 == (1 << 6);
	}
};
struct Field {
	std::list<Line> list;
	int block_rest = 0;
	void drop_block(Block block) {
		block_rest += block.height() * block.width();
		auto last = std::find_if(list.rbegin(), list.rend(), [block](const Line& line) {return !line.can_put(block); });
		if (last == list.rend()) {
			while (list.size() < block.height()) {
				list.push_back(Line());
			}
			for (auto itr = list.begin(); std::distance(list.begin(), itr) < block.height(); ++itr) {
				itr->write(block);
			}
			auto itr = list.begin();
			for (auto i = 0; i < block.height(); ++i) {
				if (itr->is_filled()) {
					itr = list.erase(itr);
					block_rest -= 5;
				}
				else {
					++itr;
				}
			}
		}
		else if (last == list.rbegin()) {
			for (auto i = 0; i < block.height(); ++i) {
				auto line = Line();
				line.write(block);
				list.push_back(line);
			}
			for (auto itr = std::prev(list.end(), block.height()); itr != list.end();) {
				if (itr->is_filled()) {
					itr = list.erase(itr);
					block_rest -= 5;
				}
				else {
					++itr;
				}
			}
		}
		else {
			auto rev_count = std::distance(list.rbegin(), last);
			for (; rev_count < block.height(); ++rev_count) {
				list.push_back(Line());
			}
			auto itr = std::prev(list.end(), rev_count);
			for (auto i = 0; i < block.height(); ++i) {
				itr->write(block);
				if (itr->is_filled()) {
					itr = list.erase(itr);
					block_rest -= 5;
				}
				else {
					++itr;
				}
			}

		}
	}
	int block_count() const { return block_rest; }
};
int main() {
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		Field field;
		for (auto i = 0; i < n; ++i) {
			int d, l, p; std::cin >> d >> l >> p;
			Block block{ as_direction(d), l, p };
			field.drop_block(block);
		}
		std::cout << field.block_count() << '\n';
	}
}


Measured memory_bytes: 3260
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 2e5 + 5;
const int mod = 1e9 + 7;

ll f[N], fr[N];

ll cnk(int n, int k) {
	return f[n] * fr[k] % mod * fr[n - k] % mod;
}

ll binpow(ll a, int p) {
	ll res = 1;
	while (p) {
		if (p & 1) {
			(res *= a) %= mod;
		}
		p >>= 1;
		(a *= a) %= mod;
	}
	return res;
}

int main() {
	// freopen("input.txt", "r", stdin);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	f[0] = fr[0] = 1;
	for (int i = 1; i < N; i++) {
		f[i] = f[i - 1] * i % mod;
		fr[i] = binpow(f[i], mod - 2);
	}
	ll ans = cnk(h + w - 2, h - 1);
	for (int i = h - a + 1; i <= h; i++) {
		ans -= cnk(i + b - 2, b - 1) * cnk(h - i + 1 + w - b - 2, w - b - 1) % mod;
		ans = (ans + mod) % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <iostream>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

const int CAKE = 4;
const int DONUT = 7;

struct data_t {
    int cake;
    int donut;
    int n;
};

int main() {
    int N;
    cin >> N;

    data_t d;
    d.donut = N / DONUT;
    d.n = N % DONUT;
    d.cake = d.n / CAKE;
    d.n = d.n % CAKE;

    if (d.n == 0) {
        cout << "Yes" << endl;
        return 0;
    }

    while (d.n != 0) {
        if (CAKE <= d.n) {
            d.n -= CAKE;
            d.cake++;
        } else {
            if (d.donut == 0) {
                break;
            }

            d.n += DONUT - CAKE;
            d.donut--;
            d.cake++;
        }
    }

    // cout << "d.cake: " << d.cake << endl;
    // cout << "d.donut: " << d.donut << endl;
    // cout << "d.n: " << d.n << endl;

    if (d.n == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;

void add(int &a, int b) {
  if ((a += b) >= MOD) a -= MOD;
}

void sub(int &a, int b) {
  if ((a -= b) < 0) a += MOD;
}

int mul(int a, int b) {
  return (int) ((a * 1LL * b) % MOD);
}

int mpow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

int minv(int x) {
  return mpow(x, MOD - 2);
}

int main() {
#ifdef LOCAL
  freopen("d.in", "r", stdin);
  freopen("d.out", "w", stdout);
#endif

  int h;
  while (scanf("%d", &h) == 1) {
    --h;
    int L = 1 << h;
    vector<int> prods(2 * L);
    vector<int> iprods(2 * L);
    prods[1] = 1;
    iprods[1] = 1;
    for (int i = 2; i < 2 * L; i++) {
      prods[i] = mul(prods[i / 2], i);
      iprods[i] = mul(i, minv(mul(prods[i], prods[i])));
    }
    vector<int> tree(2 * L);
    auto set = [&](int pos, int val) {
      pos += L;
      tree[pos] = val;
      while (pos /= 2) {
        tree[pos] = tree[2 * pos];
        add(tree[pos], tree[2 * pos + 1]);
      }
    };

    vector<int> p(L);
    for (int i = 0; i < L; i++) {
      scanf("%d", &p[i]);
      --p[i];
    }

    int ans = 0;

    function<void(int, int)> solve = [&](int l, int r) {
      if (r - l == 1) return;
      int m = (l + r) / 2;
      solve(l, m);
      solve(m, r);
      for (int i = m; i < r; i++) {
        set(p[i], mul(prods[i + L], prods[p[i] + L]));
      }
      int ll = l + L, rr = r + L - 1;
      while (ll != rr) {
        ll /= 2;
        rr /= 2;
      }
      for (int i = l; i < m; i++) {
        int cur = mul(iprods[ll], mul(prods[i + L], prods[p[i] + L]));
        int t = p[i] + L;
        while (t != 1) {
          int other = mul(tree[t ^ 1], iprods[t / 2]);
          add(ans, mul(cur, other));
          t /= 2;
        }
      }
      for (int i = m; i < r; i++) {
        set(p[i], 0);
      }
    };
    solve(0, L);
    printf("%d\n", ans);
  }

  return 0;
}


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

int main(void){
    int N,M,sum=0;
    cin >> N >> M;
    vector<int> A(M+10);
    REP(i,M){
        int A;
        cin >> A;
        sum += A;
    }
    if(N-sum < 0) cout << "-1" << endl;
    else cout << N - sum << endl;
    return 0;
}

Measured memory_bytes: 3620
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): 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 S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline
from bisect import bisect_left

N = I()
A = LI()
dic = {}
total_pair = 0
for i in range(N):
    dic[A[i]]  = dic.get(A[i],0) + 1
for value in dic.values():
    total_pair += int(value*(value-1)/2)
for num in A:
    print(total_pair-dic[num]+1)


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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

vector<pair<ll, ll>> pf(ll n){
    vector<pair<ll, ll>> res;
    for (ll i = 2; i*i <= n; i++){
        if (n%i != 0){
            continue;
        }
        else{
            ll ex = 0;
            while (n%i == 0){
                ex++;
                n /= i;
            }
            res.push_back({i, ex});
        }
    }
    if (n != 1){
        res.push_back({n, 1});
    }
    return res;

    //素因数分解
    //入力:ll
    //出力:vector<pair<ll, ll>>
    //res[i].first == i番目に小さい素因数
    //res[i].second == res[i].firstの指数
}

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

    ll n;
    cin >> n;

    ll ans = 0;

    for (ll c = 1; c < n; c++){
        vector<pair<ll,ll>> x = pf(n-c);
        ll m = x.size();
        ll w = 1;

        for (ll i = 0; i < m; i++){
            w *= x[i].second + 1;
        }

        ans += w;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3648
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		double debt=100000;
		for(int i=0;i<n;i++){
			debt=1.05*debt;
			if(debt%1000!=0){
				debt=debt-debt%1000+1000;
			}
		}
		System.out.println((int)debt);
		sc.close();
	}
}

Measured memory_bytes: 26120
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>

using namespace std;

int main() {
    int N;
    cin>>N;
    for(int i=1;i<=N;i++){

        if(N<=i*1.08&&i*1.08<N+1){
            cout<<i<<endl;
            break;
        }
        if(i==N){
            cout<<":("<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

struct Point{double x,y;};

void koch(int n,Point a,Point b){
    if(n==0) return;
    Point s,t,u;
    double th=M_PI*60.0/180.0;
    
    s.x=(2.0*a.x+1.0*b.x)/3.0;
    s.y=(2.0*a.y+1.0*b.y)/3.0;
    t.x=(1.0*a.x+2.0*b.x)/3.0;
    t.y=(1.0*a.y+2.0*b.y)/3.0;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

    koch(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    koch(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    koch(n-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
    koch(n-1,t,b);
}

int main(){
    Point a,b;
    int n;
    
    scanf("%d",&n);
    
    a.x=0;
    a.y=0;
    b.x=100;
    b.y=0;
    
    printf("%.8f %.8f\n",a.x,a.y);
    koch(n,a,b);
    printf("%.8f %.8f\n",b.x,b.y);

    return 0;
}


Measured memory_bytes: 2672
#include <iostream>

#include <algorithm>
#include <cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;
typedef long long LL;

int main() {


	int a, b,c;
	//----------------------
	LL n, X, Z,A,B,N,ans1,ans2,i,m,C,D;
	LL ans, count=0 ;
	bool f=true;
	string s;
	char t, u;

	cin >> s;
	a = s.size();

	
	t = s.front();
	u = s.back();

	s = t + a + u;
	

	
	

	

	cout << t << a-2 << u << endl;
	//cout << s << endl;

	
	//------------------------
	//cin >> Z;

	return 0;
}

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

# 最小化問題のためINFに初期化する
f_inf = float('inf')
dp = [f_inf] * (10**5+10)

# 初期条件
dp[0] = 0

for i in range(N-1):
    # 1つ飛ばし
    dp[i+1] = min(dp[i+1], dp[i] + abs(H[i+1] - H[i]))
    
    # 2つ飛ばし
    if (i != N-2):
        dp[i+2] = min(dp[i+2], dp[i] + abs(H[i+2] - H[i]))
        
    
print(dp[N-1])

Measured memory_bytes: 13928
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)
int H, A[MAX+1];

void maxHeapify(int i) {
  int l, r, largest;
  l = 2 * i;
  r = 2 * i + 1;

  // 左の子、自分、右の子で値が最大のノードを選ぶ
  // まずは左に関して、自分=iより大きいか判定
  if (l <= H && A[l] > A[i] ) largest = l;
  else largest = i;
  // 右に関して、一番大きいやつより大きいか判定
  if (r <= H && A[r] > A[largest]) largest = r;
  // 一番大きいのが自分でない時
  if (largest != i) {
    // swapは配列とかベクトルに格納されている値の交換
        swap(A[i], A[largest]);
        maxHeapify(largest);
  }
}

int extract() {
  int maxv;
  if (H < 1) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  if (key < A[i]) return;
  A[i] = key;
  while(i > 1 && A[i / 2] < A[i]) {
    swap(A[i], A[i / 2]);
    i = i / 2;
  }
}

void insert(int key){
  H++;
  A[H] = -INFTY;
  increaseKey(H, key);
}

int main(){
  int key;
  char com[10];

  while (1) {
    scanf("%s", com);
    if (com[0] == 'e' && com[1] =='n') break;
    if (com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }else {
      printf("%d\n", extract());
    }
  }
  return 0;
}



Measured memory_bytes: 6512
#include<stdio.h>

int main(){
  int i,j,k,n,key;
  int a[1000];
  
  scanf("%d",&n);
  
  for (i=0;i<n;i++){
    scanf("%d",&a[i]);
  }


  for(i=0;i<n;i++){
      printf("%d",a[i]);
      if(i!=n-1) printf(" ");
    }

    printf("\n");
  for(i=1;i<=n-1;i++){
    key=a[i];
    j=i-1;
    
    while(j >= 0 && a[j] > key){
      a[j+1]=a[j];
      j--;
      
    }
    
    a[j+1]=key;

    for(k=0;k<n;k++){
      printf("%d",a[k]);
      if(k!=n-1) printf(" ");
    }

    printf("\n");
    
  }
  
  return 0;
  
}



Measured memory_bytes: 2140
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int cnt = 0;
		int bh = sc.nextInt();
		for (int i = 1; i < n; i++) {
			int h = sc.nextInt();
			if (bh >= h) {
				cnt++;
			} else {
				cnt = 0;
			}
			max = Math.max(max, cnt);
			
			bh = h;
		}
		
		System.out.println(max);
		
	}
}


Measured memory_bytes: 49628
#include <stdio.h>

int getaline(char *);
void out_domi(int d[][3][10]);
void set_domi(int d[][3][10], int b, int f, int r, int v);

int main(void)
{
	int domi[4][3][10] = {{{0}}};
	int n = 0, b, r, f, v;
	int iw[3];


	// input number of information
	scanf("%d", &n);
	// input informations of b, f, r, v
	for(int i=0; i<n; i++){
		scanf("%d", &b);	// building number 1 - 4
		scanf("%d", &f);	// floor number 1 - 3
		scanf("%d", &r);	// room number 1 - 10
		scanf("%d", &v);	// number of person + or -
		set_domi(domi, b-1, f-1, r-1, v);
	}
	
	out_domi(domi);

	return 0;
}

void out_domi(int d[][3][10]){
	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++){
				printf(" %d",d[i][j][k]);
			}
		printf("\n");
		}
		if(i<3) printf("####################\n");
	}
}

void set_domi(int d[][3][10], int b, int f, int r, int v){
	// check persons in the room
	int vp = d[b][f][r];
	vp = vp + v;
	if(vp < 0)
		vp = 0;
	if(vp > 9)
		vp = 9;
	d[b][f][r] = vp;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main() {
  deque<int>dq;
  int n;
  int a;
  cin >> n;
  for(int i = 0; i < n; ++i) {
    cin >> a;
    if(i % 2) dq.push_front(a);
    else dq.push_back(a);
  }
  
  if(n % 2) reverse(dq.begin(), dq.end());
  cout << dq[0];
  for(int i = 1; i < dq.size(); ++i) cout << " " << dq[i];
  cout << endl;
  return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  	if (A + B > C + D) {
      cout << "Left" << endl;
    }
  	else if (A + B < C + D) {
      cout << "Right" << endl;
    }
  	else {
      cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main() {
  int A, B;
  cin >> A >> B;

  int ans;
  if (A == B) {
    ans = 2 * A;
  } else {
    ans = max(A, B) * 2 - 1;
  }
  cout << ans << endl;
}

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>;

const ll MX = 1e18;

int main(){
    int n;
    cin >> n;
    ll ans = 1;
    bool ng = false;
    rep(i,n){
        ll a;
        cin >> a;
        if(a == 0){
            cout << 0 << endl;
            return 0;
        }
        if(ng || __int128(ans) * a > MX){
            ng = true;
        }
        ans *= a;
    }
    if(ng) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
N = int(input())
A = list(map(int,input().split()))

count = 0
num = 0
for a in A:
    if a % 2 == 0:
        num += 1
    if a % 2 == 0 and (a % 3 == 0 or a % 5 == 0):
        count += 1
if count == num:
    print("APPROVED")
else:
    print("DENIED")

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

a=  input()
b = input()
c = input()

totalcount=0
for i in range(n):
    count=2
    if a[i] == b[i]:
        count=1
        if  b[i]==c[i]:
            count=0
    elif a[i] == c[i]:
        count=1
    elif b[i]==c[i]:
        count=1
    totalcount+=count
print(totalcount)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int, input().split()))
s = set()
cands = []

for i in a:
    if i in s:
        cands.append(i)
        s.remove(i)
    else:
        s.add(i)

x = sorted(cands, reverse=True)
if len(x) < 2:
    print(0)
else:
    print(x[0]*x[1])

Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define maxn 10010
using namespace std;
int n,dp[maxn],seg[maxn];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>seg[i];
	}
	dp[0]=1;
	for(int i=i;i<=n;i++){
		for(int j=10000;j>=seg[i];j--){
			if(dp[j-seg[i]]) dp[j]=1;
		}
	}
	int i; 
	for(i=10000;i>=0;i--){
		if(dp[i]==1&&i%10!=0) break; 
	}if(i<0) i=0;
	cout<<i; 
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
p,y = [],[]
for i in range(m):
    v1,v2 = map(int,input().split())
    p.append(v1)
    y.append(v2)
    
py = zip(p,y,range(m))
py = sorted(py)
p,y,index = zip(*py)
 
ans = []
start = p[0]
count = 1
for i in range(m):
    if start == p[i]:
        ans.append(str(p[i]).zfill(6) + str(count).zfill(6))
        count += 1
    else:
        count = 1
        start = p[i]
        ans.append(str(p[i]).zfill(6) + str(count).zfill(6))
        count += 1
 
ans = zip(index,ans)
ans = sorted(ans)
index,ans = zip(*ans)
for i in ans:
    print(i)

Measured memory_bytes: 44972
#include <iostream>
#include <cmath>
using namespace std;
bool f(int n){
    int cnt=0;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0)
            cnt++;
    }
    if(cnt==0)
        return true;
    return false;
}
int main(){
    int n,m,cnt=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m;
        if(f(m))
            cnt++;
        
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>

int Check(int n, int a[][2], int d[][36]){
	int dc[36] = {}, i;
	for(i = 0; n > i; i++){
		if(d[a[i][0]][dc[a[i][0]]] != a[i][1]) return -1;
		dc[a[i][0]]++;
	}
	return 0;
}

void  SelectSort(int n, int a[][2]){
    int f = 1, i, j = 0;
     
    for(j = 0; n-1 > j; j++){
        int minp, min = 101;
        for(i = j; n > i; i++){
            if(a[i][0] < min){
                min = a[i][0];
                minp = i;
            }
        }
        if(j != minp){
        int buf = a[j][0];
        a[j][0] = a[minp][0];
        a[minp][0] = buf;
        buf = a[j][1];
        a[j][1] = a[minp][1];
        a[minp][1] = buf;
        }
    }
} 
void  BubbleSort(int n, int a[][2]){
    int f = 1, i;
     
    while(f){
        f = 0;
        for(i = 0; n-1 > i; i++){
            if(a[i][0] > a[i+1][0]){
                int buf = a[i+1][0];
                a[i+1][0] = a[i][0];
                a[i][0] = buf;
                buf = a[i+1][1];
                a[i+1][1] = a[i][1];
                a[i][1] = buf;
                f = 1;
            }
        }
    }
}
int main(void) {
	int n, i, a[36][2], b[36][2], d[37][36], dc[37] = {};
	scanf("%d%*c", &n);
	for(i = 0; n > i; i++){
		scanf("%c%d%*c", &a[i][1], &a[i][0]);
		d[a[i][0]][dc[a[i][0]]] = a[i][1];
		dc[a[i][0]]++;
	}
	
	memcpy(b, a, sizeof(a));
	BubbleSort(n, a);
	for(i = 0; n > i; i++){
		printf("%c%d", a[i][1], a[i][0]);
		if(i < n-1) printf(" ");
	}
	printf("\n");
	if(Check(n, a, d) == -1) printf("Not stable\n");
	else printf("Stable\n");

	memcpy(a, b, sizeof(a));
	SelectSort(n,a);
	for(i = 0; n > i; i++){
		printf("%c%d", a[i][1], a[i][0]);
		if(i < n-1) printf(" ");
	}
	printf("\n");
	if(Check(n, a, d) == -1) printf("Not stable\n");
	else printf("Stable\n");
	return 0;
}

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

int main(void)
{
  int high_temp, low_temp, diff_temp;
	rep(i, 7)
  {
    cin >> high_temp >> low_temp;
    diff_temp = high_temp - low_temp;
    cout << diff_temp << endl;
  }
}


Measured memory_bytes: 3092
//
//  main.cpp
//  TPC
//
//  Created by yuki on 2019/07/16.
//  Copyright © 2019 yuki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <fstream>
#include <numeric>
#include <regex>
#include <algorithm>


using namespace std;

std::vector<int> range(int upper){
    std::vector<int> v(upper);
    std::iota (std::begin(v), std::end(v), 0);
    
    return v;
}

const bool check(int A, int B, const std::string S) {
    
    for (const auto i: range(A)) {
        unsigned char c = S[i];
        
        if (!('0' <= c && c <= '9')) {
            return false;
        }
    }
    if (!(S[A] == '-')) {
        return false;
    }
    for (const auto i: range(B)) {
        unsigned char c = S[A+i+1];
        
        if (!('0' <= c && c <= '9')) {
            return false;
        }
    }
    
    
    return true;
}


int main() {

    
    // ================================================ //
    int A, B;
    std::string S;
    
    cin >> A >> B;
    cin >> S;
    
    
    std::cout << (check(A, B, S) ? "Yes" : "No") << std::endl;
    
}



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> ;
#define PI 3.14159265358979323846264338327950
int main () {
    int N;
    cin >> N ;
    string P = to_string(N);
    bool isthere = false; 
    rep(i, 3){
        if(P[i] == '7'){
            isthere = true;
            break; 
        }
    }
    if (isthere){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 3696
inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
l = inp.shift().split(' ')
x1 = l.shift() * 1
y1 = l.shift() * 1
x2 = l.shift() * 1
y2 = l.shift() * 1
xd = x1 - x2
yd = y1 - y2
x3 = x2 + yd
y3 = y2 - xd
x4 = x1 + yd
y4 = y1 - xd
console.log('%d %d %d %d', x3, y3, x4, y4)

Measured memory_bytes: 7372
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int N = Integer.parseInt(scan.next());

	int x = N * 800;
	int y = 200 * (N / 15);

	System.out.println(x - y);
	scan.close();
    }
}


Measured memory_bytes: 22356
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
using ll=long long;

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

  vector< pair<ll, ll> > f;
  for(a = 1; a*a <= n; a++){
    if(n%a == 0) {
      b = n/a;
      pair<ll, ll> p(a,b);
      f.push_back( p );
    }
  }

  if(n == 1) {
    cout << 1 << endl;
    return 0;
  }


  ll judge;
  int cnt = 0;
  vector <ll> ju;
  for(int i = 0; i < f.size(); i++){
     // cout << f[i].first << " " << f[i].second << endl;
    if(f[i].first > f[i].second){
      judge = f[i].first;
    }else{
      judge = f[i].second;
    }
    ju.push_back( judge );
    // cout << judge << endl;
  }
//   cout << "ju" << endl;
// for(int k = 0; k < ju.size(); k++) {
//   cout << ju[k] << endl;
// }

  int ju_min = *min_element(ju.begin(), ju.end());
  // cout << "ju_min: " << ju_min << endl;

  while(ju_min != 0){
    ju_min = ju_min/10;
    cnt++;
  }
  cout << cnt << endl;
  //   if(min > cnt) min = cnt;
  //   cnt = 0;
  //
  //
  // // n = 1の場合
  // if(min == 10) min = 1;
  // cout << min << endl;

  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(" ").map(String::toInt)
    var ok = false
    if (a == 7 && b == 5 && c == 5) ok = true
    if (a == 5 && b == 7 && c == 5) ok = true
    if (a == 5 && b == 5 && c == 7) ok = true

    if (ok) {
        println("YES")
    } else {
        println("NO")
    }
}

Measured memory_bytes: 38008
#[allow(unused_macros)]
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" ) } ; }
#[allow(unused_macros)]
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 ) * } } ; }
#[allow(unused_macros)]
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 ) * } } ; }

fn main() {
    input! {
        a: i32,
        b: i32,
        c: i32,
    }
    if a + b >= c {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int main() {
  string S;
  cin >> S;
  int i,j,n,l;
  n=S.size();
  l=0;
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(S[i] ==S[j]) {
        l++;
        break;
      }
    }
  }
if(l!=0) cout <<"no";
    else cout <<"yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    if (n%2==0)
    {
        double a;
        a=(double)(n/2)/n;
        cout <<fixed<<setprecision(7)<<a<<endl;
    }
    else{
        double b;
        b=(double)(n+1)/(2*n);
        cout <<fixed<<setprecision(7)<<b<<endl;
    }
}

Measured memory_bytes: 256
import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
 v,val=map(int,input().split())
 cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
 v=q.pop()
 checked[v]=1 #頂点を見たかどうかのフラグを更新する
 for u in g[v]:
   if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
     continue
   cnt[u]+=cnt[v]
   q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる

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

void chmax(int64_t& a, int64_t b){
    a = max(a, b);
}

int main(){
    int N;
    int64_t K, A[100000];
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> A[i];

    int64_t dp[41][2];
    for(int d=40; d>=0; d--) for(int j=0; j<2; j++) dp[d][j] = -1e18;
    dp[40][0] = 0;

    for(int d=39; d>=0; d--){
        int64_t D = 1LL<<d;

        int num1 = 0;
        for(int i=0; i<N; i++) if(A[i] & D) num1++;
        int num0 = N - num1;

        if(K & D){
            chmax(dp[d][0], dp[d+1][0] + D * num0);
            chmax(dp[d][1], dp[d+1][0] + D * num1);
        }else{
            chmax(dp[d][0], dp[d+1][0] + D * num1);
        }

        chmax(dp[d][1], dp[d+1][1] + D * max(num0, num1));
    }

    int64_t ans = max(dp[0][0], dp[0][1]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

ll gcd(ll a,ll b){
    if (b==0)return a;
    return gcd(b,a%b);
}

void solve(){
 char c;
 cin >> c;
 cout << char (c+1) << endl;
}

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


Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// #define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 1<<18;
int n,q,p[MAXN+1],val[MAXN+1],w[MAXN+1],done[MAXN];
int dp[(1<<9)+1][200020];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n;
  // n = (1<<18)-1;
  for(int i=1;i<=n;i++){
    cin >> val[i] >> w[i];
    // val[i] = rand()%100000 + 1;
    // w[i] = rand()%100000 + 1;
    if(i!=1){
      p[i] = i/2;
    }
  }
  for(int i=1;i<(1<<9);i++){
    vpi v;
    int cur = i;
    while(cur){
      v.pb({val[cur],w[cur]});
      cur/=2;
    }
    int N = v.size();
    for(int msk=0;msk<(1<<N);msk++){
      int W = 0;
      int V = 0;
      for(int j=0;j<N;j++){
        if(msk&(1<<j)){
          W+=v[j].second;
          V+=v[j].first;
        }
        if(W>=100000)break;
      }
      if(W<=100000){
        dp[i][W] = max(dp[i][W],V);
      }
    }
    for(int W=1;W<=100000;W++){
      dp[i][W] = max(dp[i][W],dp[i][W-1]);
    }
    done[i] = 1;
  }
  cin >> q;
  // q = 100000;
  while(q--){
    int u,l;
    cin >> u >> l;
    // u = n;
    // l = rand()%100000;
    ll ans = 0;
    int cur = u;
    vpi v;
    while(!done[cur]){
      v.pb({val[cur],w[cur]});
      cur/=2;
      // cerr << cur << endl;
    }
    int N = v.size();
    for(int i=0;i<(1<<N);i++){
      int W = 0;
      ll V = 0;
      for(int j=0;j<N;j++){
        if(i&(1<<j)){
          W+=v[j].second;
          V+=v[j].first;
        }
        if(W>=l)break;
      }
      if(W<=l){
        ans = max(ans,V+dp[cur][l-W]);
      }
    }
    cout << ans << endl;
  }




return 0;
}
///....


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

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

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a & 1) {

        } else {
            if (a % 3 == 0 || a % 5== 0) {

            } else {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }

cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll dp[5151][5151];
int main()
{
	int num;
	scanf("%d", &num);
	string s;
	cin >> s;
	dp[0][0] = 1;
	for (int i = 0; i < num; i++)
	{
		for (int j = 0; j <= i; j++)
		{
			dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * 2) % mod;
			dp[i + 1][max(0, j - 1)] = (dp[i + 1][max(0, j - 1)] + dp[i][j]) % mod;
		}
	}
	ll ans = dp[num][s.size()];
	for (int i = 0; i < s.size(); i++)ans = ans*((mod + 1) / 2) % mod;
	printf("%lld\n", ans);
}

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

#define ul unsigned long int
#define ull unsigned long long
#define li long long int

int main()
{
  ul a,b,c;
  double s,l,h;
  cin>>a>>b>>c;

  h = b * sin((double)c / 180.0 * M_PI);
  s = a * h/2;
  l = sqrt(a * a + b * b - 2 * a * b * cos((double)c / 180.0 * M_PI))+a+b;

  cout<<fixed<<setprecision(16);
  cout << s << " " << l << " " << h << endl;

      return 0;
}



Measured memory_bytes: 3684
n,k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
b = Array.new(n,0)
a.each do |i|
  b[i-1] += 1
end
b.delete(0)
b.sort!
if b.size <= k 
  puts 0
else
  puts b[0..-k-1].inject(:+)
end

Measured memory_bytes: 19568
#include <stdio.h>
int main(void){
	long long int a,b,x;
	scanf("%lld %lld %lld",&a,&b,&x);
	if(a%x==0) printf("%lld\n",b/x-a/x+1);
	else printf("%lld\n",b/x-a/x);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;

long long gcd(long long a, long long b){
    if (a%b == 0){
        return b;
    }else{
        return gcd(b,a%b);
    }
}

int main()
{
    // 整数の入力

    ll K;
    cin >>  K;
    map<ll,ll> counts;
    for(int i = 0;i < K-1;i++){
        ll a;
        cin >> a;
        counts[a]++;
    }
    for(int i = 1;i <= K ;i++){
        if (i != 1){
            cout << " ";
        }
        cout << counts[i];
    }
    cout << endl;
   return 0;
}

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

using namespace std;

const int NIL = -1;

struct Node {
    int parent;
    int left_child;
    int right_sibling;
    int depth;
};

class Tree {
private:
    vector<Node> nodes;

    void setNodes(int size)
    {
        for (int i = 0; i < size; i++)
        {
            int id;
            int degree;
            cin >> id >> degree;
            int left;
            for (int j = 0; j < degree; j++)
            {
                int child;
                cin >> child;
                nodes[child].parent = id;
                if (j == 0)
                    nodes[id].left_child = child;
                else
                    nodes[left].right_sibling = child;
                left = child;
            }
        }
    }

public:
    Tree(int size)
    {
        for (int i = 0; i < size; i++)
            nodes.push_back(Node{NIL, NIL, NIL, NIL});
        setNodes(size);
    }

    vector<Node> getNodes() { return nodes; }

    string type(int index)
    {
        if (nodes[index].parent == NIL)
            return "root";
        else if (nodes[index].left_child == NIL)
            return "leaf";
        else
            return "internal node";
    }

    void set_depth(int index, int depth)
    {
        nodes[index].depth = depth;
        if (nodes[index].right_sibling != NIL)
            set_depth(nodes[index].right_sibling, depth);
        if (nodes[index].left_child != NIL)
            set_depth(nodes[index].left_child, depth + 1);
    }

    void print_children(int index)
    {
        cout << "[";
        int child = nodes[index].left_child;
        if (child != NIL)
        {
            while (true)
            {
                cout << child;
                child = nodes[child].right_sibling;
                if (child != NIL)
                    cout << ", ";
                else
                    break;
            }
        }
        cout << "]" << endl;
    }
};

int main()
{
    int n;
    cin >> n;
    Tree tree(n);

    int root;
    for (root = 0; root < n; root++)
        if (tree.type(root) == "root")
            break;
    tree.set_depth(root, 0);

    vector<Node> nodes = tree.getNodes();
    for (int i = 0; i < n; i++)
    {
        cout << "node " << i << ": parent = " << nodes[i].parent
             << ", depth = " << nodes[i].depth << ", " << tree.type(i) << ", ";
        tree.print_children(i);
    }
}


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

int main(){
  int count=0;
  int N,L;
  cin>>N>>L;
  if(L*(L+N-1)<=0){
  count=N*L+N*(N-1)/2;
  }
  else if(L<0){
    count=(N-1)*L+(N-1)*(N-2)/2;
  }
  else if(L>0){
    count=(N-1)*L+N*(N-1)/2;
  }
  cout<<count;
}

Measured memory_bytes: 384
/* Count characters */
#include <stdio.h>

int main(void){
/* Parameters */
int count[26];
int num;
int i;
char ch;

/* Initialize */
for (i = 0; i < 26; i++){
        count[i] = 0;
}

/* Read Files */
while (scanf("%c", &ch) != EOF){
        /* Small Capital */
        num = ch - 'a';
        if ( num >= 0 && num <= 25) count[num]++;
        /* Large Capital */
        num = ch - 'A';
        if ( num >= 0 && num <= 25) count[num]++;
}

/* Print statistics */
ch = 'a';
for (i = 0; i < 26; i++){
        printf("%c : %d\n", ch + i, count[i]);
}

/* RC */
return 0;}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int x[] = {111, 222, 333, 444, 555, 666, 777, 888, 999};

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

    for(int i = 0; i < 9; i++){
        if(x[i] >= n)
            return cout << x[i] << '\n', 0;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main(int argc, char const* argv[])
{
  long a, b, k;
  cin >> a >> b >> k;
  if (a > k) {
    cout << a-k << " " << b << endl;
  } else if (a+b > k) {
    cout << 0 << " " << a+b-k << endl;
  } else {
    cout << 0 << " " << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <math.h>

#define ll long long

ll min(ll x, ll y)
{
    return x < y ? x : y;
}

ll max(ll x, ll y)
{
    return x > y ? x : y;
}

int main()
{
    int n;
    scanf("%d", &n);
    ll minp, res = -(1 << 31), x;
    scanf("%lld\n", &minp);
    for (int i = 1; i < n; i++)
    {
        scanf("%lld\n", &x);
        res = max(res, x - minp);
        minp = min(x, minp);
    }
    printf("%d\n", res);
}


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

int main() 
{
    char arr[2][3];
    
    for(int i=0;i<2;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
        }
    
    }
    if((arr[0][1]==arr[1][1])&&(arr[0][2]==arr[1][0])&&(arr[0][0]==arr[1][2]))
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
    
}

Measured memory_bytes: 256
#ABC110C
import sys
s=input();t=input()
start=[-1]*26
goal=[-1]*26
for i in range(len(s)):
    a=int(ord(s[i])-97)
    b=int(ord(t[i])-97)
    if start[a]!=-1 or goal[b]!=-1:
        if start[a]!=b or goal[b]!=a:
            print("No")
            sys.exit()
    else:
        start[a]=b
        goal[b]=a
print("Yes")

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

int main() {
  int r,g,b,n;
  cin>>r>>g>>b>>n;
  int cnt = 0;
  for (int i = 0; i <= n/r; i++)
    for (int j = 0; j <= n/g; j++)
      if (n-i*r-j*g >= 0 && (n-i*r-j*g)%b==0)
        cnt++;
  cout << cnt << endl;
}

Measured memory_bytes: 256