akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

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

int col[101][101];

int rest = 0;
int h, w;

int nexty, nextx;

void color(int y, int x, int c){
	if(rest <= 0){
		nexty = y;
		nextx = x;
		return;
	}
	rest--;
	col[y][x] = c;

	for(int i=0; i<4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(ny >= 0 && ny < h && nx >=0 && nx < w && col[ny][nx] == -1){
			color(ny, nx, c);
		}
	}
}

void bfs(int sy, int sx, int c){
	queue<pair<int, int> > que;
	que.push(make_pair(sy, sx));

	while(que.size()){
		if(rest <= 0){
			break;
		}
		pair<int, int> p = que.front(); que.pop();
		int y = p.first;
		int x = p.second;
		col[y][x] = c;
		rest--;

		for(int i=0; i<4; i++){
			int nx = x + dx[i];
			int ny = y + dy[i];
			if(ny >= 0 && ny < h && nx >=0 && nx < w && col[ny][nx] == -1){
				que.push(make_pair(ny, nx));
			}
		}
	}
}

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int n;
	cin >> h >> w;
	cin >> n;

	vector<int> a;
	vector<pair<int, int> > aa;
	for(int i=0; i<n; i++){
		int t;
		cin >> t;
		a.pb(t);
		aa.pb(make_pair(t, i));
	}
	sort(aa.begin(), aa.end(), greater<pair<int, int> >());


	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			col[i][j] = -1;
		}
	}

	/*
	nexty = 0;
	nextx = 0;
	while(now < n){
		if(col[nexty][nextx] == -1){
			rest = a[now];
			color(nexty, nextx, now);
			now++;

			for(int k=0; k<h; k++){
				for(int l=0; l<w; l++){
					if(l != w-1) printf("%d ", col[k][l]+1);
					else printf("%d\n", col[k][l]+1);
				}
			}
			puts("");
		}
	}
	*/
	/*
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(col[i][j] == -1){
				rest = aa[now].first;
				color(i, j, aa[now].second);
				now++;
			}
		}
	}
	*/
	int now = 0;
	rest = a[now];
	for(int i=0; i<h; i++){
		if(i % 2 == 0){
			for(int j=0; j<w; j++){
				col[i][j] = now;
				rest--;
				if(rest == 0){
					now++;
					rest = a[now];
				}
			}
		}else{
			for(int j=w-1; j>=0; j--){
				col[i][j] = now;
				rest--;
				if(rest == 0){
					now++;
					rest = a[now];
				}
			}
		}
	}

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(j != w-1) printf("%d ", col[i][j]+1);
			else printf("%d\n", col[i][j]+1);
		}
	}


	
	return 0;
}


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

int main(void)
{
	int x, h;
	double S;
	
	while (1){
		scanf("%d%d", &x, &h);
		
		if (x == 0 && h == 0){
			break;
		}
		
		S = x * sqrt((4 * h * h) + (x * x)) + (x * x);
		
		printf("%lf\n", S);
	}
	
	return (0);
}

Measured memory_bytes: 632
#include <iostream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
	int x,c=0;
	cin >> x;
	while (x >= 500)
	{
		x -= 500;
		c+=1000;
	}
	while (x >= 5)
	{
		x -= 5;
		c+=5;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

n=int(input())
print(180 * (n - 2))


Measured memory_bytes: 22272
// 解説コード参照

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        double ans = 0;
        for (int i = 1; i <= n; i++) {
            int now = i;
            double tmp = 1.0 / n;
            while (now < k) {
                now *= 2;
                tmp /= 2;
            }
            ans += tmp;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 21204
import java.util.*;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		long[] a = new long[N];
		long[] b = new long[N];
		for(int i=0; i<N; i++) {
			a[i] = sc.nextLong();
			b[i] = sc.nextLong();
		}
		sc.close();
		int r = 1;
		{
			long tempk = K;
			while((tempk = tempk/2) != 0) r++;
		}
		ArrayList<Long> ks = new ArrayList<Long>();
		ks.add(K);
		for(int i=0; i<=r; i++) {
			long tempk = K;
			if((tempk>>>i)%2==0) continue;
			tempk = tempk & ~(pow(2, i));
			if(i!=0) {
				tempk = tempk | (pow(2, i) -1);
			}
			ks.add(tempk);
		}
		long ans = 0;
		for(int i=0; i<ks.size(); i++) {
			long tempans = 0;
			long k = ks.get(i);
			for(int j=0; j<N; j++) {
				if((a[j]|k) == k) {
					tempans += b[j];
				}
			}
			ans = Math.max(ans, tempans);
		}
		System.out.println(ans);
		
	}
	
	static long pow(long a, long r) {
		if(r==0) return 1;
		if(r%2==0) {
			long d = pow(a, r/2);
			return d*d;
		} else {
			return pow(a, r-1) * a;
		}
	}
}


Measured memory_bytes: 91080
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> P(N);
    for (int i = 0; i < N; i++) {
        cin >> P[i];
    }
    vector<ll> area_min(N);
    ll ans = 0;
    ll cur_min = P[0];
    for (int i = 0; i < N; i++) {
        if (P[i] <= cur_min) {
            cur_min = P[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define TR(it,c) for( typeof(c.begin()) it = c.begin(); it != c.end(); ++it )
#define TRR(it,c) for( typeof(c.rbegin()) it = c.rbegin(); it != c.rend(); ++it
#define REP(i,a) for (int i = 0; i < (a); i++)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)

#define DRI(a) int a; scanf("%d", &a);
#define DRII(a, b) int a, b; scanf("%d %d", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c);
#define RI(a) scanf("%d", &a);
#define RII(a, b) scanf("%d %d", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define MM(arr, num) memset((arr), (num), sizeof((arr)))
#define DEB(x) cerr << ">>> " << (#x) << " -> " << (x) << endl;
#define DEBA(x,n) cerr << (#x) << " "; deba((x),(n));
void deba(int * a, int n){ cerr << "| "; REP(i,n) cerr << a[i] << " "; cerr << "|" << endl;}


inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

const int INF = 1<<30;
typedef long long ll;
typedef unsigned long long ull;
/*******************************************************/

ll mod = 1e9+7;

ll invert_mod(ll a, ll p) {
    //DEB(a)
    //DEB(p)

    ll ex = p-2, result = 1;
    while (ex > 0) {
        if (ex % 2 == 1) {
            result = (result*a) % p;
        }
        a = (a*a) % p;
        ex /= 2;
    }
    return result;
}
ll f[323456];

ll  fakt(){
  f[0]  = 1;
  FOR(i ,1, 323000){
    f[i] = (f[i-1] * i ) % mod;
  }
}

ll comb( ll a, ll b){

   // DEB(a)DEB(b)

    ll out = f[a] * invert_mod(   (f[b] * f[a-b] )%mod    , mod );

    return out % mod;
}


int main() {
  fakt();
  DRII(h,w);
  DRII(a,b);

  ll out = 0;// comb( (w-1)+(h-1)  ,  (w-1) );



  FOR(i,1,h-a){
     // DEB(h -a)
      //if(out < mod) out += mod;
      out += ( comb( (b-1) + (i-1) , (i-1) ) * comb( (h-i) +  (w-b-1), (w-b-1) ) ) % mod;
      out %= mod;
  }

  cout << out << endl;


  return 0;
}


Measured memory_bytes: 2816
while True:
    n,k=map(int,input().split())
    if n==0 and k==0: break
    a=[int(input())for _ in range(n)]
    s=sum(a[0:k])
    ss=[s]
    for i in range(k,n):
        s=s+a[i]-a[i-k]
        ss.append(s)
    print(max(ss))


Measured memory_bytes: 11700
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#define lowbit(x) x&-x
using namespace std;
typedef long long ll;
const int maxn = 400007;
const int N = 1e5;
int n,m;
ll tr[maxn];
int val[maxn];
int num[maxn],sum[maxn],c[maxn];

void add(int x,int num){
	for(;x<=n;x+=lowbit(x)){
		tr[x+N]+=num;
	}
}
ll query(int x){
	ll ret=0;
	for(;x;x-=lowbit(x)){
		ret+=tr[x+N];	
	}
	return ret;
}

ll calc(int l,int r,int x){
	memset(tr,0,sizeof(tr));
	for(int i=1;i<=n;i++){
		if(num[i]<=x)val[i]=1;
		else val[i]=-1;
	}
	sum[0]=0;
	for(int i=1;i<=n;i++){
		sum[i]=sum[i-1]+val[i];
		c[i]=sum[i];
	}
	c[n+1]=0;
	sort(c+1,c+1+n+1);int pos=unique(c+1,c+1+n+1)-c-1;
	for(int i=0;i<=n;i++)sum[i]=lower_bound(c+1,c+1+pos,sum[i])-c;
	
	ll ret=0;
	add(sum[0],1);
	for(int i=1;i<=n;i++){
		ret+=query(sum[i]-1);
		add(sum[i],1);
	}
	return ret;
}

int main(){
	scanf("%d",&n);
	int l=1,r=1e9;
	for(int i=1;i<=n;i++){
		scanf("%d",&num[i]);
	}
	ll step=((1ll*n*1ll*(n+1)>>1 )>>1)+1,ans;
	while(l<=r){
		int mid=l+r>>1;
		//cout<<l<<" "<<r<<" "<<mid<<endl;
		if(calc(l,r,mid)>=step)ans=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<ans;
}

Measured memory_bytes: 8320
var fs = require('fs');

var inputs = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
var num = Number(inputs[0]);
var wnums = inputs[1].split(' ').map(function (i) {return Number(i);});
var minimum = null;
for (var t = 1; t < num; t++) {
  var sub = wnums.slice(0, t).reduce(function(c,i) {return c+i;}) - wnums.slice(t).reduce(function(c,i) {return c+i});
  if (sub < 0) {
    sub = -sub;
  }
  if (minimum === null || minimum > sub) {
    minimum = sub;
  }
}
console.log(minimum);


Measured memory_bytes: 7624
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(1,n-1):
    if h[i-1]<h[i]:
        h[i]-=1
    if h[i]>h[i+1]:
        print('No')    
        exit()
else:
    print('Yes')

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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << ":" << #x << " = " << (x) << endl;
#else
#define dbg
#endif

#pragma endregion Macros

int main()
{
    int N;
    cin >>N ;
    vector<int> b(N+1);
    rep(i, N) cin >> b[i + 1];

    stack<int> ans;

    bool noans;
    for (int i = N; i >= 1; i--) {
        noans = true;
        for (int j = b.size() - 1; j >= 1; j--) {
            if(j==b[j]) {
                ans.push(j);
                noans = false;
                b.erase(b.begin()+j);
                break;
            }
        }

        if (noans) break;
    }


    if(noans) {
        cout << -1 << endl;
        return 0;
    }
    while(!ans.empty()){
        cout << ans.top() << endl;
        ans.pop();
    }

}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;
int main(){
  ll n,k,s; cin >> n >> k >> s;
  rep(i,n){
    if(i<k) cout << s;
    else {
      if(s==1||s==2) cout << s+1;
      else cout << s-1;
    }
    cout << " " ;
  }
}


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

ll N;
vector<ll> H;

int main() { 
    cin >> N;
    H.resize(N);
    for (int i = 0; i < N; i++) cin >> H[i];
    ll out = 0, tmp=0;
    for (int i = 0; i<N; i++){
      if(i==N-1){
        out = max(out, tmp);
      } else if (H[i + 1] <= H[i]) {
        tmp++;
      } else {
        out = max(out, tmp);
        tmp = 0;
      }
    }
    cout << out << endl;
    return 0;
}

Measured memory_bytes: 4912
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int N = Convert.ToInt32(Console.ReadLine());
        double num = 1;
        for (int i = 1; i <= N; i++)
        {
            num = (num * i) % 1000000007;
        }
        Console.WriteLine(num);
    }
}

Measured memory_bytes: 18652
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(1000*1000*1000+7)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e18
# define LG 20  
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 (int)1e9+2
# define maxn 100005
# define offset 1005

/*************************************************
struct Coupon {
    ll l;
    ll r;
    ll id;

    Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

    bool operator<(const Coupon& c) { // Sorting
        return l < c.l;    
    }
};

**************************************************/
int main()
{
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++)
  {
     cin >> a[i];
  }
  int pc=0;
  int ans=0;
  int cnt=0;
  for(int i=0;i<n;i++)
  {
     if(a[i]!=pc)
     {
       ans+=(cnt/2);
       pc=a[i];
       cnt=1;
     }
     else
     {
       cnt++;
     }
  }
  ans+=(cnt/2);
  cout << ans;

}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
 
int N;
vector<vector<ll>> dp;
vector<ll> a;
vector<ll> sum;
 
ll dfs(int left, int right) {
	if (left == right) return 0; //くっついてないときのcostは0
	if (dp[left][right] != INF) return dp[left][right]; //すでに計算済みなら返す
	ll cost = sum[right + 1] - sum[left]; //くっつけるcost
	ll res = INF; //[left, right]の解
	for (int k = left; k < right; k++) { //中継地点
		chmin(res, dfs(left, k) + dfs(k + 1, right) + cost);
	}
	return dp[left][right] = res; //dpに格納してから返すのを忘れずに
}
 
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	scanf("%d", &N);
	a.resize(N); for (int i = 0; i < N; i++) scanf("%lld", &a[i]);
	sum.resize(N + 1); for (int i = 0; i < N; i++) sum[i + 1] = sum[i] + a[i]; //a[i]の累積和
 
	//dp[l][r] := [l, r]のmin
	dp = vector<vector<ll>>(N, vector<ll>(N, INF));
 
	//解は[0, N-1]の最小値
	printf("%lld\n", dfs(0, N - 1));
	return 0;
}

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

#define Abs(_A) (_A > 0 ? _A : -(_A))

const int MaxN = 100010;
namespace Steaunk
{
	int n, m, ans, s[MaxN], sta[MaxN], tot, a[MaxN];
	int Point[MaxN], Next[MaxN << 1], To[MaxN << 1], q = 1;
	bool vis[MaxN];
	void Add(int u, int v)
	{
		Next[++q] = Point[u]; Point[u] = q; To[q] = v;
		Next[++q] = Point[v]; Point[v] = q; To[q] = u;
	}
	void dfs(int u, int from)
	{
		s[u] = 0;
		for(int j = Point[u]; j; j = Next[j]) if(To[j] != from && !vis[To[j]])
			dfs(To[j], u);
		if(u != from)
		{
			s[from] += 1 - s[u];
			ans += Abs(1 - s[u]);
			s[u] = 1;
		}
	}
	int dfs1(int u, int from)
	{
		vis[u] = 1; //printf("(%d)\n", u);
		for(int j = Point[u]; j; j = Next[j]) if(j != (from ^ 1))
		{	
			if(vis[To[j]]){ vis[sta[tot++] = u] = 0; return To[j]; }
			int t;
			if(!vis[To[j]] && (t = dfs1(To[j], j)))
			{
				vis[u] = 0;
				//printf("<%d, %d>\n", t, u);
				if(~t) return (sta[tot++] = u) == t ? -1 : t;
				else return t;
			}
		}
		vis[u] = 0;
		return 0;
	}
	void main()
	{
		scanf("%d %d", &n, &m);
		for(int i = 1; i <= n; ++i) Point[i] = 0; q = 1;
		for(int i = 1; i <= m; ++i)
		{
			int u, v;
			scanf("%d %d", &u, &v);
			Add(u, v);
		}
		if(n & 1){ puts("-1"); return ; }
		ans = 0;
		if(m == n - 1) 
		{
			dfs(1, 1);
			if(s[1] != 1) puts("-1");
			else printf("%d\n", ans);
		}
		else
		{
			tot = 0;
			dfs1(1, 0);
			for(int *i = sta; i < sta + tot; ++i) vis[*i] = 1;
			for(int *i = sta; i < sta + tot; ++i) dfs(*i, *i);
			for(int *i = sta; i < sta + tot; ++i) vis[*i] = 0;
			sta[tot] = sta[0];
		//	for(int i = 1; i <= n; ++i) printf("%d ", s[i]); puts("");
		//	for(int *i = sta; i < sta + tot; ++i) printf("[%d] ", *i); puts("");
			for(int i = 1; i < tot; ++i) a[i] = 1 - s[sta[i - 1]] - a[i - 1];
			a[tot] = 1 - s[sta[tot - 1]];
		//	for(int i = 0; i <= tot; ++i) printf("%d ", a[i]); puts("");
			if(tot & 1)
			{
				//if(a[tot] + a[tot - 1] & 1) puts("-1");
				//else 
				{
					int t = (a[tot] - a[tot - 1]) / 2;
				//	printf("%d %d\n", ans, t);
				//	for(int i = 0; i < tot; ++i) printf("%d ", a[i]); puts("");
					for(int i = 0; i < tot; ++i)
						if(i & 1) ans += Abs(a[i] - t);
						else ans += Abs(a[i] + t);
					printf("%d\n", ans);
				}
			}
			else
			{
				if(a[tot] != a[tot - 1]) puts("-1");
				else //median
				{
					//for(int *i = sta; i < sta + tot; ++i) printf("%d ", s[*i]); puts("");
					for(int i = 0; i < tot; ++i) 
						if(i & 1) s[i] = a[i];
						else s[i] = -a[i];
					//for(int i = 0; i < tot; ++i) printf("%d ", a[i]); puts("");
					//for(int i = 0; i < tot; ++i) printf("%d ", s[i]); puts("");
					std::nth_element(s, s + (tot >> 1), s + tot);
					int t = s[tot >> 1];
					//printf("<%d>\n", t);
					for(int i = 0; i < tot; ++i)
						if(i & 1) ans += Abs(a[i] - t);
						else ans += Abs(a[i] + t);
					printf("%d\n", ans);
				}
			}
			//for(int i = 1; i <= tot; ++i) printf("%d ", a[i]); puts("\n");
		}
	}
}
int main()
{
	//int T;
	//scanf("%d", &T);
	//while(T--) 
	Steaunk::main();
	return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main()
{
        fast;
        int a,b,c;
        cin>>a>>b>>c;
        if(a+b+c>=22)
        	cout<<"bust";
        else
        	cout<<"win";
        return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main() {
	int i;
	int count[26] = { 0 };
	char c;
	
	while ((c = getchar()) != EOF) {
		c = tolower(c);

		if (islower(c)) {
			count[c - 'a']++;
		}
	}

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

	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main(){
  int K, S;
  cin >> K >> S;
  int X, Y, Z;
  int counter = 0;
  for(int i = 0; i <= K; i++){
    for(int j = 0; j <= K; j++){
      int z = S - i - j;
      if(z >= 0 && z <= K) counter ++;
    }
  }
  cout << counter << endl;
}

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

bool prime(int n){
  for (int i = 2; i <= int(sqrt(n)); i++){
    if (n % i == 0)
      return false;
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  vector<int> answer;
  int candidate = 11;
  while(answer.size() < n){
    if (prime(candidate))
      answer.push_back(candidate);
    candidate += 10;
  }
  for (int i = 0; i < n; i++)
    cout << answer[i] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a+b>c+d){
        printf("Left\n");
    }else if(a+b<c+d){
        printf("Right\n");
    }else{
        printf("Balanced\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
  
int main(){
  
    int n;
  
    cin >> n;
  
    int p[n],t[n],count=0,tcount;
  
    for(int i=0;i<n;i++){
      cin >> p[i];
      t[i] = p[i];
      //count += p[i];
    }
  
    if(p[0] > p[1]){
      count += p[0] + p[1];
      p[1] = 0;
    }
    else{
      count += p[0]*2;
      p[1] -= p[0];
    }
  
    for(int i=1;i<n-1;i++){
      count += p[i] * 2;
      if(p[i] > p[i+1] ){
        p[i+1] = 0;
      }
      else{
        p[i+1] -= p[i];
      }
    }
  
    if(p[n-1] != 0){
      count += p[n-1];
    }
  
  
  
  
    tcount = t[0];
  
    for(int i=1;i<n-1;i++){
      tcount += t[i] * 2;
      if(t[i] > t[i+1] ){
        t[i+1] = 0;
      }
      else{
        t[i+1] -= t[i];
      }
    }
  
    if(t[n-1] != 0){
      tcount += t[n-1];
    }
  
  
  
    /*int maxp = max(p[0],p[1]);
  
    if(maxp == p[0]){
      count += p[0] + p[1];
      p[0] = p[1] = 0;
    }
    else{
      count += p[0] * 2;
      p[1] -= p[0];
    }
  
  
  
    maxp = max(p[n-2],p[n-1]);
  
    if(maxp == p[n-2]){
      count += p[n-2] * 2;
    }
    else{
      count += p[n-2] + p[n-1];
    }*/
  
    cout << min(count,tcount) << endl;
  
    return 0;
}

Measured memory_bytes: 3104
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;
int main(){
	ll x,y;
	cin>>x>>y;
	if(x%y==0){
		cout<<-1<<endl;
	}else{
		cout<<x<<endl;
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 1000000

int main() {

	LL k, i, itr;
	cin>>k;

	queue<pair<LL, int> >  q;
	vector<LL> vec;

	for(i = 1; i < 10; i++) {
		q.push(MP(i,i));
		vec.PB(i);
	}

	itr = 9;

	while(!q.empty()) {

		LL num = q.front().first;
		LL lastdig = q.front().second;
		q.pop();

		if(itr >= 100000) break;

		for(i = 0; i <=9 ;i++) {
		//	cout<<"NUM " << num << " " <<i<< " " << itr<<endl;
			if(abs(lastdig - i) <= 1) {
				q.push(MP((num*10)+ i, i));
				vec.PB((num*10) + i);
				++itr;
			}
		}

	}

//	for(i = 0; i < 20; i++) cout<<vec[i] << endl;

	cout<<vec[k-1]<<endl;
	return 0;

}

Measured memory_bytes: 5164
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define ll long long
#define cpp boost::multiprecision::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
const double PI = 3.1415926535897932384626433832795;
struct edge {
	int to;
	ll cost;
};
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	string S;
	cin >> S;
	if ((S[0] == S[1] && S[1] == S[2]) || (S[1] == S[2] && S[2] == S[3])) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flush := NewIO()
	defer flush()
	n, m, x := io.ScanInt(), io.ScanInt(), io.ScanInt()

	var possibleCombinations [][]int
	for bit := 0; bit < (1 << uint(n)); bit++ {
		var comb []int
		for j := 0; j < n; j++ {
			if (bit>>uint(j))&1 == 1 {
				comb = append(comb, j+1)
			}
		}
		possibleCombinations = append(possibleCombinations, comb)
	}
	prices :=  make([]int, n)
	bookExpMap := map[int][]int{}
	for i := 0; i < n; i++ {
		prices[i] = io.ScanInt()
		bookExpMap[i] = io.ScanInts(m)
	}

	originalMinPrice := int(math.Pow10(7))
	minPrice := originalMinPrice
	for _, comb := range possibleCombinations {
		exps := make([]int, m)
		var price int
		for _, book := range comb {
			bookIndex := book - 1
			price += prices[bookIndex]
			for i, exp := range bookExpMap[bookIndex] {
				exps[i] += exp
			}
		}

		ok := true
		for _, exp := range exps {
			if exp < x {
				ok = false
			}
		}

		if ok && price < minPrice {
			minPrice = price
		}
	}
	if minPrice == originalMinPrice {
		fmt.Println(-1)
	} else {
		fmt.Println(minPrice)
	}
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 3448
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define S second
#define F first
#define pb push_back
#define mm make_pair
const int MX=2e5;
int N, M, k;
int arr[MX];
int cnt[MX];
vector<pair<int,int> > v1, v2;
int ok;
int solve(int j)
{
    memset(cnt, 0, sizeof cnt);
    for(int i=j; i<N; i+=2)
    {
        cnt[arr[i]]++;
    }
    int ret=0;
    for(int i=1; i<=1e5; i++)
    {
        if(ok) v2.pb(mm(N/2-cnt[i], i));
        else v1.pb(mm(N/2-cnt[i], i));
        ret=max(ret, cnt[i]);
    }
    return N/2-ret;
}
int main()
{
    scanf("%d", &N);
    for(int i=0; i<N; i++)
    {
        scanf("%d", &arr[i]);
        cnt[arr[i]]++;
    }
    if(cnt[arr[0]] == N )
    {
        cout<<N/2;
    }
    else
    {
        solve(0);
        ok=1;
        solve(1);

        sort(v1.begin(), v1.end());
        sort(v2.begin(),v2.end());
        int an=1e9;
        if(v1[0].S == v2[0].S)
        {
            an=min(an, v1[0].F+v2[1].F);
            an=min(an, v1[1].F+v2[0].F);
        }
        else an=v1[0].F+v2[0].F;
        cout<<an;
    }
    return 0;
}


Measured memory_bytes: 3828
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = int(input())

if b[1]-a[1]>0:
  print('NO')
else:
  if abs(a[0]-b[0])>(a[1]-b[1])*t:
    print('NO')
  else:
    print('YES')

Measured memory_bytes: 9120
import java.util.Arrays;
/*
 * 貰うＤＰ
 */
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.close();
        // A[i]：i円引き出す時の最小回数。
        int[] A = new int[N+1];
        Arrays.fill(A, N);
        A[0] = 0;
        for(int n = 1; n <= N; n++){
            for(int i = 1; i <= n; i*=6){
                A[n] = Math.min(A[n], A[n-i]+1);
            }
            for(int i = 1; i <= n; i*=9){
                A[n] = Math.min(A[n], A[n-i]+1);
            }
        }
        System.out.println(A[N]);
    }

}


Measured memory_bytes: 23764
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 2000
#define DIVISOR 1000000007

int main(void) {
    int anum, bnum;
    get_int2(&anum, &bnum);
    static int arr[NUM_MAX];
    static int brr[NUM_MAX];
    fget_array(arr, anum);
    fget_array(brr, bnum);

    static int64_t dp[NUM_MAX+1][NUM_MAX+1];
    int i, j;
    for(i = 0; i <= anum; i++) dp[i][0] = 1;
    for(i = 0; i <= bnum; i++) dp[0][i] = 1;
    for(i = 1; i <= anum; i++) {
        int aval = arr[i-1];
        for(j = 1; j <= bnum; j++) {
            int bval = brr[j-1];
            int64_t ret = 0;
            ret = (ret + dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + DIVISOR)%DIVISOR;
            if(aval == bval) {
                ret = (ret + dp[i-1][j-1])%DIVISOR;
            }
            dp[i][j] = ret;
        }
    }
    printf("%d\n", (int)dp[anum][bnum]);
    return 0;
}

Measured memory_bytes: 31488
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[310];
double dp[310][310][310];
bool used[310][310][310];

double dfs(int x, int y, int z)
{
	if (!x && !y && !z)return 0.0;
	if (used[x][y][z])return dp[x][y][z];
	used[x][y][z] = true;

	double res = 1.0;
	if (x > 0)res += dfs(x - 1, y, z)*(double)x / N;
	if (y > 0)res += dfs(x + 1, y - 1, z)*(double)y / N;
	if (z > 0)res += dfs(x, y + 1, z - 1)*(double)z / N;
	double pz = 1.0 - (double)(x + y + z) / N;
	res /= (1.0 - pz);
	dp[x][y][z] = res;
	return res;
}

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

	int C[3] = { 0 };
	cin >> N;
	rep(i, 0, N)
	{
		cin >> A[i];
		C[A[i] - 1]++;
	}

	cout << fixed << setprecision(15) << dfs(C[0], C[1], C[2]) << endl;

	return 0;
}

Measured memory_bytes: 256256
#include <iostream>
#include <string>
int main(){
	int inning;
	std::cin >> inning;
	for (int i = 0; i < inning; i++) {
		int out = 0;
		int runner = 0;
		int score = 0;
		while (out < 3) {
			std::string event;
			std::cin >> event;
			if (event == "HIT") {
				if (runner == 3) {
					score++;
				}
				else runner++;
			}
			if (event == "OUT") {
				out++;
			}
			if (event == "HOMERUN") {
				score += runner + 1;
				runner = 0;
			}
		}
		std::cout << score << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3152
#include<iostream>
#include<cmath>
#include<stdio.h>
#include <ctype.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<deque> //<< fixed << setprecision()
#include<queue> //priority_queue
#include<vector>
typedef long long ll;
using namespace std;
const double pi = (2 * acos(0));


struct point
{
	long double x, y;
};
double area(int x1, int y1, int x2, int y2, int x3, int y3)
{
	double a = (x2*y3) - (x3*y2) - (x1*y3) + (x3*y1) + (x1*y2) - (x2*y1);
	a /= 2;
	return fabs(a);
}

long double anyarea(point p[], int n)
{
	long double sum1 = p[n - 1].x * p[0].y, sum2 = p[n - 1].y * p[0].x;
	for (int i = 0; i < n - 1; i++)
	{
		sum1 += p[i].x * p[i + 1].y;
		sum2 += p[i].y * p[i + 1].x;
	}
	return  fabs((sum1 - sum2) * 0.5);
}

ll fastpow(ll base, ll p, ll m)
{
	if (p == 0)
		return 1;
	ll ans = fastpow(base, p / 2, m);
	ans = ((ans%m)*(ans%m)) % m;
	if (p % 2)
		ans = ((base%m)*ans) % m;
	return ans;
}
ll GCD(ll M, ll m)
{
	if (M%m == 0)
		return m;
	M %= m;
	ll x1 = M, x2 = m;
	m = min(x1, x2);
	M = max(x1, x2);
	return GCD(M, m);


}
ll lcm(ll M, ll m)
{
	return (M*m) / GCD(max(M, m), min(M, m));

}

int main()
{
	int n;
	int arr[100005][3], ans[100005][3] = {};
	cin >> n;
	for (int i = 0; i<n; i++)
	{
		for (int j = 0; j<3; j++)
		{

			cin >> arr[i][j];
		}
	}
	for (int i = 0; i<n; i++)
	{
		int m[3] = {};
		for (int j = 0; j<3; j++)
		{
			if (i == 0)
				ans[i][j] = arr[i][j];
			else{
				if (j != 0)
					m[0] = max(m[0], ans[i - 1][j]);
				if (j != 1)
					m[1] = max(m[1], ans[i - 1][j]);
				if (j != 2)
					m[2] = max(m[2], ans[i - 1][j]);
			}
		
	}
		for (int j = 0; j<3; j++)
		{
			ans[i][j] = m[j] + arr[i][j];
		}

	}
int res = 0;
	res = max(ans[n - 1][0], max(ans[n - 1][2], ans[n - 1][1]));
	cout << res;




}


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

using namespace std;

void solve() {
    int x, ans;
    for (int i = 0; i < 5; i++)
    {
        cin >> x;
        if (x == 0)
        {
            ans = i+1;  
        }
        
    }
    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	string s;
  	cin >> s;
  	bool Good = true;
	rep(i,s.size()-1){
    	if(s[i] == s[i+1]) {
			Good = false;
        	break;
        }
    }
	if(Good) cout << "Good" << endl;
  	else cout << "Bad" << endl;
  	return;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

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

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

ll res[510][510];

const ll absmx = 1e9;

int main() {
	ll H, W, h, w;
	cin >> H >> W >> h >> w;
	bool flg = false;
	for(int i = h-1; i < H; i += h) {
		for(int j = w-1; j < W; j += w) {
			res[i][j] = -1e9;
		}
	}
	for(int i = 0; i < H; i += h) {
		for(int j = 0; j < W; j += w) {
			res[i][j] = 1e9-1;
		}
	}

	if(W%w || H%h) {
		cout << "Yes" << endl;
		rep(i,H) {
			rep(j,W) {
				if(j) cout << " ";
				cout << res[i][j];
			}
			cout << endl;
		}
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 4864
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int N;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N;
	for (int i = 1; i < 10; ++i)
	{
		if (N % i == 0 && N / i < 10)
		{
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890123456
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =1e5 + 10;

//initialization here
//

//
//initialization finish


// your function is here
//

//
// your function finished

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//

	string s;cin >> s;
	int n = s.size();
	int memo[30];
	rep(i,26) memo[i] = 0;
	

	if(s.size() < 26)
	{
		rep(i,s.size())	memo[(s[i]-'a')] = 1;
		cout << s;
		rep(i,26) if(memo[i] == 0)
		{
			cout << char('a'+ i) << endl;
			return 0;
		}
	}
	else
	{
		int cnt = 25;
		rep(i,n)
		{
			if((s[i]-'a') != cnt) break;
			cnt--;
		}
		if(cnt == -1)
		{
			Print(-1);
			return 0;
		}
		

		// char('a'+cnt)の文字を変えるとよい
		int pre = s[25]-'a';

		FFOR(i,25,-1)
		{
			if(i == 25)
			{
				pre = s[25] - 'a';
				if(pre == 25)
				{
					cnt = i;
					break;
				}
				continue;
			}

			int now = s[i] - 'a';
			if(pre < now)
			{
				pre = now;
			}else{
				cnt = i+1;
				break;
			}
		}

		string ans = "";
		rep(i,cnt -1) ans += s[i];

		rep(i,ans.size()) memo[ans[i]-'a'] = 1;

		cout << ans;
		FOR(i, s[cnt-1]-'a'+1, n) if(memo[i] == 0)
		{
			cout << char('a'+ i) << endl;
			return 0;
		}


		

	}


	//
	// your code finished


	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()

    var map = mutableMapOf<String, Int>()
    var list = mutableListOf<String>()
    var max = 1
    for(i in 1..N){
        val S = scn.next()

        if(map.containsKey(S)) {
            var tmp = map[S]
            if (tmp != null) {
                map[S] = tmp + 1

                if(tmp+1 > max) {
                    max = tmp+1
                    list.clear()
                    list.add(S)
                }else if(tmp+1 == max){
                    list.add(S)
                }
            }
        }else{
            map.put(S,1)
            if(max==1) list.add(S)
        }
    }

    list.sort()

    for(i in list){
        println(i)
    }

}

Measured memory_bytes: 106644
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		d=a;
		a=b;
		b=d;
	}
	if(a>c){
		d=a;
		a=c;
		c=d;
	}
	if(b>c){
		d=b;
		b=c;
		c=d;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;

int main(){
int i,n=read(),m=read();
ll ans=1900*m+(n-m)*100;
for (i=1;i<=m;++i) ans<<=1;
write(ans);
}

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

typedef long long ll;

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

    int N, A, B;

    cin >> N >> A >> B;

    if(N * A < B) {
        cout << N * A << endl;
    } else {
        cout << B << endl;
    }
}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const double PI = acos(-1);

void solve(){
    ll n,k;
    cin>>n>>k;
    int arr[n];
    loop(n,i,0)
        cin>>arr[i];
    ll res=0;
    loop(n,i,0){
        loop(n,j,i+1){
            if(arr[j]<arr[i])
                res=(res+(k*(k+1)/2)%MOD)%MOD;
        }
        loopR(i,j,0)
            if(arr[j]<arr[i])
                res=(res+(k*(k-1)/2)%MOD)%MOD;
    }
    cout<<res%MOD<<Endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3668
#include <iostream>

using namespace std;

int main(void){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  char S1, S2, S3;
  S1 = toupper(s1[0]);
  S2 = toupper(s2[0]);
  S3 = toupper(s3[0]);

  cout << S1 << S2 << S3 << endl;
  
  return 0;
}


Measured memory_bytes: 256