akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }


        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var A = cin.ReadInt;
            var ans = N * N - A;
            WriteLine(ans);
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;

int parent[100010], sz[100010]; // サイズを忘れずに入れる

int root(int a)
{
    if(parent[a]==a)    return a;
    else    return (parent[a]=root(parent[a]));
}

bool same_set(int a, int b)
{
    return (root(a)==root(b));
}

void unite(int a, int b)
{
    if(root(a)!=root(b))
    {
        if(sz[root(a)]<sz[root(b)]) swap(a, b);
        sz[root(a)]+=sz[root(b)];
        parent[root(b)]=root(a);
    }
}
int main()
{
    // P[]とsz[]のサイズを入れる
    int n;
    cin >> n;
    // 読み込み
    repp(i, 1, n+1)
    {
        parent[i]=i;
        sz[i]=1;
    }
    int m; cin >> m;
    rep(i, m)
    {
    	int a, b;
    	cin >> a >> b;
    	unite(a, b);
    }
    set<int> s;
    rep(i, n)
    {
    	s.insert(root(i+1));
    }
    cout << s.size()-1 << endl;
    return 0;
}

Measured memory_bytes: 8276
#include <bits/stdc++.h>
using namespace std;
 
/*てんぷれぞーん！*/
//static const int INF = 2147483647;
static const int INF = 1000000000;
static const long long llINF = 9223372000000000000;
static const int NIL = -1;
static const int MOD = 1000000007;
typedef long long ll;
typedef pair<int,int> P;
struct edge {int to,cost;};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
/* t y p o っ て 知 っ て る ゥ ！ ？ */
#define itn int
#define scnaf scanf
#define reutnr return
/*必要に応じて使ってね*/
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll
//#define INF llINF

int output[55][55];
char field[55][55];
int h,w;

int search(int y,int x){
    int res = 0;
    if(field[y][x] == '#') return INF;
    for(int i=0;i<8;i++){
        if(0<=y+dy8[i] && y+dy8[i]<h && 0<=x+dx8[i] && x+dx8[i]<w){
            if(field[y+dy8[i]][x+dx8[i]] == '#') res++;
        }
    }
    return res;
}

signed main(){
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++){
        scanf("%s",&field[i]);
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            output[i][j] = search(i,j);
        }
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(output[i][j]==INF) printf("#");
            else printf("%d",output[i][j]);
        }
        printf("\n");
    }
}

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

int main()
{
    int N;
    cin >> N;
    int s=1;
    vector <int> d(N);
    for (int i=0;i<N;i++) cin >> d[i];
    sort(d.begin(),d.end(),greater<int>());
    for (int i=0;i<N-1;i++)
    {
        if (d[i]>d[i+1]) s++;
    }
    cout << s<< endl;
return 0;
}

Measured memory_bytes: 256
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int k; rd(k);

  int n=1;
  while((1<<n)<=k) n++;
  struct E{int u, v, w;}
  E[] edges;
  int w=0;
  for(int i=1; i<n; i++){
    edges~=E(i, i+1, 0);
    edges~=E(i, i+1, 1<<(n-i-1));
    w+=(1<<(n-i-1));
  }

  if(w<(k-1)){
    w=0;
    for(int i=2; i<=n; i++){
      if(k&(1<<(n-i))){
        edges~=E(1, i, (1<<(n-1))+w);
        w+=(1<<(n-i));
      }
    }
  }

  writeln(n, " ", edges.length);
  foreach(e; edges){
    writeln(e.u, " ", e.v, " ", e.w);
  }
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


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

int main()
{
	int test1[31],test2[31];
	
	for(int i=0;i<28;i++){
		cin>>test1[i];
	}
	for(int i=1;i<31;i++){
		test2[i]=0;
	}
	for(int p=0;p<28;p++){
		for(int y=1;y<31;y++){
			if(test1[p]==y){
				test2[y]=1;
			}
		}
	}
	for(int r=1;r<31;r++){
		if(test2[r]==0){
			cout<<r;
			cout<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <iostream>
#define ri register int
using namespace std;
 
typedef long long LL;
const int N = 102;

char ch[N][N];
short le[N][N], up[N][N], dp[N][N][N][N];
 
inline void upd(short &x, short y) {
  if (x < y) x = y;
}
 
int main() {
  int n, m, ex, ey;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i ++) {
    scanf("%s", ch[i] + 1);
    for (int j = 1; j <= m; j ++) {
      le[i][j] = le[i][j - 1];
      up[i][j] = up[i - 1][j];
      if (ch[i][j] == 'o') le[i][j] ++, up[i][j] ++;
      if (ch[i][j] == 'E') ex = i, ey = j;
    }
  }
  short t, ans = 0;
  for (ri U = ex; U; U --)
    for (ri D = ex; D <= n; D ++)
      for (ri L = ey; L; L --)
	for (ri R = ey; R <= m; R ++) {
	  t = dp[U][D][L][R];
	  ans = max(ans, t);
	  if (U - 1 > D - ex) upd(dp[U - 1][D][L][R], t + le[U - 1][min(R, m - (ey - L))] - le[U - 1][max(L - 1, R - ey)]);
	  if (n - D > ex - U) upd(dp[U][D + 1][L][R], t + le[D + 1][min(R, m - (ey - L))] - le[D + 1][max(L - 1, R - ey)]);
	  if (L - 1 > R - ey) upd(dp[U][D][L - 1][R], t + up[min(D, n - (ex - U))][L - 1] - up[max(U - 1, D - ex)][L - 1]);
	  if (m - R > ey - L) upd(dp[U][D][L][R + 1], t + up[min(D, n - (ex - U))][R + 1] - up[max(U - 1, D - ex)][R + 1]);
	}
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int arr[5] ;
    int i , j , k , res = 0;

    for (i = 0 ; i < 5 ;i++)
        cin>> arr[i] ;

    cin >> k ;

    for (i = 0 ; i < 5 ; i ++){
        for (j = i+1 ; j < 5 ;j ++){
           if( (arr[j] - arr[i]) <= k)
            res++;
        }
    }

    if (res == 10)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> w(100);
	for (int i = 0; i < n; i++)
		cin >> w[i];
	int sum1 = 0, sum2 = 0, diff = 0;
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < i; j++)
			sum1 += w[j];
		for (int j = n; j >= i; j--)
			sum2 += w[j];
		if (i == 1)
			diff = abs(sum1 - sum2);
		if (diff > abs(sum1 - sum2))
			diff = abs(sum1 - sum2);
		sum1 = 0;
		sum2 = 0;
	}
	cout << diff;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a<=b){
    for(int i=0;i<b;i++){
    cout << a;
    }
  }else{
    for(int i=0;i<a;i++){
    cout << b;
    }
  }
  return 0;
  
}

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

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

    vector<vector<int>> S(M);
    vector<int> P(M);

    for (int i = 0; i < M; i++)
    {
        int k;
        cin >> k;

        for (int j = 0; j < k; j++)
        {
            int s;
            cin >> s;
            S[i].push_back(s);
        }
    }

    for (int i = 0; i < M; i++)
    {
        cin >> P[i];
    }

    // 組み合わせが何通りあるか
    int ans = 0;

    for (int i = 0; i < (1 << N); i++)
    {
        // bit(i)の時いくつの電球が点灯しているか
        int cnt = 0;
        bitset<10> bit(i);

        for (int j = 0; j < M; j++)
        {
            // 繋がっているスイッチのうちonになっているものの個数
            int tmp = 0;

            for (int x : S[j])
            {
                if (bit.test(--x))
                {
                    tmp++;
                }
            }

            // onになっているスイッチの個数を2で割ったあまりがpjに等しいときj番目の電球を点灯しているとしてカウント
            if (tmp % 2 == P[j])
            {
                cnt++;
            }
        }

        // 全ての電球が点灯している時カウント
        if (cnt == M)
        {
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
        int a,b,c,d,j,k;
        while(~scanf("%d%d%d%d",&a,&b,&c,&d))
        {
            j=(a>=c)?a:c;
            k=(b>=d)?d:b;
            if(k-j>=0)
                printf("%d\n",k-j);
            else
                printf("0\n");
        }
        return 0;
}


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

int main(void){
	int N;
	int V[20];
	int C[20];

	cin >> N;

	int i;
	for(i=0;i<N;i++) cin >> V[i];
	for(i=0;i<N;i++) cin >> C[i];

	int max;
	max = 0;

	for(i=0;i<N;i++){
		if(V[i]>C[i]) max+=V[i]-C[i];
	}

	cout << max <<endl;

	return 0;
}




Measured memory_bytes: 256
// E.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <stack>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using pari=pair<lolo, lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORIT(it,v) for (auto it=v.begin(); it!=v.end(); ++it)
#define FORANGE(it, v) for (auto it : v)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define ALL(x) x.begin(), x.end()

int main()
{
	lolo N, Q;
	cin >> N >> Q;
	vector<tuple<lolo, lolo, lolo> > EventVector;

	FOR(i, N) {
		lolo s, t, x;
		cin >> s >> t >> x;
		EventVector.push_back(make_tuple(s - x, lolo(1), x));
		EventVector.push_back(make_tuple(t - x, lolo(-1), x));
	}

	sort(ALL(EventVector));


	vec D(Q);
	FOR(i, Q) cin >> D[i];
	sort(ALL(D));
	
	set<lolo> AreaSet;
	//priority_queue<lolo> AreaSetMin;
	lolo usedIdx = 0;

	vec ANS(Q, -1);
	FOR(i, Q) {
		auto Di = D[i]; // 人のDiに出発
		if (usedIdx < EventVector.size()) {
			while (Di >= get<0>(EventVector[usedIdx])) {
				lolo t, c, x;
				tie(t, c, x) = EventVector[usedIdx];
				if (c == 1) {
					AreaSet.insert(x);
				}
				else {
					auto it = AreaSet.find(x);
					AreaSet.erase(it);
				}
				usedIdx += 1;
				if (usedIdx >= EventVector.size()) break;
			}
		}


		if (AreaSet.empty()) {
			continue;
		}
		else {
			//auto minV = *min_element(ALL(AreaSet));
			auto minV = AreaSet.begin();
			ANS[i] = *minV;
		}		
	}
	FOR(i, Q) {
		cout << ANS[i] << endl;
	}
	
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 23400
#include <bits/stdc++.h>
#define rep(i,n) REP(i,0,n)
#define REP(i, k, n) for (int(i) = k; (i) <(int)(n); (i)++)
#define vi vector<int>
#define pii pair<int,int>

using ll = long long;

using namespace std;

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

    for (int i = x;;i++){
        bool f = false;
        for (int j = 2; j * j < i; j++)
        {
            f |= (i % j == 0);
        }

        if(!f){
            cout << i << endl;
            break;
        }
    }
}

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

int main(){
    int N = 0;
    cin >> N;
    int max_count = 0;
    for (int i = 1; i < N + 1; i++){
        int count = 0;
        int c = i;
        while (c > 0){
            if (c % 2 != 0) break;
            c = c / 2;
            count++;
        }
        max_count = max(max_count,count);
    }
    cout << pow(2,max_count) << endl;
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 50;
int n;
int d[N];

int32_t main() {

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

    cin >> n;
    for(int i = 0; i < n; ++i) cin >> d[i];

    int ans = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = i+1; j < n; ++j) {
            ans += d[i]*d[j];
        }
    }

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


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

long long X;
int a[11], m;
long long ans;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> X;
	while(X) a[++m] = X % 10, X /= 10;
	reverse(a + 1, a + m + 1);

	for (int i = 1; i <= m; ++i) {
		for (int j = i; j <= m; ++j) {
			long long val = 0;
			for (int k = i; k <= j; ++k) val = 10LL * val + a[k];
			long long res = (1LL << max(0, i - 2)) * (1LL << max(0, m - j - 1)) * val;
			ans += res;
		}
	}

	cout << ans << endl;
}

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

int ans;
 
int main()
{
  int n, m;
  cin >> n >> m;

  map<int, int> dm;
  for (int i = 0; i < m; i++)
  {
    int s, c;
    cin >> s >> c;
    if (dm.count(s) > 0)
    {
      if (dm[s] != c)
      {
        cout << -1 << endl;
        return 0;
      }
      else
      {
        continue;
      }
    }
    dm.emplace(make_pair(s, c));
  }

  if (n == 1)
  {
    if (dm.count(1) > 0) ans = dm[1];
    else ans = 0;
    cout << ans << endl;
    return 0;
  }

  if (dm.count(1) > 0 && dm[1] == 0)
  {
    cout << -1 << endl;
    return 0;
  }

  if (n == 2)
  {
    if (dm.count(2) > 0) ans = dm[2];
    else ans = 0;
    if (dm.count(1) > 0) ans += dm[1] * 10;
    else ans += 10;
  }
  
  if (n == 3)
  {
    if (dm.count(3) > 0) ans = dm[3];
    else ans = 0;
    if (dm.count(2) > 0) ans += dm[2] * 10;
    if (dm.count(1) > 0) ans += dm[1] * 100;
    else ans += 100;
  }
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cstdio>
#include <random>
#include <chrono>
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define int long long
using namespace std;

const int INF = 2e17;
const int MOD = 1e9 + 7;

void solve() {
	int n, m;
	cin >> n >> m;
	vector<string> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	vector<vector<int>> dp(n + 1, vector<int>(m + 1));
	dp[1][1] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if ((i == 1 && j == 1) || a[i - 1][j - 1] == '#') continue;
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] %= MOD;
		}
	}
	cout << dp[n][m];
}



signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 9216
#include <iostream>
#include <math.h>
#include <iomanip> 
#include <vector>
#include <unordered_map> 
#include <algorithm>
#include <string> 
#include <set>
#include <numeric>
#include <queue>
#include <map>

using namespace std;
 








int main(){
    
    char a;
    cin >> a;
    cout << (char) (a+1);
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n, int k) {
    return fact[n]*ifact[n-k];
  }
} comb(10000007);
// comb(5, 2) → 10, comb.p(5, 2) → 20
// comb.fact[4] → 24, 2のN乗 → mint(2).pow(N)

int main() {
  int N, K;
  cin >> N >> K;
  int red = N - K;
  for (int i = 1; i <= K; i++) {
    // 青をi個に分ける
    mint ans = comb(red+1, i);
    int remain = K - i;
    ans *= comb(remain+i-1, remain);
    cout << ans << '\n';
  }
  return 0;
}

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

int main() {
  string s; cin >> s;
  int K; cin >> K;
  set<string> st;
  rep(i, 0, s.size()) rep(j, 1, K + 1) {
    if(i + j > s.size()) continue;
    string t = s.substr(i, j);
    st.insert(t);
  }
  auto itr = st.begin();
  rep(i, 0, K - 1) itr++;
  cout << *itr << endl;
  return 0;
}


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

int dp[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}

//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}

//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}

//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}



int main(){  
  int n, a[3005];
  cin >> n ;

  rep(i, n){
    cin >> a[i];
  }


  int ans = 0;
  rep(i, n){
    ans += a[i] -1 ;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;


int main(){
    long long n;
    cin>>n;
    vector<long long> a(n);
    rep(i,n) cin>>a[i];
    sort(ALL(a));
    cout<<a[n/2]-a[n/2-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint a,b,c,k,ans=0;
	cin>>a>>b>>c>>k;
	while(k!=0){
		if(a!=0){
			ans+=1;
			a--;			
		}else if(b!=0){
			ans+=0;
			b--;
		}else{
			ans+=-1;
			c--;
		}	
		k--;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>i_i;
int main() {
	
int N;
cin>>N;
vector<long int>H(N);

for(int i=0;i<N;i++){
	cin>>H.at(i);
}
  
int max=0;
int count=0;
long int memo=H.at(0);
  
  for(int i=1;i<N;i++){
          if(memo>=H.at(i)){
              memo=H.at(i);
              count++;
                  if(count>max) max=count;
          }
          else {
              memo=H.at(i);
              count=0;
          }
  }





cout<<max<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;
ll a, b, c, i, j, k, n, m;
ll arr[100005];
int main() {
	for (a = 1; a <= 100; a++) {
		for (b = 1; b <= 100; b++) {
			for (c = 1; c <= 100; c++) {
				if (a * a + b * b + c * c + a * b + b * c + a * c > 10000)
					break;
				arr[a * a + b * b + c * c + a * b + b * c + a * c]++;
			}
		}
	}
	cin >> n;
	for (i = 1; i <= n; i++)
		cout << arr[i] << '\n';
	return 0;
}

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

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> vec(m);
	for (int i = 0; i < m; i++) cin >> vec.at(i);
	int left, right = 0;
	for (int i = 0; i < m; i++) {
		if (vec.at(i) < x) left++;
		else right++;
	}
	int ans = min(left, right);
	cout << ans << endl;
}

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

using namespace std;

long long int maxim(long long int a,long long int b)
{

if(a>b)
{

    return a;
}
return b;
}

long long int minim(long long int a,long long int b)
{

if(a<b)
{

    return a;
}
return b;
}

long long int gcd(long long int a,long long int b)
{

if(b==0)
{

    return a;
}
return gcd(b,a%b);
}

long long int power(long long int a, long long int b)
{
    if(b==0)
    {
        return 1;
    }
    if(b==1)
    {
        return a;
    }
    long long int c = 1;
    while (b)
    {
        if (b & 1){
        c = (c * a)%1000000007;
        }
        a = ((a%1000000007) * (a%1000000007)%1000000007);
        b >>= 1;
    }
    return c;
}

void solve()
{
long long int n;
cin>>n;
int a[100000];
int b[100000];
int c[100000];
long dp[100000][3];
long long int i,j;
for(i=0;i<n;i++)
{

        cin>>a[i]>>b[i]>>c[i];

}

dp[0][0]=a[0];
dp[0][1]=b[0];
dp[0][2]=c[0];

for(i=1;i<n;i++)
{
    for(j=0;j<3;j++)
    {
        if(j==0)
            dp[i][j]=a[i]+maxim(dp[i-1][1],dp[i-1][2]);

        if(j==1)
            dp[i][j]=b[i]+maxim(dp[i-1][0],dp[i-1][2]);


        if(j==2)
            dp[i][j]=c[i]+maxim(dp[i-1][0],dp[i-1][1]);
    }



}

cout<<maxim(dp[n-1][0],maxim(dp[n-1][1],dp[n-1][2]))<<endl;
}

int main()
{

long long int t;

    solve();

return 0;
}


Measured memory_bytes: 3712
#include<stdio.h>

void insertionSort(int*,int);
void print(int*,int);

int main(){
  int i,N;
  int A[1000];

  scanf("%d",&N);

  for(i = 0 ; i < N ; i++){
    scanf("%d",&A[i]);
  }
  
  print(A,N);
  insertionSort(A,N);

  return 0;
}

void print(int *A,int N){
  int i;
  for(i = 0 ; i < N ; i++){
    if(i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}
    

void insertionSort(int *A,int N){
  int i,j,v;

  for(i = 1 ; i < N  ; i++){
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
      A[j+1] = v;
    print(A,N);
  }
}
  

  



Measured memory_bytes: 2128
import sys
s=input()
ss=s+s
t=input()
l=len(s)
d={}
for i in range(26):
    d[chr(ord("a")+i)]=i
ref=[[] for _ in range(26)]
for i in range(2*l):
    ref[d[ss[i]]].append(i)

for i in range(26):
    if ref[i]==[]: ref[i].append(-1)

tmp=[0 for i in range(26)]
next=[[-1]*26 for i in range(l)]
for i in range(l):
    tmp[d[s[i]]]+=1
    for j in range(26):
        next[i][j]=ref[j][tmp[j]]

p=s.find(t[0])
if p==-1: print(-1);sys.exit()
ans=p

for i in range(1,len(t)):
    x=d[t[i]]
    q=next[p][x]
    if q==-1: print(-1);sys.exit()
    ans+=-p+q
    p=q%l
print(ans+1)

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

int main() {
  int N;
  string b = "R";
  string a;
  cin >> N;
    
   for (int i=0;i < N;i++){
     cin >> a;
     if ( a == "P" ){
       continue;
     } 
     if ( a == "W" ){
       continue;
     }
     if ( a == "G" ){
       continue;
     }
     if ( a == "Y" ){
      b = "Y";
       break;
     }
    
   }
    if ( b == "Y" ){
      cout << "Four" << endl;
    }
    if ( b == "R"){
    cout << "Three" << endl;
    }
}

Measured memory_bytes: 3608
#include<stdio.h>

int main(){
  int N,ans=0;
  scanf("%d",&N);
  int a[N];
  for (int i = 0; i<N; i++){
    scanf("%d",&a[i]);
  }

  for (int i = 0; i<N; i++){
    if (a[a[i]-1]==i+1){
      ans++;
    }
  }
  printf("%d",ans/2);

  return 0;

}

Measured memory_bytes: 2092
#include  <iostream>
using namespace std;
int main(void){
 long long a,b,c;
 cin >> a >> b >> c;
 long long min = a * b;
 if(b*c < min) min = b * c;
 if(c*a < min) min = c * a;
 if(a * b * c % 2 == 0){
  cout << 0 << endl;
 }else{
  cout << min << endl;
 }
 return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		String str[] = s.nextLine().split("");
		int num = 0;
		for(int i = 0; i < str.length; i++){
			try{
				if(!(str[i].equals(str[i+1]))){
					num++;
				}
			}catch(Exception e){
				
			}
		}
		System.out.println(""+num);
	}
}

Measured memory_bytes: 20364
#include <stdio.h>
int main(void){
	double a,b,c,d,e,f,g;
	for(;~scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f);printf("%.3f %.3f\n",(c*e-b*f)/g+0.,(a*f-c*d)/g+0.))
		g=a*e-b*d;
	return 0;
	}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <utility>

using namespace std;

#define REP(i,n) for(int (i)=(0);(i)<(n);++i)
#define REP1(i,n) for(int (i)=(1);(i)<(n);++i)
#define ll long long

int main(){
    int n,m,l,r,ans;
    cin >> n >> m;
    vector<int> left,right;

    REP(i,m){
        cin >> l >> r;
        left.push_back(l);
        right.push_back(r);
    }

    sort(left.begin(),left.end(),greater<int>());
    sort(right.begin(),right.end());

    ans = right[0]-left[0]+1;
    if(ans<0)ans=0;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
int main(void){
    string x,y;
    cin>>x>>y;
    int len_x=x.size();
    int len_y=y.size();
    int dp[len_x+1][len_y+1];
    for(int i=0;i<=len_y;i++)
    dp[0][i]=0;
    for(int i=0;i<=len_x;i++)
    dp[i][0]=0;
    for(int i=1;i<=len_x;i++){
        for(int j=1;j<=len_y;j++){
            if(x[i-1]==y[j-1])
            dp[i][j]=1+dp[i-1][j-1];
            else
            dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
        }
    }
    int i=len_x;
    int j=len_y;
    string ans;
    while(i>0&&j>0){
        if(x[i-1]==y[j-1])
        {
            ans+=x[i-1];
            i=i-1;
            j=j-1;
        }
        else{
            if(dp[i][j-1]>=dp[i-1][j])
            j=j-1;
            else
            i=i-1;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
int main(){
  char c;
  cin >> c;
  if (c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

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

#define pb push_back
#define int int64_t

int32_t main() {
	int n , m , i , j , k , l;
	cin >> n;
	vector<vector<int>>adj(n+1) , ans(n+1);
	for(i=1;i<=n;++i) {
	    cin >> j >> k >> l;
	    adj[i] = {j , k , l};
	}
	ans[0] = {0 , 0 , 0};
	for(i=1;i<=n;i++) {
	   // cout << "Hi" << endl;
	    ans[i].resize(3);
	    ans[i][0] = adj[i][0] + max(ans[i-1][1] , ans[i-1][2]);
	    ans[i][1] = adj[i][1] + max(ans[i-1][0] , ans[i-1][2]);
	    ans[i][2] = adj[i][2] + max(ans[i-1][1] , ans[i-1][0]);
	}
	cout << *max_element(ans[n].begin() , ans[n].end());
	return 0;
}

Measured memory_bytes: 11136
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        string a = s[0];
        string b = s[1];
        Console.WriteLine(a == "H" ? b == "H" ? "H" : "D" : b == "H" ? "D" : "H");
    }
   
}


Measured memory_bytes: 13140
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();

        if(A>=1&&A<=9&&B>=1&&B<=9){
            System.out.println(A*B);
        }else{
            System.out.println(-1);
        }

        //END

    }
}



Measured memory_bytes: 24020
//Bismillah_hir_rahmanir_rahim


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



int main()
{


    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
    {
        cout<<c<<endl;
    }
    else if(b==c)
    {
        cout<<a<<endl;
    }
    else if(c==a)
    {
        cout<<b<<endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <numeric>
#include <algorithm>
using namespace std;

int main()
{
    int A, B, C ;
	cin >> A >> B >> C;
	if (B > A)
	{
		if (C < B && C >A) cout << "Yes";
		else cout << "No";
	}
	else
	{
		if (C > B && C <A ) cout << "Yes";
		else cout << "No";
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define lli long long int
#define timesave ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;


void solve()
{
    int x, y;
    cin >> x >> y;

    int flag = 0;

    for(int i = 0; i <= 500; i++){
        for(int j = 0; j <= 500; j++){
            int xx = i, yy = j;
            int tot = (2*xx) + (4*yy);
            if(tot == y && (i+j) == x) flag = 1;
        }
    }

    if(flag) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}


int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //timesave; 
    
    int tc = 1;
    //cin >> tc;
    while(tc--) solve();

    return 0;
}

Measured memory_bytes: 3632
/*input
20 3
0 5 15

*/

#include <bits/stdc++.h>


using namespace std;

#define ll long long


vector<ll> prime(10001);
void SieveOfEratosthenes(ll n) 
{ 
    
    
    for(ll i=2;i<10001 && n>0;i++){
        while(n%i==0){
            prime[i]++;
            n = n/i;
        }
    }
    
} 


int main() {
    ll n,k;
    cin>>k>>n;
    ll arr[n+1];
    for(ll i=0;i<n;i++)cin>>arr[i];
    arr[n] = (k-arr[n-1])+(arr[0]);
    arr[n] = arr[n]+arr[n-1];
    //cout<<arr[n]+arr[n-1]<<endl;
    //sort(arr,arr+n);
    ll ans = INT_MIN;
    for(ll i=0;i<n;i++)ans = max(ans,arr[i+1]-arr[i]);
        //cout<<ans<<endl;
    cout<<k-ans<<endl;
    return 0;
}

Measured memory_bytes: 1920
/* 
 * Project: AtCoder Beginners Contest 068 A - ABCxxx
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/06
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int n;

void solve() {

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

}

int main() {

    scanf("%d", &n);

    solve();

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
bool is_ok(const string& s)
{
  return s.find("this")!=-1 || s.find("that")!=-1 || s.find("the")!=-1;
}
int main(void)
{
  string str;
  while( getline(cin,str) ) {
    while( !is_ok(str) ) {
      for(int i=0;i<int(str.size());i++){
	if( !isalpha(str[i]) ) continue;
	str[i]++;
	if(str[i]>'z') str[i]='a';
      }
    }
    cout << str << endl;
  }
}

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

#define int long long

using namespace std;

const int oo = 2e18;

const double pi = acos(-1);

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cout << setprecision(12) << fixed << '\n';

    double R;
    cin >> R;

    cout << 2.0*pi*R << '\n';
    return 0;
}

Measured memory_bytes: 3772
import java.util.Scanner;

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

        String ans = null;
        int a[] = new int[4];

        String num = in.next();

        for(int x = 0; x < a.length; x++)
            a[x] = Integer.parseInt(String.valueOf(num.charAt(x)));

        if((a[0] + a[1] + a[2] + a[3]) == 7) ans = a[0] + "+" + a[1] + "+" + a[2] + "+" + a[3] + "=7";
        else if((a[0] - a[1] - a[2] - a[3]) == 7) ans = a[0] + "-" + a[1] + "-" + a[2] + "-" + a[3] + "=7";
        else if((a[0] + a[1] - a[2] - a[3]) == 7) ans = a[0] + "+" + a[1] + "-" + a[2] + "-" + a[3] + "=7";
        else if((a[0] + a[1] + a[2] - a[3]) == 7) ans = a[0] + "+" + a[1] + "+" + a[2] + "-" + a[3] + "=7";
        else if((a[0] + a[1] - a[2] + a[3]) == 7) ans = a[0] + "+" + a[1] + "-" + a[2] + "+" + a[3] + "=7";
        else if((a[0] - a[1] + a[2] - a[3]) == 7) ans = a[0] + "-" + a[1] + "+" + a[2] + "-" + a[3] + "=7";
        else if((a[0] - a[1] + a[2] + a[3]) == 7) ans = a[0] + "-" + a[1] + "+" + a[2] + "+" + a[3] + "=7";
        else if((a[0] - a[1] - a[2] + a[3]) == 7) ans = a[0] + "-" + a[1] + "-" + a[2] + "+" + a[3] + "=7";

        System.out.println(ans);
    }
}

Measured memory_bytes: 23636
import java.util.*;

public class Main{

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

    int a = Integer.parseInt(sc.next());
    int b = Integer.parseInt(sc.next());
    int c = Integer.parseInt(sc.next());

    if(a == b && b == c){
      System.out.println("No");
    }else if(a == b || b == c || c == a){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21716
#include<iostream>
int main(){
    int n,v[1000000],s,ans=0;
    std::cin>>n;
    for(int i=0;i<n;++i)std::cin>>v[i];
    std::cin>>s;
    for(int i=0;i<s;++i){
        int nn;std::cin>>nn;
        int l=0,r=n-1,mid;
        while(1){
            mid=(l+r)/2;
            if(r-l<2){
                if(v[l]==nn)++ans;
                else if(v[r]==nn)++ans;
                break;
            }
            if(v[mid]==nn){++ans;break;}
            if(nn<v[mid])r=mid;
            if(nn>v[mid])l=mid;
        }
    }
    std::cout<<ans<<std::endl;
    return 0;
}


Measured memory_bytes: 3408
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 0.0000001;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	int t;
	cin >> t;
	ld mx = 0;
	REP(i, t)
	{
		int n, m;
		cin >> n >> m;
		ld sum = 0;
		ld ex = 0;
		REP(j, m)
		{
			int v; ld r;
			cin >> v >> r;
			ex += v*r;
			sum += r;
		}
		chmax(mx, ex*(1 / sum));
	}
	int p, q;
	cin >> p >> q;
	ld sum = 0;
	ld ex = 0;
	REP(j, q)
	{
		int v; ld r;
		cin >> v >> r;
		ex += v*r;
		sum += r;
	}
	if (mx - ex*(1/sum) > EPS) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 3236
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stack>
#include<bitset>
#include<queue>
#include<string>
#include<vector>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,n,a) for(int i=n;i>a;i--)
#define mem0(x) memset(x,0,sizeof(x))
#define memff(x) memset(x,INF,sizeof(x))
#define INF 100000000
using namespace std;
typedef pair<int,int> p;
typedef long long LL;
int aa[15];
int main()
{
    //freopen("input.in","r",stdin);
    int n;
    bitset<10> dis;
    cin>>n;
    while(n--)
    {
        for(int i=1;i<=10;i++)
        cin>>aa[i];
        int all=1024;
        while(all>0)
        {
            dis=static_cast<bitset<10> >(all);
            bool flag=true;
            int left=0,right=0;
            for(int i=1;i<=10;i++)
            {
                if(dis[i-1])
                {
                    if(aa[i]>left)
                    {
                         left=aa[i];
                    }
                    else
                    {
                        flag=false;
                        break;
                    }
                }
                else
                {
                    if(aa[i]>right)
                    {
                        right=aa[i];
                    }
                    else
                    {
                        flag=false;
                        break;
                    }
                }
            }
            if(flag)
            {
                break;
            }
            else all--;
        }
        if(all>0)
        cout<<"YES"<<endl;
        else
        cout<<"NO"<<endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
const int MAXN = 1.1e5;

int N;
vector <int> edge[MAXN];
int dep[MAXN];
int ndep[MAXN];

void gogo (int cloc, int last)
{
    for (int neigh : edge[cloc])
    {
        if (neigh == last) continue;
        dep[neigh] = dep[cloc] + 1;
        gogo (neigh, cloc);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N;
    for (int i = 0; i < N - 1; i++)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;

        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    dep[0] = 0;
    gogo (0, -1);
    for (int i = 0; i < N; i++)
        ndep[i] = dep[i];

    dep[N-1] = 0;
    gogo (N - 1, -1);

    int nc = 0;
    for (int i = 0; i < N; i++)
        if (ndep[i] <= dep[i])
            nc++;

    if (nc * 2 > N)
        cout << "Fennec\n";
    else
        cout << "Snuke\n";
}

Measured memory_bytes: 11392
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    string O, E, ans = ""; cin >> O >> E;
    int e = E.length(), j = 0, k = 0;
    for (int i = 0; i < 2 * O.length(); ++i) {
        if (i % 2 == 0) {
            ans += O[j];
            j++;
        }
        else if (e >= 1){
            ans += E[k];
            e--, k++;
        }
    }
    cout << ans << endl;
}


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

int N, M, dp[302][302], w[302], val[3][302];
void maxUpdate(int& a, int b) { a = max(a, b); }

int knapsack(int v[]) {
	memset(dp, 0, sizeof(dp));
	for (int i=0; i<N; ++i) {
		for (int c=0; c<=M; ++c) {
			if (c < w[i]) dp[i+1][c] = dp[i][c];
			else dp[i+1][c] = max(dp[i][c], dp[i+1][c - w[i]] + v[i]);
		}
	}
	int ret = 0;
	for (int i=0; i<=M; ++i) maxUpdate(ret, dp[N][i]);
	return ret;
}

int main() {
	string dumy;
	while (cin >> N >> M) {
		for (int i=0; i<N; ++i) {	
			cin.ignore();
			getline(cin, dumy);
			cin >> w[i] >> val[0][i] >> val[1][i] >> val[2][i];
		}
		cout << max(knapsack(val[0]), max(knapsack(val[1]), knapsack(val[2]))) << endl;
	}
}


Measured memory_bytes: 3368
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main() {
	map<char, int> mp;
	string S;
	bool check = true;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (mp[S[i]] == 1) check = false;
		mp[S[i]] = 1;
	}
	if (check) cout << "yes" << endl;
	else cout << "no" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> x(n);
	vector<ll> y(n);
	vector<ll> h(n);
	vector<tuple<ll, ll, ll>> res;
	tuple<ll, ll, ll> g = make_tuple(-1, -1, -1);
	for (int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i] >> h[i];
		if (h[i] >= 1) g = make_tuple(x[i], y[i], h[i]);
	}
	for (int i = 0; i < 101; ++i) {
		for (int j = 0; j < 101; ++j) {
			ll q = get<2>(g) + abs(get<0>(g) - i) + abs(get<1>(g) - j);
			q = max(q, 0ll);
			bool elf = true;
			for (int p = 0; p < n; ++p) {
				ll w = q - abs(x[p] - i) - abs(y[p] - j);
				w = max(w, 0ll);
				if (h[p] != w) elf = false;
			}
			if (elf == true) res.push_back(make_tuple(i, j, q));
		}
	}
	if (res.size() == 1) {
		cout << get<0>(res[0]) << ' ' << get<1>(res[0]) << ' ' << get<2>(res[0]);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

long long MOD = 1000000007;

long long x,y;

int main(){
  cin>>x>>y;
  if(abs(x-y) <= 1)cout<<"Brown"<<endl;
  else cout<<"Alice"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;

signed main(){
	cin>>N;
	int ans=0;
	for(int i=1;i<=N;i++){
		ans+=i-1;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
	int n; cin >> n;
	int b[n+5];
	for(int i = 1;i <= n;i++){
		int a;
		scanf("%d",&a);
		b[a] = i;
	}
	printf("%d",b[1]);
	for(int i = 2;i <= n;i++){
		printf(" %d",b[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

    static long ans = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double h = sc.nextDouble();
        double w = sc.nextDouble();
        if (h == 1 || w == 1) ans = 1;
        else {
            double tmp_odd;
            double tmp_even;
            if (h % 2 == 0) {
                tmp_odd = (int) Math.ceil(h / 2);
                tmp_even = (int) Math.ceil(h / 2);
            } else {
                tmp_odd = (int) Math.ceil(h / 2);
                tmp_even = (int) Math.ceil((h - 1) / 2);
            }
            if (w % 2 == 0) {
                ans = (long) (tmp_odd * (Math.ceil(w / 2))) + (long) (tmp_even * (Math.ceil(w / 2)));
            } else {
                ans = (long) (tmp_odd * (Math.ceil(w / 2))) + (long) (tmp_even * (Math.ceil(w / 2) - 1));
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22996
a, b = input().split()

a = int(a)
b = int(b)


sum = a + b
dif = a - b
pro = a * b


def greatest(a, b, c):
    if a > b:
        if a > c:
            return a
        else:
            return c
    else:
        if b > c:
            return b
        else:
            return c


print(greatest(sum, dif, pro))


Measured memory_bytes: 3060
import Foundation

func + (lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> NSDecimalNumber {
    return lhs.adding(rhs)//.decimalNumberByAdding(rhs)
}

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let input = Int(readLine()!)!
    var deposit = 100
    
    for i in 1...Int(pow(10.0, 18.0)){
        deposit += deposit / 100
        if deposit >= input{
            print(i)
            return
        }
    }

}
main()


Measured memory_bytes: 13192
BLACK = '#'
WHITE = '.'

def can_paint(arr, H, W, i, j):
    if (i > 0 and arr[i-1][j] == BLACK):
        return True
    elif (i < H - 1 and arr[i+1][j] == BLACK):
        return True
    elif (j > 0 and arr[i][j-1] == BLACK):
        return True
    elif (j < W - 1 and arr[i][j+1] == BLACK):
        return True
    else:
        return False

def solve():
    # Get Input
    H, W = [int(_) for _ in raw_input().split()]
    arr = []
    for i in range(H):
        row = raw_input() # in str type
        arr.append(row)
    # Solve
    for i in range(H):
        for j in range(W):
            if arr[i][j] == BLACK and not can_paint(arr, H, W, i, j):
                return False
    return True

if __name__ == '__main__':
    ret = solve()
    if ret:
        print 'Yes'
    else:
        print 'No'


Measured memory_bytes: 2696