akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include <iostream> // cin, cout, string
#include <algorithm> // sort, min, max
#include <vector>
#include <utility> // pair, swap
#include <functional>
#include <iomanip> // setprecision
#include <map>
#include <set> // multiset
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <stack>
#include <queue> // priority_queue
#include <deque>
#include <bitset>
#include <complex>

using namespace std;

// #define int long long

using ll = long long;
using ld = long double;

// template<class T1, class T2> using P = pair<T1, T2>;
template<class T> using vec = vector<T>;
template<class T> using mat = vec<vec<T>>;
template<typename T> using func = function<T>;

using pii = pair<int, int>;
using ppi = pair<pii, int>;
using pip = pair<int, pii>;
using ppp = pair<pii, pii>;

using vi = vec<int>;
using mi = mat<vi>; // Graph
using vp = vec<pii>;

constexpr int IINF =  0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
// constexpr int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
constexpr ll MOD = 1e9+7;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)

#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

#define pb push_back
#define mp make_pair
#define mt make_tuple
// eb(*,*) = pb(mp(*,*))
#define eb emplace_back
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))
// #define sum(...) accumulate(range(__VA_ARGS__), 0LL)

#define endl '\n'
#define dec(n) fixed << setprecision(n)
#define zfl(n)  setfill(‘0’) << setw(n)
#define debug(x) cerr << #x << ": " << (x) << endl

template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

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

template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { os << p.first << " " << p.second; return os; }


const int limit = 100007;
using K = pair<string, pii>;
//bool operator<(const K &a, const K &b) { return a.ft == b.ft ? a.sd.ft < b.sd.ft : a.ft < b.ft; };

int N;
multiset<K> list;

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

  cin >> N;
  string S;
  int P;
  rep(i, N) {
    cin >> S >> P;
    list.insert( mp(S, mp(100-P, i+1)) );
  }

  for(auto&& a : list) cout << a.sd.sd << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)

{

int a,b,d,r;

double f;

scanf("%d",&a);

scanf("%d",&b);

d=a/b;

r=a%b;

f=(double)a/(double)b;

printf("%d %d %lf\n",d,r,f);

return 0; }

Measured memory_bytes: 636
k = gets.to_i
a = ""
a = gets.chomp.split(" ").map(&:to_i)

count_kisu = 0
count_gusu = 0
len = 0

if(k%2 == 0)
   len = (k / 2) - 1
else    
    len = k / 2
end

for i in 0..len
    if(a[i]%2 != 0)
        count_kisu += 1
    else
        count_gusu += 1
    end
        
    if(i != k-1-i)
        if(a[k-1-i]%2 != 0)
            count_kisu += 1
        else
            count_gusu += 1
        end
    end
end

#if(count_gusu != 0)
#    print((count_gusu & (count_gusu-1)))
#end
#while count_gusu%2 == 0
#    count_gusu = count_gusu / 2
#    if(count_gusu == 2)
#        flg = 1
#        break
#    end
#end

if(count_kisu%2 != 0)
    print("NO")
elsif((count_kisu%2 == 0) && (k%2 == 0) && (count_gusu != 0) && ((count_gusu & (count_gusu-1))==0))
    print("NO")
else
    print("YES")
end


Measured memory_bytes: 9484
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x,a;
  cin >> x >> a;
  if(x < a) cout << 0;
  else cout << 10;
  return 0;
}


Measured memory_bytes: 256
import sys
a=lambda x: [''.join([chr(97+(ord(i)-97+j)%26) if i.islower() else i for i in x]) for j in range(26)]
value=['this','that','the']
for s in sys.stdin:
    for i in a(s):
        if sum(map(i.count,value))>0:
            print(i[:-1])

Measured memory_bytes: 4220
lines = $stdin.read
array = lines.split("\n")
N = array[0].to_i
L = array[1].split(" ").map(&:to_i).sort
ans = 0

(N-1).downto(0) do |mid|
  (mid-1).downto(0) do |low|
    a = L[mid]
    b = L[low]
    idx = L[0...low].bsearch_index{|c| c > a-b}
    unless idx.nil?
      ans += low - idx
    end
  end
end

puts ans

Measured memory_bytes: 1912
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			long l = in.nextLong();
			long r = in.nextLong();
			if (r - l > 2020) {
				r = l + 2020;
			}
			long ans = Long.MAX_VALUE;
			for (long i = l; i <= r - 1; i++) {
				for (long j = l + 1; j <= r; j++) {
					ans = Math.min(ans, (i * j) % 2019);
				}
			}
			out.println(ans);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll MOD = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

string f(ll n){
    if(n==0) return "";
    n--;
    char s = 'a'+n%26;
    return f(n/26) + s;

}

int main(void)
{
    ll n; cin>>n;
    cout<<f(n)<<endl;
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int tmp[100005],num[100005];
int main()
{
    int n,Sum=0;
    cin>>n;
    tmp[0]=0;
    tmp[n+1]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>tmp[i];
        Sum+=abs(tmp[i]-tmp[i-1]);
    }
    Sum+=abs(tmp[n]);
    for(int i=1;i<=n;i++)
    {
        num[i]=abs(tmp[i]-tmp[i-1])+abs(tmp[i+1]-tmp[i])-abs(tmp[i+1]-tmp[i-1]);
    }
    for(int i=1;i<=n;i++) cout<<Sum-num[i]<<endl;
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}


Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

void y() {
    cout << "Yes" << endl;
    exit(0);
}

void n() {
    cout << "No" << endl;
    exit(0);
}

void Y() {
    cout << "YES" << endl;
    exit(0);
}

void N() {
    cout << "NO" << endl;
    exit(0);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}

/*   kokomade  */

int cnt = 0;
bool is_prime[ 50000 + 1 ];
vector<int> P;
void Eratosthenes( const int N )
{
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;//初期化
    }
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
}

int main() {
    IOS;
    int n,x;cin>>n;
    // int a,b,c;cin>>a>>b>>c;
    string str;cin>>str;

    // vector<int> l(n);
    // vector<string> s(n);
    if(n>=3200)cout<<str;
    else cout<<"red";
    // for(int i=0;i<n;i++){

    // }



    cout<<endl;
    return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


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

double get_convex(double ox, double oy, double ax, double ay, double bx, double by) {
	double oax = ax-ox;
	double oay = ay-oy;
	double obx = bx-ox;
	double oby = by-oy;

	return oax*oby-obx*oay;
}

int main(void) {
	double xa,ya,xb,yb,xc,yc,xd,yd;
	double deg[4];
	
	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd)==8) {
		deg[0] = get_convex(xa, ya, xb, yb, xd, yd);
		deg[1] = get_convex(xb, yb, xc, yc, xa, ya);
		deg[2] = get_convex(xc, yc, xd, yd, xb, yb);
		deg[3] = get_convex(xd, yd, xa, ya, xc, yc);
		
		if(deg[0] < 0 && deg[1] < 0 && deg[2] < 0 && deg[3] < 0) {
			printf("YES\n");
		} else if(deg[0] > 0 && deg[1] > 0 && deg[2] > 0 && deg[3] > 0) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
	
	return 0;
}

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

#define endl '\n'
#define ff first
#define ss second
#define pb pushback

typedef long long llong;
typedef pair<int, int> pii;

int is_prime(llong n) {
	if (n <= 2) {
		return true;
	}
	int root = sqrtl(n);
	int max_factor = -1;
	for (int i = 2; i <= root; i++) {
		if (n % i == 0) {
			max_factor = i;
		}
	}
	return max_factor;
}

void solve() {
	llong n;
	cin >> n;
	int res = is_prime(n);
	if (res == -1) {
		cout << n - 1;
	} else {
		llong other = n / res;
		// cout << res << ' ' << other << '\n';
		llong ans = labs(res - 1) + labs(other - 1);
		cout << ans; 
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	#ifdef LOCAL
		ifstream in("in");
		cin.rdbuf(in.rdbuf());
	#endif
	solve();
}

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

int main() {
	int x[4],y[4],v[2];
	cin >> x[0] >> y[0] >> x[1] >> y[1];
	v[0] = x[1] - x[0];
	v[1] = y[1] - y[0];

	for (int i = 2; i < 4; i++) {
		int t = v[0];
		v[0] = -v[1];
		v[1] = t;
		x[i] = x[i - 1] + v[0];
		y[i] = y[i - 1] + v[1];
	}
	cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "4", "2 1 4 3" ].parse.expand.solve == 2 );
	assert( [ "3", "2 3 1" ].parse.expand.solve == 0 );
	assert( [ "5", "5 5 5 5 1" ].parse.expand.solve == 1 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	as[] -= 1;
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	foreach( i, j; as )
	{
		ans += ( i < j && i == as[ j ] );
	}
	return ans;
}


Measured memory_bytes: 4412
// --------------
// Tejas Pandey  |
// 19 - 01 - 20  |
// ABC #152      |
// --------------

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

#define mod 1000000007
#define vi vector<int>
typedef long long int ll;

int main (void)
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	while(t--)
	{
		//cout << "Case #" << c-t << ": ";
		int n,m;
		cin >> n >> m;
		if(n > m) swap(n,m);
		for(int i = 0;i < m;i++)
			cout << n;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
//#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 9e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/
 
int32_t main()
{
	fastio();
	int n;
	int X;
	cin>>n>>X;
	int ar[n+1];
	int cum[n+1];
	MEMS(cum,0);
	for(int i=1;i<=n;i++)
	{
		cin>>ar[i];
		cum[i]=cum[i-1]+ar[i];
	}
	vector<int> v;
	v.push_back(5);
	v.push_back(5);
	while(v.size()<n+5)
	{
		int tmp=v.back();
		v.push_back(tmp+2);
	}
	int ans=inf;
	for(int siz=n;siz>=1;siz--)
	{
		int pt=n;
		int c=0;
		__int128 cur=0;
		__int128 one=1;
		while(pt>=1)
		{
			cur+=one*v[c++]*(cum[pt]-cum[max(0LL,pt-siz)]);
			pt-=siz;
		}
		cur+=n*X+siz*X;
		if(cur>1e18)continue;
		ans=min(ans,(int)cur);
	}
	cout<<ans<<endl;
}


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


int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    ll a[n],b[m];
    vector<ll> aa(n+1,0);
    for(ll i=0;i<n;i++){
        cin >> a[i];
        aa[i+1]=aa[i]+a[i];
    }
    vector<ll> bb(m+1,0);
    for(ll i=0;i<m;i++){
        cin >> b[i];
        bb[i+1]=b[i]+bb[i];
    }
    ll res=0;
    ll memo=m;
    for(ll i=0;i<=n;i++){
        ll count=k;
        count-=aa[i];
        if(count<0) break;
        while(1){
            if(bb[memo]<=count){
                ll com=i+memo;
                res=max(res,com);
                break;
            }
            memo--;
        }
    }
    cout << res <<endl;
}


Measured memory_bytes: 9592
n, m = map(int, input().split())
a = list(map(int, input().split()))

point = 0
for i in range(n):
    point += a[i]

ans = 'Yes'
sep = point / (4 * m)
a.sort()
a.reverse()
for i in range(m):
    if a[i] < sep:
        ans = 'No'

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

const ll MAX = 1e18;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto &it : A)
  {
    cin >> it;
    if (it == 0)
    {
      cout << 0 << endl;
      return 0;
    }
  }
  ll ans = 1;
  for (int i = 0; i < N; i++)
  {
    if (A[i] <= MAX / ans)
    {
      ans *= A[i];
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3980
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define M   1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }

    }
}
vector<int> vec[200005];
bool vis[200005]={false};
void dfs(vector<int> &t,int u)
{
    vis[u]=true;
    t.push_back(u);
    for(int i=0;i<vec[u].size();i++)
    {
        if(!vis[vec[u][i]])
        {
            dfs(t,vec[u][i]);
        }
    }
}
int main()
{
    ll n,m;
    cin>>n>>m;
    ll u,v;
    ll i,j;
    for(i=0;i<m;i++)
    {
        cin>>u>>v;
        vec[u].push_back(v);
        vec[v].push_back(u);

    }
    int ans=0;
    for(i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            vector<int> t;
            dfs(t,i);
            int f=t.size();
            ans=max(ans,f);
        }
    }
    cout<<ans;


}


Measured memory_bytes: 27580
#include <stdio.h>

struct Card {
  char suit;
  int value;
};

void Bubble(struct Card A[], int n){
  int i,j;
  for(i=0;i<n;i++){
    for(j=n-1;j>=i+1;j--){
      if(A[j].value < A[j-1].value){
	struct Card swap = A[j];
	A[j] = A[j-1];
	A[j-1] = swap;
      }
    }
  }
}

void Selection(struct Card A[],int n){
  int i,j,min;
  for(i=0;i<n;i++){
    min = i;
    for(j=i;j<n;j++){
      if(A[j].value < A[min].value) min = j;
    }
    struct Card change = A[i];
    A[i] = A[min];
    A[min] = change;
  }
}


void print(struct Card A[],int n){
  int i;
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%c%d",A[i].suit,A[i].value);
  }
  printf("\n");
}

int Stable(struct Card C1[],struct Card C2[],int n){
  int i;
  for(i=0;i<n;i++){
    if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
}


int main(){
  struct Card C1[100],C2[100];
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c %d",&C1[i].suit,&C1[i].value);
  }

  for(i=0;i<n;i++)
    C2[i] = C1[i];

  Bubble(C1,n);
  Selection(C2,n);

  print(C1,n);
  printf("Stable\n");
  print(C2,n);
  if( Stable(C1,C2,n) == 1){
    printf("Stable\n");
  }else{
    printf("Not stable\n");
  }

  return 0;
}







Measured memory_bytes: 2104
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int n, minCosts[100000], costs[100000];
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> costs[i];
    }
    minCosts[0] = 0;
    minCosts[1] = abs(costs[1] - costs[0]);
    for (int i = 2; i < n; i++) {
        minCosts[i] = min(minCosts[i - 2] + abs(costs[i] - costs[i - 2]), minCosts[i - 1] + abs(costs[i] - costs[i - 1]));
    }
    cout << minCosts[n - 1] << "\n";
}

Measured memory_bytes: 4360
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	Dice[] dices = new Dice[n];
	for (int i = 0 ; i < n; i++) {
	    String[] input = scan.nextLine().split(" ");
	    int[] face = new int[6];
	    for (int j = 0; j < 6; j++) {
		face[j] = Integer.parseInt(input[j]);
	    }
	    dices[i] = new Dice(face);
	}
	boolean flag = true;
	for (int i = 0; i < dices.length; i++) {
	    for (int j = i+1; j < dices.length; j++) {
		if (dices[i].checkSameDice(dices[j])) {
		    flag = false; 
		}
	    }
	}

	if (flag) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
}
class Dice{
    int NORTH = 4;
    int SOUTH = 1;
    int WEST = 3;
    int EAST = 2;
    int TOP = 0;
    int BOTTOM = 5;
    int[] face = new int[6];
	
    Dice(int[] face){
	this.face = face;
    }

    void setFront(int front){
	while(face[SOUTH] != front){
	    turnRight();
	}
    }
    
    void setTop(int top, int bottom){
	int cnt = 0;
	while((face[TOP] != top || face[BOTTOM] != bottom) && cnt < 4){
	    turnSouth();
	    cnt++;
	}
	cnt = 0;
	while((face[TOP] != top || face[BOTTOM] != bottom) && cnt < 4){
	    turnEast();
	    cnt++;
	}
    }

    void turnRight(){
	turnEast();
	turnSouth();
	turnWest();
    }

    void turnEast(){
	int bottom = face[BOTTOM];
	int west = face[WEST];
	face[BOTTOM] = face[EAST];
	face[EAST] = face[TOP];
	face[WEST] = bottom;
	face[TOP] = west;
    }

    void turnWest(){
	int bottom = face[BOTTOM];
	int east = face[EAST];
	face[BOTTOM] = face[WEST];
	face[WEST] = face[TOP];
	face[EAST] = bottom;
	face[TOP] = east;
    }
	
    void turnNorth(){
	int bottom = face[BOTTOM];
	int south = face[SOUTH];
	face[BOTTOM] = face[NORTH];
	face[NORTH] = face[TOP];
	face[SOUTH] = bottom;
	face[TOP] = south;
    }

    void turnSouth(){
	int bottom = face[BOTTOM];
	int north = face[NORTH];
	face[BOTTOM] = face[SOUTH];
	face[SOUTH] = face[TOP];
	face[NORTH] = bottom;
	face[TOP] = north;
    }
    
    int getFace(int index){
	return face[index];
    }

    int getFront(){
	return face[SOUTH];
    }
    
    int getTop() {
	return getFace(TOP);
    }

    boolean checkSameDice(Dice dice2){
	int top1 = getTop();
	int bottom1 = getFace(BOTTOM);
	dice2.setTop(top1, bottom1);
	int[] side1 = new int[8];
	int[] side2 = new int[4];
	for (int i = 0; i < 4; i++) {
	    side1[i] = getFront();
	    side1[i+4]  = getFront();
	    side2[i] = dice2.getFront();
	    turnRight();
	    dice2.turnRight();
	}
	if (face[TOP] != dice2.getFace(TOP) || face[BOTTOM] != dice2.getFace(BOTTOM)) {
	    return false;
	}
	for (int i = 0; i < 4; i++) {
	    if (side1[0+i] == side2[0] && side1[1+i] == side2[1] && side1[2+i] == side2[2] && side1[3+i] == side2[3]) {
		return true;
	    }
	}
	return false;
    }
}
    

Measured memory_bytes: 27828
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let h1:usize = read();
    let m1:usize = read();
    let h2:usize = read();
    let m2:usize = read();
    let k:usize = read();
    let ans = h2*60 + m2 - h1*60-m1 - k;
    println!("{}", ans);
}

Measured memory_bytes: 2088
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    int N, i, judge=0;
    string S[101];

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> S[i];

        if(S[i][0] == 'Y'){
            judge = 1;
        }
    }

    if(judge == 1){
        cout << "Four" << endl;
    }

    else{
        cout << "Three" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
x_one = sum(A) - 2 * (sum(A[1::2]))
X = [x_one]
for i in range(1,n):
    x = 2 * A[i-1] - X[i-1]
    X.append(x)

X_str = [str(x) for x in X]
ans = ' '.join(X_str)
print(ans)

Measured memory_bytes: 21272
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long x;
  long b;
  long r;
  long an;
  long k;
cin >> x >> b >> r;
  an = x / (b + r) * b;
  k = x % (b + r);
    if(k >= b)
    {
      an += b;}
  else{
    an += k;}
  cout << an << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cal(a,b) ((a+=b)%=mo)
using namespace std;
const int N=2e5+50,mo=1e9+7;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
struct data{
    int x,v;
    bool operator < (const data &c)const{
	return x<c.x;
    }
}w[N];
int st[N],tot,f[N],id[N],v[N],l[N],p[N];
vector<int>g[N];
int main(){
    int n=gi();
    for (int i=1; i<=n; ++i)
	w[i]=(data){gi(),v[i]=gi()};
    sort(w+1,w+n+1);
    sort(v+1,v+n+1);
    for (int i=1; i<=n; ++i)
	w[i].v=lower_bound(v+1,v+n+1,w[i].v)-v;
    for (int i=1; i<=n; ++i)
	l[i]=max(l[i-1],w[i].v);
    for (int i=n,j=n; i; --i)
	j=min(j,w[i].v),g[l[i]].push_back(j);
    p[0]=1;
    for (int i=1; i<=n; ++i)
	p[i]=p[i-1]*2%mo;
    int s=1;
    for (int i=1; i<=n; ++i){
	sort(g[i].begin(),g[i].end());
	for (int j=0; j<g[i].size(); ++j)
	    cal(f[i],1ll*(f[g[i][j]-1]+s)*p[g[i].size()-1-j]%mo);
	cal(s,f[i]),cal(f[i],mo-s);
    }
    cout<<(f[n]+s)%mo;
    return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v;
    int s = 0, sum;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        v.push_back(x);
        s += v[i];
    }
    if(s%n > (n- s%n))
    s = s/n+1;
    else
        s = s/n;
    sum = 0;
    for(int i =0; i < n; i++) {
        int g = abs(s-v[i]);
        sum +=g * g;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=2147483647;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
const int maxn=1405;
int h,w,a[maxn][maxn],b[maxn][maxn],ans;
struct rectangle{
	int height,pos;
};
int solve(int w,int c[]){
	stack<rectangle> s;
	int maxx=0;
	c[w+1]=0;
	for(int i=1;i<=w+1;i++){
		rectangle rect;
		rect.height=c[i];
		rect.pos=i;
		if(s.empty()) s.push(rect);
		else{
			if(s.top().height<rect.height) s.push(rect);
			else if(s.top().height>rect.height){
				int target=i;
				while(!s.empty()&&s.top().height>=rect.height){
					rectangle pre=s.top();
					s.pop();
					int area=pre.height*(i-pre.pos);
					maxx=max(maxx,area);
					target=pre.pos;
				}
				rect.pos=target;
				s.push(rect);
			}
		}
	}
	return maxx;
}
int main(){
	h=read(),w=read();
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			a[i][j]=read();		
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(a[i][j]) b[i][j]=0;
			else b[i][j]=b[i-1][j]+1;
	for(int i=1;i<=h;i++) ans=max(ans,solve(w,b[i]));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 18596
S=input()
S=str(S)
N=len(S)
N=int(N)
if (3<=N<=99)and(N%2==1):
    c=(N-1)/2
    d=c+1
    c=int(c)
    d=int(d)
    S_1=S[0:c]
    S_2=S[d:]
    i=0
    for i in range(0,c):
        a=N-1-i
        a=int(a)
        b=(N-3)/2-i
        b=int(b)
        if (S[a]==S[i])and(S_1[i]==S_1[b])and(S_2[i]==S_2[b]):
            i+=1
            if i==c:
                print("Yes")
        else:
            print("No")
            break

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

int main()
{
  int i,n,m,x,y;
  int kari,x_max=-101,y_min=101;
  
  cin>>n>>m>>x>>y;
  
  for(i=0;i<n;i++){
      cin>>kari;
      if(kari>x_max) x_max=kari;
    }

    for(i=0;i<m;i++){
      cin>>kari;
      if(kari<y_min) y_min=kari;

    }

    if( x<y_min && x_max<y &&  x_max<y_min) cout<<"No War"<<endl;
    else cout<<"War"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

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; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

const ll MOD = 1e9 + 7;
int n, k;


signed main(void) {
    cin >> n >> k;
    ll ans = 0;
    vint sum(n + 2, 0);
    rep(i, n) sum[i + 1] = (sum[i] + (i + 1)) % MOD;
    vint d(n + 2, 0);
    d[0] = 1; d[1] = n + 1;
    repi(i, 2, n + 2) {
        d[i] = i * n % MOD - 2 * sum[i - 1] % MOD + 1;
        if(d[i] < 0) d[i] += MOD;
    }
    repi(i, k, n + 2) {
        ans = (ans + d[i]) % MOD;
    }

    print(ans);

    return 0;
}



Measured memory_bytes: 6360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const ll inf = 0x3f3f3f3f3f;
const ll mod=1e9+7;
ll a[maxn],n;
ll b[maxn];
map<ll,ll>mp;

int main(){
	// ll x,y;
	// cin>>x>>y;
	// ll n;
	// cin>>n;
	// 	 if(n%6==0) cout<<(x+y+mod)%mod;
	// else if(n%6==1) cout<<(x+mod)%mod;
	// else if(n%6==2) cout<<(y+mod)%mod;
	// else if(n%6==3) cout<<(y-x+mod)%mod;
	// else if(n%6==4) cout<<(mod-x)%mod;
	// else if(n%6==5) cout<<(y+mod)%mod;
	ll a,b,c;
	cin>>a>>b>>c;
	ll cnt=0;
	vector<ll> ans;
	for(int i=1;i<=min(a,b);i++)
	{
		if(a%i==0&&b%i==0)
		{
			ans.push_back(i);
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans[c-1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int K = 1e6 + 10;
bool seen[K];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int k;
  cin >> k;
  for (int l = 1, v = 7 % k; !seen[v]; l++, v = (v * 10 + 7) % k) {
    seen[v] = true;
    if (v == 0) {
      cout << l << '\n';
      return 0;
    }
  }
  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 4592
use proconio::marker::Usize1;
fn main() {
    proconio::input! {
        n: usize,
        m: usize,
        k: usize,
        ab: [(Usize1,Usize1);m],
        cd: [(Usize1,Usize1);k],
    }
    let mut r=vec![0;n];
    let mut uf=vec![-1;n];
    for (a,b) in ab {
        r[a]-=1;
        r[b]-=1;
        unite(&mut uf,a,b);
    }
    for i in 0..n {
        r[i]+=count(&mut uf,i)-1;
    }
    for (c,d) in cd {
        if find(&mut uf,c)==find(&mut uf,d) {
            r[c]-=1;
            r[d]-=1;
        }
    }
    println!("{}",itertools::join(r, " "));
}
fn find(uf: &mut Vec<i32>, i: usize) -> usize {
    if uf[i]<0 {
        i
    }
    else {
        uf[i]=find(uf, uf[i]as usize)as i32;
        uf[i]as usize
    }
}
fn unite(uf: &mut Vec<i32>, i: usize, j: usize) {
    let mut i=find(uf, i);
    let mut j=find(uf, j);
    if i==j {
        return;
    }
    if uf[i]<uf[j] {
        std::mem::swap(&mut i, &mut j);
    }
    uf[i]+=uf[j];
    uf[j]=i as i32;
}
fn count(uf: &mut Vec<i32>, i: usize) -> i32 {
    let i=find(uf, i);
    -uf[i]
}

Measured memory_bytes: 10668
n, m = map(int, input().split())
ps = []
for _ in range(m):
    _p, _s = map(str, input().split())
    _p = int(_p)
    ps.append([_p, _s])

f = [True]*(n+1)
ac = [0]*(n+1)
wa = [0]*(n+1)

for p, s in ps:
    if f[p]:
        if s == "AC":
            ac[p] += 1
            f[p] = False
        else:
            wa[p] += 1

ans = [0, 0]
for _f, _ac, _wa in zip(f, ac, wa):
    if not _f:
        ans[0] += _ac
        ans[1] += _wa

print(*ans)


Measured memory_bytes: 24284
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n+1);
    a[0]=0;
    for(ll i=1;i<=n;i++){
        ll _;
        cin>>_;
        a[i]=a[i-1]+_;
    }
    map<ll,ll> mp;
    ll ans=0;
    for(ll i=0;i<=n;i++){
        ans+=mp[a[i]];
        mp[a[i]]+=1;
    } 
    cout<<ans<<endl;
}

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

using namespace std;

int main() {
    int a[9], n, b, bingo[9];
    for (int i = 0; i < 9; ++i) {
        cin >> a[i];
        bingo[i] = 0;
    }
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> b;
        for (int j = 0; j < 9; ++j) {
            if (a[j] == b) bingo[j] = 1;
        }
    }
    for (int i = 0; i < 3; ++i) {
        if (bingo[i * 3] + bingo[i * 3 + 1] + bingo[i * 3 + 2] == 3) {
            cout << "Yes" << endl;
            return 0;
        }
        if (bingo[i] + bingo[i + 3] + bingo[i + 6] == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if (bingo[0] + bingo[4] + bingo[8] == 3) {
        cout << "Yes" << endl;
        return 0;
    }
    if (bingo[2] + bingo[4] + bingo[6] == 3) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/11/20 07:29:11
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int a,b; cin>>a>>b;
  bool ans = a%2==0 or b%2==0;
  cout << (ans ? "Even" : "Odd") << endl;

  return 0;
}


Measured memory_bytes: 256
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define FASTNIBBA   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define lbnd        lower_bound
#define ubnd        upper_bound
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
   int n,h,w; cin>>n>>h>>w;
   cout<<(n-h+1)*(n-w+1);
}
int main()
{
    FASTNIBBA;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,k=parseMap(split(readline()))
    l=sort(parseMap(split(readline())),rev=true)
    ans=0
    for i in 1:k
        ans+=l[i]
    end
    println(ans)

end
main()

Measured memory_bytes: 168292
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)


ll modpow(ll x, ll n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        ll h = modpow(x, n / 2);
        return h * h % MOD;
    } else {
        return x * modpow(x, n - 1) % MOD;
    }
}

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

int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
    int A, B, C;  cin >> A >> B >> C;
    int max_num = max({A,B,C});

    int ans = 3*max_num - A - B - C;
    if (ans%2==0) cout << ans/2 << endl;
    else  cout << (ans+1)/2 + 1 << endl;


    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int>l(n);
  for(int i=0; i<n; i++)cin >> l[i];
  sort(l.rbegin(), l.rend());
  int s=0;
  for(int i=1; i<n; i++)s+=l[i];
  if(l[0]<s)cout << "Yes";
  else cout << "No";
  return 0;
}
  


Measured memory_bytes: 256
fun main (args : Array<String>) {
    readLine()!!
    val list = readLine()!!.split(" ")

    var aList : MutableList<Int> = mutableListOf()
    var d1List : List<Int> = listOf()
    var d2List : List<Int> = listOf()

    for (i in list) {
        aList.add(i.toInt())
    }

    d1List = aList
    d2List = d1List.distinct()

    if (aList.size == d2List.size) {
        println("YES")
    } else {
        println("NO")
    }

}

Measured memory_bytes: 81508
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / __gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(ll i=(ll)(m) - 1;i>=(ll)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) n.begin(), n.end()
#define allr(n) n.rbegin(), n.rend()
#define sp(n) cout << fixed << setprecision(n)
#define pi 3.14159265358979323846
#define inf 1000000007
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int main() {
  rep(i, 365){
    co(18);
  }
}

Measured memory_bytes: 3584
n = gets.to_i
mozi = []
alp = [*('a'..'z')]

if (n / 26) == 0
  puts alp[(n - 1)]
  exit
end
while n != 0
  n -= 1
  d = (n % 26)
  n /= 26
  mozi << alp[d]
end
puts mozi.reverse.join('')


Measured memory_bytes: 14336
import statistics
n = int(input())
a_li = list(map(int,input().split()))
median_low = statistics.median_low(a_li)
median_high = statistics.median_high(a_li)
for i in range(n):
    if a_li[i] <= median_low:
        print(median_high)
    else:
        print(median_low)

Measured memory_bytes: 27192
n,m = map(int, input().split( ))
bit = (1<<m)-1
for i in range(n):
    _, *a, = map(int, input().split( ))
    tmp = 0
    for aj in a:
        tmp |= 1<<(aj-1)
    bit &= tmp



ans = 0
for i in range(m):
   if (bit>>i)&1:
       ans += 1
print(ans)

Measured memory_bytes: 3060
from collections import Counter
d = Counter() 
N, K = map(int, input().split())
A = list(map(int, input().split()))
L = list(set(A))
res = 0
num = []
d.update(A)
if len(L) <= K:
    res = 0

else:
    for i in L:
        num.append(d[i])
    
    num.sort()

    for i in range(len(L) - K):
        res += num[i]

print(res)

Measured memory_bytes: 38808
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int K = scanner.nextInt();
	    int X = scanner.nextInt();
	    
	    if (500 * K >= X) {
	    	System.out.println("Yes");
	    } else {
	    	System.out.println("No");
	    }
	}
	
}	

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


int main() {
    int a,b,t;
    cin>>a>>b;
    
         while (b) {
            t = a;
            a = b;
            b = t % b;
             }
       a < 0 ? cout<<-a : cout<<a;
         
    cout<<endl;
 
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll f(ll n){
	ll N=n;
	bool flag=1;
	while(N){
		if(N%2==0) flag=0;
		N/=2;
	}
	if(flag) return n+1;
	for(ll i=60;i>=0;i--) if(n&1ll<<i){
		return f(n-(1ll<<i));
	}
}

ll n;

int main(){
	cin>>n;
	cout<<f(n)<<endl;
}

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

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define TR(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;
int n, k;
int a[N];

int main() {
    SI(n), SI(k);
    int mx = 0;
    int g = 0;
    for(int i = 0;i < n; ++i) {
        SI(a[i]);
        mx = max(mx, a[i]);
        g = __gcd(g, a[i]);
    }
    bool ok = 1;
    if(mx < k || (k % g))
        printf("IMPOSSIBLE\n");
    else 
        printf("POSSIBLE\n");
    return 0;
}


Measured memory_bytes: 640