akhauriyash/Code-Regression huggingface dataset:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
v = 0
v2 = 0
M = 10**9+7
for i in range(n):
    v += sum(a[i]<a[j] for j in range(i))
    v2 += sum(a[i]<a[j] for j in range(n))
#     print(v,v2)
ans = v*k
ans += v2*(k-1)*k//2
print(ans%M)

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<ll,ll>;

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


ll N, M, S, T;
std::vector<P> A[100100], B[100100];

template <class T>
using priority_queue_with_greater = std::priority_queue<T, std::vector<T>, std::greater<T>>;

priority_queue_with_greater<P> pq;
ll distA[100100], distB[100100];

template <typename T, typename U, int n>
void dijkstra(T s, std::vector<std::tuple<T, U>> (&graph)[n], U (&dist)[n], priority_queue_with_greater<std::tuple<U, T> > &pq){
    std::fill(dist, dist+n, std::numeric_limits<U>::max() / 2);
    dist[s] = 0;
    pq.emplace(dist[s], s);
    
    while(!pq.empty()){
        T u;
        U d;
        std::tie(d, u) = pq.top();
        pq.pop();
        
        if(dist[u] < d){continue;}
        
        for(const auto& p : graph[u]){
            T v;
            U c;
            std::tie(v, c) = p;
            if(dist[v] > d + c){
                dist[v] = d + c;
                pq.emplace(dist[v], v);
            }
        }
    }
}

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

    std::cin >> N >> M >> S >> T;

    for(int i=0;i<M;++i){
        ll u, v, a, b;
        std::cin >> u >> v >> a >> b;

        A[u].emplace_back(v, a);
        A[v].emplace_back(u, a);
        B[u].emplace_back(v, b);
        B[v].emplace_back(u, b);
    }

    dijkstra(S, A, distA, pq);
    dijkstra(T, B, distB, pq);

    std::stack<ll> res;
    ll x = 0ll;
    for(int i=N;i>=1;--i){
        x = max(x, 1000000000000000ll - distA[i] - distB[i]);
        res.emplace(x);
    }

    while(!res.empty()){
        ll y = res.top();
        res.pop();

        std::cout << y << std::endl;
    }
}


Measured memory_bytes: 19576
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;

int main(){
	map<string, int> m;
	int n,ac=0,wa=0,tle=0,r=0; cin>>n;
	while(n--){
		string s; cin>>s;
		if(s=="AC")ac++;
		else if(s=="WA")wa++;
		else if(s=="TLE")tle++;
		else r++;
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<r<<endl;
}


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

using namespace std;

#define pb push_back
#define fi first
#define se second

const int N = 1e5 + 1;

typedef pair<int,int> ii;
int n;
int child[N] , vis[N] , d[N] ;
long long ans[N] , tcdall[N] , tcd[N];
vector<ii> adj[N];
vector<int> all , vi[N];

void dfs(int u,int pa){
	child[u] = 1;
	for(int i = 0 ; i < adj[u].size() ; ++ i){
		int v = adj[u][i].fi;
		if(!vis[v] && v != pa){
			dfs(v , u);
			child[u] += child[v];
		}
	}
}
int findcen(int u , int pa , int sz){
	for(int i = 0 ; i < adj[u].size() ; ++ i){
		int v = adj[u][i].fi;
		if(!vis[v] && child[v] > sz/2 && v != pa)
			return findcen(v , u , sz);
	}
	return u;
}
void dfs1(int u,int pa ,int pos){
	for(int i = 0 ; i < adj[u].size() ; ++i){
		int v = adj[u][i].fi , w = adj[u][i].se;
		if(!vis[v] && v != pa){
			d[v] = min(d[u] , w);
			vi[pos].pb(d[v]); all.pb(d[v]);
			dfs1(v,u,pos);
		}
	}
}
void dfs2(int u , int pa , int pos){
	int pos1 = upper_bound(all.begin(),all.end(),d[u]) - all.begin();
	int pos2 = upper_bound(vi[pos].begin(),vi[pos].end(),d[u]) - vi[pos].begin();
	ans[u] += d[u] * ( all.size() - pos1 + pos2 - vi[pos].size() + 1) + tcdall[pos1-1] - tcd[pos2-1];
	for(int i = 0 ; i < adj[u].size() ; ++i){
		int v = adj[u][i].fi ;
		if(!vis[v] && v != pa)
			dfs2(v,u,pos);
				
	}
}
void centroid(int root){
	dfs(root,root);
	if(child[root] == 1) return;
	int cen = findcen(root,root,child[root]);
	
	vis[cen] = true;
	memset(d,0x3f,sizeof d);
	all.clear();
	
	for(int i = 0 ; i < adj[cen].size() ; ++i){
		int v = adj[cen][i].fi , w = adj[cen][i].se;
		if(!vis[v]){
			vi[i].clear();
			d[v] = w; vi[i].pb(w); all.pb(w);
			dfs1(v,v,i);
		}
	}
	
	sort(all.begin() , all.end());
	for(int i = 0 ; i < all.size() ; ++ i){
		if( i == 0) tcdall[i] = all[i];
		else tcdall[i] = tcdall[i-1] + all[i];
	}
	for(int i = 0 ; i < adj[cen].size() ; ++i){
		int v = adj[cen][i].fi ;
		if(!vis[v]){
			sort(vi[i].begin() , vi[i].end());
			for(int j = 0 ; j < vi[i].size() ; ++ j){
				if( j == 0) tcd[j] = vi[i][j];
				else tcd[j] = tcd[j-1] + vi[i][j];
			}
			dfs2(v,v,i);		
		}
	}
	ans[cen] += tcdall[all.size()-1];
	for(int i = 0 ; i < adj[cen].size() ; ++i){
		int v = adj[cen][i].fi ;
		if(!vis[v]) centroid(v);
	}
}
signed main(){
	scanf("%d",&n);
	for(int i = 1 ; i < n ; ++ i ){
		int u , v , w;
		scanf("%d%d%d",&u,&v,&w);
		adj[u].pb(ii(v,w));
		adj[v].pb(ii(u,w));
	}
	centroid(1);
	for(int i = 1 ; i<= n ;++ i)
		printf("%lld\n",ans[i]);
}

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

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi std::vector<int>
#define vvi std::vector<std::vector<int> >
#define vpi std::vector<pi >
#define pi std::pair<int,int>
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (int var = (from); var <= ((int)(to)); var++)
#define DOWNTO(var, from, to) for (int var = (from); var >= ((int)(to)); var--)
#define FOR(var, to)		  UPTO(var, 0, (to)-1)
#define DOWN(var, from)	   DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static const int MOD = 1000000007;
static const int INF = ((1<<30)-1);
static const s64 LINF = ((1LL << 62)-1);

struct Comb {
	std::vector<std::vector<s64> > a;
	Comb(int n) { // O(n^2)
		a.resize(n+1);
		FOR(i,n+1) {
			a[i].resize(i+1, 1);
			UPTO(j,1,i-1) a[i][j] = a[i-1][j] + a[i-1][j];
		}
	}
	s64 ncr(int n, int r) {
		assert(n >= 0);
		assert(n <= (int)a.size());
		assert(r >= 0);
		assert(r <= n);
		return a[n][r];
	}
};

#define gc(c) (c)=getchar()
int ri() {
	int c,s=0,r=0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}
s64 rs64() {
	s64 r;
	int c,s;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}

int int_less(const void *a, const void *b) {
	return (*(const int*)a - *(const int*)b);
}
int int_greater(const void *a, const void *b) {
	return (*(const int*)b - *(const int*)a);
}
std::string operator*(const std::string &s, int n){ std::string res; FOR(i,n) res += s; return res; }

template<class T> std::ostream& operator<<(std::ostream& os, std::vector<T> a) { for (auto i : a) os << i << " "; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, std::set<T> a) { for (auto i : a) os << i << " "; return os; }
template<class A, class B> std::ostream& operator<<(std::ostream&os, std::pair<A,B> a) { os << a.fi << "," << a.se; return os; }


int main() {
	int a[5];
	FOR(i,5) a[i] = ri();
	int k = ri();
		std::cout << (a[4] - a[0] <= k ? "Yay!" : ":(") << std::endl;
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  int l = s.size();

  int ans = 0;
  int sum = 0;
  for(int i = 0; i < l; i++){
    char k = s.at(i);
    if(k == 'A' || k == 'C' || k == 'G' || k == 'T') sum++, ans = max(ans, sum);
    else sum = 0;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
from itertools import combinations as comb
s=input()
l=[]
for i in comb(set(s),2):
  a,b=i
  l.extend([a+b+a,b+a+b])
for i in set(s):
  l.extend([i+i])
for i in l:
  a,b=i,len(i)
  c=s.find(a)
  if c!=-1:
    print(c+1,c+b)
    break
else:
  print(-1,-1)

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min(a,b)
#define rmax(a,b) a = max(a,b)

#define fi first
#define se second

const int N = 5e3+10;
ll v[N], vai[N], volta[N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	ll n, k; cin >> n >> k;
	
	fr(i,n) cin >> vai[i], vai[i]--;
	fr(i,n) volta[vai[i]] = i;
	fr(i,n) cin >> v[i];
	
	ll ans = -LLONG_MAX;
	fr(no,n){
		
		vector<int> id(n);
		vector<ll> soma_prev(n);
		
		int cur = no;
		
		ll iter = k;
		ll soma_cur = 0;
		int vid = 0;
		
		{
		vector<int> vis(n);
		while(!vis[cur] and iter){
			soma_prev[cur] = soma_cur;
			id[cur] = vid++;
			soma_cur+=v[cur];
			rmax(ans,soma_cur);
			vis[cur] = 1;
			iter--;
			
			cur = vai[cur];
		}
		}
		
		if(iter){
			ll add = soma_cur - soma_prev[cur];
			ll tam = id[volta[cur]] - id[cur] + 1;
			
			ll mult = iter/tam;
			if(mult) mult--;
			
			soma_cur += mult*add;
			iter -= mult*tam;
			rmax(ans,soma_cur);
			
			while(iter){
				soma_cur+=v[cur];
				rmax(ans,soma_cur);
				iter--;
				
				cur = vai[cur];
			}
		}
	}
	
	cout << ans << "\n";
}

Measured memory_bytes: 3820
#include<stdio.h>

int binarysearch(int a[], int n, int key)
{
	int left = 0;
	int right = n;
	
	while(left < right){
		int mid = (left + right) / 2;
		
		if(a[mid] == key){
			return 1;
		}else if(key < a[mid]){
			right = mid;
		}else{
			left = mid + 1;
		}
	}
	
	return 0;
}

int main()
{
	int n, q, i;
	int count = 0;
	int a[100000];
	int t[50000];
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	
	scanf("%d", &q);
	
	for(i = 0; i < q; i++){
		scanf("%d", &t[i]);
		
		if(binarysearch(a, n, t[i]) == 1){
			count++;
		}
	}
	
	printf("%d\n", count);
	
	return 0;
}


Measured memory_bytes: 2424
N = int(input())

F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

ans = -float('inf')
for i in range(1,1 << 10):
    g = [0] * N
    for j in range(10):
        if i >> j & 1:
            for k in range(N):
                g[k] += F[k][j]
    sub = 0
    for i in range(N):
        sub += P[i][g[i]]
    ans = max(ans, sub)
print(ans)

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

int32_t main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  int k;
  cin>>k>>s;
  if(s.size() <= k){
    cout<<s<<"\n";
  }
  else{
    cout<<(s.substr(0, k)+"...")<<"\n";
  }
}


Measured memory_bytes: 3608
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ISLAND_MAX	100000									// 最大島数
#define D_BRIDGE_MAX	100000									// 最大橋数

// 内部構造体 - 島情報
typedef struct Ild {
	int miDNo;													// 代表番号 0～
	int miCnt;													// 同一グループの島数
} Ild;

// 内部構造体 - 橋情報
typedef struct Brd {
	int miINo1;													// 島１ 0～
	int miINo2;													// 島２ 0～
	long long mlInc;											// 不便さ
} Brd;

// 内部変数
static FILE *szpFpI;											// 入力
static Ild sz1Ild[D_ISLAND_MAX];								// 島
static int siICnt;												// 島数
static Brd sz1Brd[D_BRIDGE_MAX];								// 橋
static int siBCnt;												// 橋数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 代表番号 - 取得
int
fGetDNo(
	int piINo				// <I> 島 0～
)
{
	// 代表チェック
	if (piINo == sz1Ild[piINo].miDNo) {
		return piINo;
	}

	// 下位へ
	sz1Ild[piINo].miDNo = fGetDNo(sz1Ild[piINo].miDNo);

	return sz1Ild[piINo].miDNo;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// 島数・橋数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siICnt, &siBCnt);

	// 島 - 初期化
	for (i = 0; i < siICnt; i++) {
		sz1Ild[i].miDNo = i;
		sz1Ild[i].miCnt = 1;
	}

	// 橋 - 取得
	for (i = 0; i < siBCnt; i++) {
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d%d", &sz1Brd[i].miINo1, &sz1Brd[i].miINo2);
		sz1Brd[i].miINo1--;
		sz1Brd[i].miINo2--;
	}

	// 不便さ - 最大値
	long long llInc = (long long)siICnt * (long long)(siICnt - 1) / 2;

	// 不便さ - セット
	for (i = siBCnt - 1; i >= 0; i--) {
		sz1Brd[i].mlInc = llInc;

		// 代表番号 - 取得
		int liDNo1 = fGetDNo(sz1Brd[i].miINo1);
		int liDNo2 = fGetDNo(sz1Brd[i].miINo2);
		if (liDNo1 == liDNo2) {						// 一致
			continue;
		}

		// 不便さ - 減算
		llInc -= (long long)sz1Ild[liDNo1].miCnt * (long long)sz1Ild[liDNo2].miCnt;

		// 同一グループ化
		sz1Ild[liDNo1].miCnt += sz1Ild[liDNo2].miCnt;
		sz1Ild[liDNo2].miDNo = liDNo1;
	}

	// 不便さ - 表示
	for (i = 0; i < siBCnt; i++) {
		sprintf(lc1Out, "%lld\n", sz1Brd[i].mlInc);
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
		if (strcmp(lc1Buf, lc1Out)) {
			siRes = -1;
		}
#else
		printf("%s", lc1Out);
#endif
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne(0);
#endif

	return 0;
}



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

using namespace std;

int main(){
    int x,y,i;
    vector<int> vx,vy;
    while(1){
        cin>>x>>y;
        if(x==0 && y==0){
            break;
        }
        else{
            vx.push_back(x);
            vy.push_back(y);
        }
    }
    for(i=0; i<vx.size(); i++){
        if(vx[i]>vy[i]){
            int tmp;
            tmp=vx[i];
            vx[i]=vy[i];
            vy[i]=tmp;
        }
        cout<<vx[i]<<" "<<vy[i]<<endl;    
    }   
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

vector<pair<ll, ll>> a;

map<pair<ll, ll>, ll> cache;

ll solve(ll left, ll right){
    const ll cur = a.size() - (right - left);
    if(cur >= a.size()){
        return 0;
    }

    if(cache.count({left, right})){
        return cache[{left, right}];
    }

    ll tmp_l = solve(left + 1, right) + a.at(cur).first * abs(a.at(cur).second - left);
    ll tmp_r = solve(left, right - 1) + a.at(cur).first * abs(a.at(cur).second - (right - 1));
    const ll ret = max(tmp_l, tmp_r);
    cache[{left, right}] = ret;
    return ret;
}

int main(){
    ll n;
    cin >> n;
    REP(i, n){
        ll ai;
        cin >> ai;
        a.emplace_back(ai, i);
    }
    sort(a.rbegin(), a.rend());
    const ll ans = solve(0, n);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 128856
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> h(N, 0);
	REP(i, N) cin >> h[i];
	sort(h.begin(), h.end());

	int ans = (int)INF;
	REP(i, N) {
		if (N <= i + K - 1) {
			break;
		}
		ans = min(ans, h[i + K - 1] - h[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	t, K := ReadString(), ReadInt()
	s := []byte(t)
	for i := 0; i < len(s)-1 && K > 0; i++ {
		if s[i] == 'a' {
			continue
		}
		if K >= (26 - int(s[i]-'a')) {
			K -= 26 - int(s[i]-'a')
			s[i] = 'a'
		}
	}
	if K > 0 {
		s[len(s)-1] += byte(K % 26)
		if s[len(s)-1] > 'z' {
			s[len(s)-1] -= 26
		}
	}
	fmt.Println(string(s))
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 2808
n = int(input())
a = list(map(int,input().split()))
A = a[:]
count_plus=0
count_minus=0
x = 0
y = 0
for i in range(n):
  if i%2==0:
    x+=a[i]
    if x<=0:
      count_plus+=-1*x+1
      a[i]+=-1*x+1
      x=1
  else:
    x+=a[i]
    if x>0:
      count_plus+=x+1
      a[i]+=-1*x-1
      x=-1
for i in range(n):
  if i%2==0:
    y+=A[i]
    if y>=0:
      count_minus+=y+1
      A[i]+=-1*y-1
      y=-1
  else:
    y+=A[i]
    if y<0:
      count_minus+=-1*y+1
      A[i]+=-1*y+1
      y=1
if x==0:
  count_plus+=1
if y==0:
  count_minus+=1
print(min(count_plus,count_minus))

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

int main() {
	long long n;
	cin >> n;
	string ans = "";
	string t[26] = { "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" };
	while (n > 0) {
		if (n % 26 != 0) {
			ans += t[(n % 26) - 1];
			n/= 26;
		}
		else {
			ans += "z";
			n = (n / 26) - 1;
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,x = map(int, input().split())
lst = list(map(int, input().split()))

lst.append(x)
lst.sort()
# print(lst)

dif = [0]*n
for i in range(n):
    dif[i] = lst[i+1]-lst[i]

print(gcd_list(dif))


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

int main () {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  int count = 0;
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = n-1; i > 0; i--) {
      if (a.at(i) < a.at(i-1)) {
        int b = a.at(i), c = a.at(i-1);
        a.at(i) = c;
        a.at(i-1) = b;
        count++;
        flag = true;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == n-1) cout << a.at(i) << endl;
    else cout << a.at(i) << ' ';
  }
  cout << count << endl;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
typedef long long ll;
typedef double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e9;
const ll N = 3005;
const ll bits = 21;
const ll mod = 1e9+7;
const ld pi = 3.14159265358979323846;
 
ll dp[N][N][2],arr[N];

int main(){
    FASTIO;
    PRECISION;

    ll n,temp;
    cin>>n;

    for(int i=1;i<=n;i++){
        cin>>arr[i];

        dp[i][i][0] = arr[i];
        dp[i][i][1] = -arr[i];
    }



    for(int sz = 2;sz<=n;sz++){
        for(int i=1;i+sz-1<=n;i++){
            int j = i+sz-1;

            dp[i][j][0] = max(arr[i]+dp[i+1][j][1],arr[j]+dp[i][j-1][1]);
            dp[i][j][1] = min(-arr[i]+dp[i+1][j][0],-arr[j]+dp[i][j-1][0]);
        }
    }

    cout<<dp[1][n][0]<<"\n";
}

Measured memory_bytes: 139648
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

void solve(){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=a-b;
    if(k%2)cout<<-ans<<"\n";
    else cout<<ans<<"\n";
}

signed main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int l;
  cin >> l;
  int tmp = l - 1;
  int n = 0;
  while (tmp) {
    n++;
    tmp /= 2;
  }
  vector<tuple<int, int, int>> ans;

  if (l == 2) {
    cout << "2 2" << endl;
    cout << "1 2 0" << endl;
    cout << "1 2 1" << endl;
    return 0;
  }
  if (l == 4) {
    cout << "2 4" << endl;
    cout << "1 2 0" << endl;
    cout << "1 2 1" << endl;
    cout << "1 2 2" << endl;
    cout << "1 2 3" << endl;
    return 0;
  }

  FOR(i, 1, n) {
    ans.push_back(make_tuple(i, i + 1, 1 << (n - i - 1)));
    ans.push_back(make_tuple(i, i + 1, 0));
  }

  bool isPow = false;
  FOR(i, 1, 21) {
    if (l == (1 << i)) {
      isPow = true;
      break;
    }
  }

  if (isPow) {
    FOR(i, 1, n) {
      ans.push_back(
          make_tuple(1, min(n - 1, n - i + 1), (~((1 << i) - 1)) & (l - 1)));
    }
  } else {
    REP(i, n - 1) {
      if ((l >> i) & 1) {
        ans.push_back(make_tuple(1, n - i, (~((1 << (i + 1)) - 1)) & l));
      }
    }
  }

  cout << n << " " << ans.size() << endl;
  REP(i, (int)ans.size()) {
    cout << get<0>(ans[i]) << " " << get<1>(ans[i]) << " " << get<2>(ans[i])
         << endl;
  }
}


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

typedef long long ll;
ll n,s, t1,t2, t3, t4, sz, mn = -1, x[N], y[N];
int main()
{
	ll i,j, k, w, r;
	cin >> n >>sz;
	for (i = 0; i < n; i++) {
		scanf ("%lld %lld", &x[i], &y[i]);
	}
	for (i = 0; i < n; i++) {
		for (j = i; j < n; j++) {
			t1 = min(x[i], x[j]);
			t2 = min(y[i], y[j]);
			for (k = 0; k < n; k++) {
				for (w = k; w < n; w++) {
					t3 = max(x[k], x[w]);
					t4 = max(y[k], y[w]);
					s = 0;
					for (r = 0; r < n; r++) {
						if (t1 <= x[r] && x[r] <= t3 && t2 <= y[r] && y[r] <= t4) s++;
					}
					if (s >= sz) {
						ll num = (t3 - t1) * (t4 - t2);
						if (mn == -1 || num < mn) mn = num;
					}
				}
			}
		}
	}
	cout << mn;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
ac, wa, tle, re = 0,0,0,0

for i in range(n):
    s = str(input())
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))

Measured memory_bytes: 9204
object Main extends App {
  val n = scala.io.StdIn.readInt()
  var vInput = scala.io.StdIn.readLine()
  var cInput = scala.io.StdIn.readLine()
  val vArray =  vInput.split(" ").map(_.toInt).toVector
  val cArray =  cInput.split(" ").map(_.toInt).toVector
  val benefitTuple = vArray.zipWithIndex.map { case (v, i) =>
    v - cArray(i)
  }
  val max = benefitTuple.filter(_ > 0).sum
  print(max)
}

Measured memory_bytes: 27336
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;
int main(void){
  int N,M;
  cin >> N >> M;
  
  vector<int>H(N);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  vector<int>ans(N,1);

  vector<vector<int>>A(M,vector<int>(2));
  for(int i=0;i<M;i++){
    cin >> A[i][0] >> A[i][1];
  }
  
  for(int i=0;i<M;i++){
    if(H[A[i][0] - 1] > H[A[i][1] - 1]) ans[A[i][1] - 1] = 0;
    else if(H[A[i][0] - 1] < H[A[i][1] - 1]) ans[A[i][0] - 1] = 0; 
    else if(H[A[i][0] - 1] == H[A[i][1] - 1]){
        ans[A[i][1] - 1] = 0;
        ans[A[i][0] - 1] = 0;
    }
  }
  
  int an = 0;
  for(int i=0;i<N;i++){
    if(ans[i] > 0) an ++;
  }
  
  cout << an << endl;
  
  return 0;
}

                                          

Measured memory_bytes: 9596
def main():
    N = int(input())
    S = list(input())
    if N%2 != 0:
        print("No")
    else:
        N = N//2
        if S[:N] == S[N:]:
            print("Yes")
        else:
            print("No")
    return 0
if __name__ == '__main__':
    main()

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

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (W-r>=x&&x>=r&&H-r>=y&&y>=r) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
fun main(args: Array<String>) {
    val text = readLine()!!
    var result = "NO"

    var tempText = text
    while(true) {
        val replaced = replace(tempText)
        if (tempText == replaced) {
            break
        }
        if (replaced == "") {
            result = "YES"
            break
        }
        tempText = replaced
    }
    print(result)
}

fun replace(text: String): String {
    return if (text.endsWith("dream")) {
        text.substring(0, text.length - "dream".length)
    } else if (text.endsWith("dreamer")) {
        text.substring(0, text.length - "dreamer".length)
    } else if (text.endsWith("erase")) {
        text.substring(0, text.length - "erase".length)
    } else if (text.endsWith("eraser")) {
        text.substring(0, text.length - "eraser".length)
    } else {
        text
    }
}

Measured memory_bytes: 116920
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P; // {to, cost}

long long n;
const long long N = 100010;
vector<P> G[N];
vector<long long> Color(N);

void dfs(long long now, long long pre, long long color, long long acost){ // accumlate_cost
    Color[now] = color; 
    for(long long i = 0; i < G[now].size(); i++){
        P p = G[now][i];
        if(p.first == pre) continue;
        long long to_acost = p.second + acost;
        if(to_acost % 2 == acost % 2) dfs(p.first, now, color, to_acost);
        else dfs(p.first, now, (color == 1 ? 0 : 1), to_acost);
    }
}


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

    cin >> n;
    for(long long i = 0; i < n - 1; i++){
        long long a, b;
        long long c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back({b, c});
        G[b].push_back({a, c});
    }
    
    Color.resize(n);
    
    dfs(0, -1, 1, 0);

    for(long long i = 0; i < n; i++){
        cout << Color[i] << endl;
    }

    return 0;
}

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

typedef long long ll;

ll n, x, d;
map <ll, vector <pair <ll, ll> > > M;

int main() {
	cin >> n >> x >> d;
	if (!d) return cout << (!x ? 1 : n + 1) << endl, 0;
	if (d < 0) x = -x, d = -d;
	for (ll i = 0; i <= n; ++ i) {
		ll base = i * x / d;
		ll low = i * (i - 1) / 2 * d;
		ll high = i * (n * 2 - i - 1) / 2 * d;
		if (low > high) swap(low, high);
		// cerr << low << " " << high << endl;
		M[i * x % d].push_back(make_pair(base + low / d, base + high / d));
	}
	ll ans = 0;
	for (auto p : M) {
		ll x = p.first;
		auto &v = p.second;
		sort(v.begin(), v.end());
		ll lst = -1e18;
		for (pair <ll, ll> y : v) {
			if (lst >= y.first)
				ans += max(0LL, y.second - lst);
			else {
				ans += y.second - y.first + 1;
			}
			lst = max(lst, (ll) y.second);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 22144
# 2019-11-14 20:54:46(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())
    ab = [tuple(int(x) for x in sys.stdin.readline().split()) for _ in range(n)]
    ab.sort(key=lambda x: x[1])

    s = 0
    for i in range(n):
        s += ab[i][0]
        if s <= ab[i][1]:
            continue
        else:
            ans = 'No'
            break
    else:
        ans = 'Yes'
    
    print(ans)

if __name__ == "__main__":
    main()


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

int sy, sx, ty, tx;

int main() {
   cin >> sx >> sy >> tx >> ty;
   string ans = "";

   // Path1
   ans += string(abs(sy - ty), 'U');
   ans += string(abs(sx - tx), 'R');

   // Path2
   ans += string(abs(sy - ty), 'D');
   ans += string(abs(sx - tx), 'L');

   // Path3
   ans += 'L';
   ans += string(abs(sy - ty)+1, 'U');
   ans += string(abs(sx - tx)+1, 'R');
   ans += 'D';

   // Path4
   ans += 'R';
   ans += string(abs(sy - ty)+1, 'D');
   ans += string(abs(sx - tx)+1, 'L');
   ans += 'U';

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
    #include <iomanip>
    #include <cmath>
    #include <queue>
    #include <map>
    #include <cstdlib>
    #include <string>
    using namespace std;
     
    int main()
    {
    	char a, b;
    	cin >> a >> b;
    	if (a == 'H') {
    		if (b == 'H')
    			cout << 'H' << endl;
    		if (b == 'D')
    			cout << 'D' << endl;
    	}
    	if (a == 'D') {
    		if (b == 'H')
    			cout << 'D' << endl;
    		if (b == 'D')
    			cout << 'H' << endl;
    	}
    	return 0;
    }

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

int main(void){
	ll a,b,c,d,e,n;
	cin>>n>>a>>b>>c>>d>>e;
	ll tightest = 1ll<<61;
	tightest = min(tightest, a);
	tightest = min(tightest, b);
	tightest = min(tightest, c);
	tightest = min(tightest, d);
	tightest = min(tightest, e);
	ll r = 5 + (n + tightest-1)/tightest - 1;
	cout<<r<<'\n';
	return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>

using namespace std;

int main() {

	string S;
	cin >> S;

	bool result = true;
	for (int i = 0; i < S.length(); i++)
	{
		if (i % 2)
		{
			if (S[i] != 'L' && S[i] != 'U' && S[i] != 'D')
			{
				result = false;
				break;
			}
		}
		else
		{
			if (S[i] != 'R' && S[i] != 'U' && S[i] != 'D')
			{
				result = false;
				break;
			}
		}
	}
	cout << (result ? "Yes" : "No");
}

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

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	cout << s1[0] << s2[0] << s3[0];
	return 0;
}

Measured memory_bytes: 256
N = int(input())
src = list(map(int,input().split()))
cums = [0]
for a in src:
    cums.append(cums[-1] + a)

ans = float('inf')
for i in range(1,N):
    l = cums[i]
    r = cums[-1] - cums[i]
    ans = min(ans, abs(l-r))
print(ans)

Measured memory_bytes: 24832
n = gets.chomp.to_i
a = []
c = 1
m = 0
n.times do
  i = gets.chomp.to_i
  a << i
  c += 1 if m == i
  if i > m
    m = i
    c = 1
  end
end

if c >= 2
  n.times { puts(m) }
else
  n.times do |i|
    if a[i] != m
      puts(m)
    else
      tmp = a.clone
      tmp.slice!(i)
      puts(tmp.max)
    end
  end
end


Measured memory_bytes: 7036
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(){
   int n, ans=0, t[1000], u[1000];
   bool visited[1000];
   map<int, int> change;
   cin >> n;
   for(int i=0; i<n; i++){
      cin >> t[i];
      change[t[i]]=i; //キーt[i]の値をiに設定
      u[i]=t[i];
      visited[i]=false;
   }
   sort(u, u+n);
   for(int i=0; i<n; i++){
      int w=i, x=0, y=0, z=10000;
      while(!visited[w]){
         z=min(z, t[w]);
         y+=t[w];
         x++;
         visited[w]=true;
         w=change[u[w]];
      }
      if(x>=2)ans+=min(y+z+u[0]*(x+1), y+z*(x-2)); //最小値を使うか
   }
   cout << ans << endl;
   return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


inline int64 modPow(int64 x, int64 n) {
  if(n == 0) return (1);
  int64 ret = modPow(x, n / 2);
  (ret *= ret) %= mod;
  if(n & 1) (ret *= x) %= mod;
  return (ret);
}

inline int64 count1_1(int64 n, int64 k) {
  return (modPow(k, n));
}

int main() {
  int N, K;
  cin >> N >> K;
  cout << count1_1(N, K) << endl;
}






Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << " : " << x << endl

namespace atcoder {
	void judge_outer(bool judge_exp, string ok = "Yes", string ng = "No") {
		if (judge_exp) {
			cout << ok << endl;
		}
		else {
			cout << ng << endl;
		}
	}

	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;
}

using namespace atcoder;

int main() {
	string s;
	cin >> s;
	cout << count(s.begin(), s.end(), '2') << endl;
	return 0;
}

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

typedef long long ll;

int main() {
		ll n;
		vector<ll> v;

		scanf("%lld", &n);
		for ( int i = 0; i < 5; i++ ) {
				ll t;
				scanf("%lld", &t);	
				v.push_back(t);
		}
		sort( v.begin(), v.end() );	

		if ( n <= v[0] ) printf("5\n");
		else printf("%lld\n", 4 + ( (n - 1) / v[0] + 1) );

		return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int n, m;

	cin >> n >> m;

	int A[100][100] = {};
	int b[100] = {};
	int c[100] = {};

	int i, j;

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			cin >> A[i][j];
		}
	}

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

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			c[i] = c[i] + A[i][j] * b[j];
		}
	}

	for (i = 0; i < n; i++)
	{
		cout << c[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
int main(void){
    int N;
    cin >> N;
    
    vector<double> p;
    
    for(int i=0;i<N;i++){
      double tmp;
      cin >> tmp;
      p.push_back(tmp);
    }
    
    double dp[3000][3000];
    
    for(int i=0;i<3000;i++){
      for(int j=0;j<3000;j++){
        dp[i][j] = 0.0;
      }
    }
    
    dp[0][0] = 1.0;
    for(int i=0;i<N;i++){
      for(int j=0;j<=i;j++){
        dp[i+1][j+1] += dp[i][j]*p[i];
        dp[i+1][j] += dp[i][j] *(1.0-p[i]);
      }
    }
    
    double res = 0.0;
    for(int j=(N+1)/2;j<=N;++j){res += dp[N][j];}
    
    cout << fixed << setprecision(10) << res << endl;
}


Measured memory_bytes: 70656
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

// サイズ可変mod
class mod{
    public:
    ll N, M;
    vector<ll>fact;
    vector<ll>inv;
    vector<ll>finv;

    ll m_plus(ll a, ll b){return (a + b) % M;}
    ll m_minus(ll a, ll b){return (a + M - b) % M;}
    ll m_times(ll a, ll b){return (a * b) % M;}
    ll m_pow(ll a, ll b){
        ll ret = 1;
        while(b > 0){
            if(b & 1)(ret *= a) %= MOD;
            (a *= a) %= MOD;
            b >>= 1;
        }
        return ret;
    }

    void update(ll n){
        if(N > n)return;
        for(ll i = N; i <= n; i++){
            fact.push_back(m_times(fact[i - 1], i));
            inv.push_back(m_pow(i, M - 2));
            finv.push_back(m_times(finv[i - 1], inv[i]));
        }
        N = n + 1;
    }

    // 除算
    ll m_divs(ll a, ll b){
        if(N <= b)update(b);
        return m_times(a, inv[b]);
    }

    // N種の要素を並び替えてできる通りの数
    ll m_fact(ll a){
        if(N <= a)update(a);
        return fact[a];
    }

    // 階乗で割る
    ll m_finv(ll a){
        if(N <= a)update(a);
        return finv[a];
    }

    // N種の要素からk個取り出して並べる通りの数
    ll m_nPk(ll n, ll k){
        return m_times(m_fact(n), m_finv(n - k));
    }
    // N種の要素からk個を選ぶ通りの数
    // a個の赤い玉とb個の青い球を並び替える通りは(a+b)C(a)
    ll m_nCk(ll n, ll k){
        if(n < k)return 0;
        return m_times(m_nPk(n, k), m_finv(k));
    }
    // N種の要素からk個を選ぶ通りの数(重複して良い)
    ll m_nHk(ll n, ll k){
        return m_nCk(n + k - 1, k);
    }
    
    mod(ll m = MOD){
        M = m;
        N = 1;
        fact = vector<ll>(1, 1);
        inv = vector<ll>(1, 1);
        finv = vector<ll>(1, 1);
    }
};

int main(){
    mod m;
    ll N, K;
    cin >> N >> K;
    V v(N);
    rep(i, N)cin >> v[i];
    sort(v.begin(), v.end(), greater<ll>());
    ll a = 0;
    rep(i, N)if(i + K <= N){
        ll t = (MOD + v[i]) % MOD;
        a += ((t * m.m_nCk(N - i - 1, K - 1)) % MOD);
        a %= MOD;
    }
    sort(v.begin(), v.end());
    ll b = 0;
    rep(i, N)if(i + K <= N){
        ll t = (MOD + v[i]) % MOD;
        b += ((t * m.m_nCk(N - i - 1, K - 1)) % MOD);
        b %= MOD;
    }
    cout << (a + MOD - b) % MOD << endl;

    return 0;
}

Measured memory_bytes: 3680
// @Problem https://atcoder.jp/contests/abc156/tasks/abc156_c
use proconio::input;

fn main() {
    input! {
        n: u32,
        v: [i32; n],
    }

    let mut a = 100 * 100 * 100;

    for i in 0..101 {
        let mut sum = 0;
        for j in v.iter() {
            sum += (j - i) * (j - i);
        }
        if a > sum {
            a = sum;
        }
    }

    println!("{}", a);

}

Measured memory_bytes: 2160
#include <stdio.h>

#define MAX 100000

int linearSearch(int S[],int T,int n)
{
	int i=0;
	S[n]=T;
	while(S[i]!=T){
		i++;
		if(i==n){return 0;}
	}
	return 1;
}

int main(void)
{
	int n,q,i,cnt=0;
	int S[MAX],T[MAX];
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d",&S[i]);
	}
	
	scanf("%d", &q);
	for(i=0;i<q;i++){
		scanf("%d",&T[i]);
	}
	
	for(i=0;i<q;i++){
		cnt+=linearSearch(S,T[i],n);
	}
	printf("%d\n",cnt);
	
	return 0;
}


Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
int a[45];
int fib(int n)
{
    if(a[n]>0)
        return a[n];
    return a[n]=fib(n-2)+fib(n-1);
}
int main()
{
    a[1]=a[0]=1;
    int n;
    cin>>n;
    cout<<fib(n)<<endl;
    return 0;
}



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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
int main() {
  int a,b;cin>>a>>b;
  int ans=a-b-b;
  if(ans<0)ans=0;
  cout << ans << endl;
}

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

int main()
{
    string s , t;

   cin>>s>>t;
    sort ( s.begin() , s.end() );
    sort( t.begin() , t.end() );
    reverse( t.begin() , t.end() );
    if( s < t)
    {
        cout<<"Yes";
    }
    else cout<<"No";
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,a,temp1,temp2,ans=0;
  cin >> n >> k;
  for(int i=0;i<n;i++){
    cin >> a;
    temp1 = a;
    temp2 = k-a;
    ans += min(temp1,temp2)*2;
  }

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


Measured memory_bytes: 384
def ncr(n,r,mod):
  X = 1
  Y = 1
  for i in range(r):
    X = (X*(n-i))%mod
    Y = (Y*(i+1))%mod
  return (X*pow(Y,mod-2,mod))%mod

N,K = map(int,input().split())
mod = pow(10,9)+7

for i in range(1,K+1):
  ans = (ncr(K-1,i-1,mod)*ncr(N-K+1,i,mod))%mod
  print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define N 10
using namespace std;

int n;
string s[N],dp[(1<<N)][N];
string memo[N][N],ans;

string check(string a,string b){
  int r=0,lena=a.size(),f;
  int lenb=b.size(),cnt;
  for(int i=0;i<lena;i++){
    cnt=f=0;
    for(int j=0;j<lenb;j++){
      if(a[i+j]=='\0'||b[j]=='\0')break;
      if(a[i+j]!=b[j]){
	f=1;
	break;
      }
      cnt++;
    }
    if(!f)r=max(r,cnt);
  }
  string rs="";
  for(int i=r;i<lenb;i++)rs+=b[i];
  return rs;
}

int main(){
  while(1){
    cin>>n;
    if(!n)break;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++){
	if(i==j)continue;
	memo[i][j]=check(s[i],s[j]);
      }
    for(int i=0;i<(1<<n);i++)
      for(int j=0;j<n;j++)dp[i][j]="";
    for(int i=0;i<n;i++)dp[(1<<i)][i]=s[i];
    for(int i=0;i<(1<<n);i++){
      for(int j=0;j<n;j++){
	if(dp[i][j]=="")continue;
	for(int k=0;k<n;k++){
	  if(!(i&(1<<k))){
	    if(memo[j][k]=="")dp[(i|(1<<k))][j]=dp[i][j]+memo[j][k];
	    else if(dp[(i|(1<<k))][k]=="")dp[(i|(1<<k))][k]=dp[i][j]+memo[j][k];
	    else if(dp[(i|(1<<k))][k].size()>dp[i][j].size()+memo[j][k].size())
	      dp[(i|(1<<k))][k]=dp[i][j]+memo[j][k];
	    else if(dp[(i|(1<<k))][k].size()==dp[i][j].size()+memo[j][k].size())
	      dp[(i|(1<<k))][k]=min(dp[(i|(1<<k))][k],dp[i][j]+memo[j][k]);
	  }
	}
      }
    }
    ans=dp[(1<<n)-1][0];
    for(int i=0;i<n;i++){
      if(dp[(1<<n)-1][i]=="")continue;
      if(ans.size()>dp[(1<<n)-1][i].size())ans=dp[(1<<n)-1][i];
      if(ans.size()==dp[(1<<n)-1][i].size())
	ans=min(ans,dp[(1<<n)-1][i]);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1820
import numpy as np

d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[0]*d
for i in range(d):
  ans[i]=np.argmax(s[i]) + 1

for i in range(d):
	print(i%26+1)

Measured memory_bytes: 27376
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int X, A;
    cin >> X >> A;

    if (X < A) print(0);
    else print(10);
    
}


Measured memory_bytes: 3640