akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

//#include <unordered_map>

//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
//#include <algorithm>
//#include <cstring>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define dd(n) cout<<fixed<<setprecision(n)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define repir(i,a,b) for(int i=(a)-1, i##_first=(b); i>=i##_first; --i)
#define repr(i,n) repir(i,n,0)
#define repir_(i,a,b) for(int i=(a), i##_first=(b); i>=i##_first; --i)
#define repr_(i,n) repir_(i,n,0)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
//template<typename T> T vpop(vector<T> *v) {
//	T res = v->back();
//	v->pop_back();
//	return res;
//}
//char vpop(string *v) {
//	char res = v->back();
//	v->pop_back();
//	return res;
//}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define pi 3.14159265358979
#define co(x) cout<<x<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

#define lint long long
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<lint> lvec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
dx8[8] ={ 0,1,1,1,0,-1,-1,-1 },
dy8[8] ={ 1,1,0,-1,-1,-1,0,1 },
dx4[4] ={ 0,1,0,-1 },
dy4[4] ={ 1,0,-1,0 };

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

int main(){
	setc;

	lint h,w;cin>>h>>w;
	svec s(h);
	rep(i, h)cin>>s[i];

	rep(i, h){
		co(s[i]);
		co(s[i]);
	}
	gc();
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;

int DP[50000][20];
vector<vector<pair<int, int> > > edge(20);
int V;

int solve(int S, int v){
    if(DP[S][v]>=0) return DP[S][v];
    DP[S][v] = inf;
    for(int i=0;i<edge[v].size();++i){
        if((S&(1<<edge[v][i].fi))==0){
            DP[S][v] = min(DP[S][v], solve(S|(1<<edge[v][i].fi), edge[v][i].fi) + edge[v][i].se);
        }
    }
    return DP[S][v];
}

int main() {
    for(int i=0;i<50000;++i){
        for(int j=0;j<20;++j){
            DP[i][j] = -1;
        }
    }
    int E;
    cin>>V>>E;
    DP[(1<<V)-1][0] = 0;
    int s, t, d;
    for(int i=0;i<E;++i){
        cin>>s>>t>>d;
        edge[s].push_back(make_pair(t, d));
    }
    int ans = solve(0, 0);
    if(ans==inf) cout<<-1<<endl;
    else cout<<ans<<endl;
}



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

int main() {
    int n,k;
    cin >> n >> k;
    vector<Long> a(n);
    for(auto &t : a) cin >> t;
    sort(a.begin(),a.end());
    Long ans = 1LL << 30LL;
    for(int i = 0; i + k - 1 < n; i++) {
        if (abs(a[i]-a[i+k-1]) < ans) ans = abs(a[i]-a[i+k-1]);
    }
    cout << ans << endl;
    return 0;
}

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

#define int long long
#define forn(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())


int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a + b + c >= 22 ? "bust" : "win");
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#include <math.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    set<int> s;
    cin>>N>>K;
    for(int i = 0; i < K; i++) {
        int di;
        cin>>di;
        for(int j = 0; j < di; j++){
            int get;
            cin>>get;
            s.insert(get);
        }
    }
    cout<<N - s.size()<<endl;
    return 0;
}




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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N;
int dFenec[MAX_N];
int dSnuke[MAX_N];
vector< int > e[MAX_N];

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

  cin >> N;
  REP(i, N - 1) {
    CIN(a, b);
    a--; b--;
    e[a].emplace_back(b);
    e[b].emplace_back(a);
  }

  fill_n(dFenec, N, INF);
  fill_n(dSnuke, N, INF);

  {
    // Fenec
    queue< int > q;
    q.push(0);
    dFenec[0] = 0;
    while(!q.empty()) {
      int from = q.front(); q.pop();
      EACH(to, e[from]) {
	// OK(true);
	if (dFenec[to] == INF) {
	  // OK(true);
	  dFenec[to] = dFenec[from] + 1;
	  q.push(to);
	}
      }
    }
  }
  
  {
    // Snuke
    queue< int > q;
    q.push(N - 1);
    dSnuke[N - 1] = 0;
    while(!q.empty()) {
      int from = q.front(); q.pop();
      EACH(to, e[from]) {
	// OK(true);
	if (dSnuke[to] == INF) {
	  dSnuke[to] = dSnuke[from] + 1;
	  q.push(to);
	}
      }
    }
  }
  /*
  REP(i, N) {
    debug(dFenec[i]);
  }
  REP(i, N) {
    debug(dSnuke[i]);
  }
  */

  int res = 0;
  REP(i, N) {
    if (dFenec[i] <= dSnuke[i]) res++;
    else                        res--;
  }

  cout << (res > 0 ? "Fennec" : "Snuke") << endl; 
  
  return 0;
}



Measured memory_bytes: 6656
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val A = nextLongList().toCountMap().filterValues { it >= 2 }.toList().sortedByDescending { it.first }.take(2)
    if (A.size == 0) {
        println(0)
    } else if (A[0].second >= 4) {
        println(A[0].first * A[0].first)
    } else {
        println(A[0].first * A[1].first)
    }
}

fun List<Long>.toCountMap(): Map<Long, Int> {
    return this.groupBy { it }.mapValues { it.value.size }
}

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

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  rep(i, a+1) rep(j, b+1) rep(k, c+1) if (500 * i + 100 * j + 50 * k == x) ++ans;
  cout << ans << endl; 
  return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll n,t;
ll dp[100010];
int main(){
	scanf("%lld\n",&n);
	dp[0]=1;
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		for(ll j=10000;j>=0;j--)dp[j+t]+=dp[j];
	}
	for(ll j=10000;j>=0;j--)if(j%10&&dp[j]){
		printf("%lld\n",j);
		return 0;
	}
	puts("0");
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main
{
	public static void main(String arg[])
	{
		Scanner sc=new Scanner(System.in);
		boolean a[] =new boolean[10001];
		Arrays.fill(a, true);
		a[0]=a[1]=false;
		for(int i=2; i*i<=10000; i++)
		{
			if(!a[i])
				continue;
			for(int j=i*2; j<=10000; j+=i)
				a[j]=false;
		}
		while(sc.hasNext())
		{
			int n=sc.nextInt();
			if(n==0)
				return;
			int sum=0;
			int ans=0;
			for(int i=2; i<=n; i++)
			{
				sum =0;
				if(a[i])
					for(int j=i; j<=n; j++)
					{
						if(a[j])
						{
							sum+=j;
							if(n==sum)
								ans++;
						}
						if(sum>=n)
							break;
					}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 12000
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		var r = ss.Next<double>();
		//var y = ss.Next<int>();


		Console.WriteLine((r*r*Math.PI).ToString("F5")+ " "+(2*r*Math.PI).ToString("F5"));










		/*
		//????????????int, double, string?????????????????£????????????
		int i = ss.Next<int>();
		double d = ss.Next<double>();
		string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		int[] array = ss.Next<int>(10);
		*/
		//---------------------------------
	}
}



public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

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


int main() {
ll n,k;
cin>>n>>k;
ll a[n+1],b[n+1];
for (int i = 1; i <= n; ++i)
{
	cin>>a[i]>>b[i];
}
ll arr[n+1][k+1]={0};
memset(arr,0,sizeof(arr[0][0])*(n+1)*(k+1));
for (int i = 1; i <=n ; ++i)
{
	for (int j = 0; j<=k ; ++j)
	{
		if(i==0||j==0)arr[i][j]=0;
		else if(a[i]<=j){
		ll t1,t2;
	t1=arr[i-1][j];
	t2=arr[i-1][j-a[i]]+b[i];
	arr[i][j]=max(t1,t2);
	}
	else{
	arr[i][j]=arr[i-1][j];

	}
	}
}
cout<<arr[n][k];
}

Measured memory_bytes: 82472
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
#define Max(_A,_B) (_A>_B?_A:_B)

int n,f[5005][5005],len;
int clz=1E9+7;
char ch[5005];
long long pw(long long a,int b){
    long long nw=1;
    while(b){
        if(b&1){
            nw=nw*a%clz;
        }
        a=a*a%clz;
        b>>=1;
    }
    return nw;
}
void init(){
    scanf("%d",&n);
    scanf("%s",ch);
    len=int(strlen(ch));
    f[0][0]=1;
    for(int i=0;i<=n;++i){
        for(int j=0;j<=i;++j){
            f[i+1][j+1]=int(1LL*f[i][j]*2%clz+f[i+1][j+1]%clz)%clz;
            f[i+1][Max(j-1,0)]=int(1LL*(f[i][j]+f[i+1][Max(j-1,0)])%clz);
        }
    }
    printf("%d",(int(pw(pw(2,len),clz-2)*f[n][len]%clz)));
}
//int(pw(pw(2,len),clz-2))*
int main(){
    init();
    return 0;
}

Measured memory_bytes: 96512
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int n;
    cin >> n;
    cout << setprecision(5) << (44*n)/(double)7.0 << "\n";
}



Measured memory_bytes: 3772
///-Bismillahir Rahmanir Rahim-///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    char c;
    int table[256]={0},i;
    while((c=getchar())!=EOF)
    {
        table[c]++;
    }
    for(i=97; i<=122; i++)
    {
       printf("%c : %d\n",i,table[i]+table[i-32]);
    }
    return 0;
}



Measured memory_bytes: 3216
#pragma GCC optimize( ofast )
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

#define rep(i,a,b) for(ll i = a; i<b;i++)
#define per(i,a,b) for(ll i = a; i>=b; i--)
#define inf LLONG_MAX
#define all(x) x.begin(),x.end()
#define sz(x) (ll)(x).size()
#define trav(a,x) for(auto &a: x)
#define mp(x,y) make_pair(x,y)

ll chc(ll n, ll k){
  ll ans = 1;
  rep(i,1,k){ ans *= (n-i); }
  return ans;
}

int main(){
  ios::sync_with_stdio(0);
  cin.tie(NULL); cout.tie(NULL);
  cout << setprecision(15) << fixed;
  ll n,m; cin >> n >> m;
  ll ndf[4] = {0,-1,1,0};

  vector<vi> dp;
  vi _; _.assign(6*n+10,0);
  dp.assign(4,_);
  dp[2][3*n+1] = 1;

  rep(k,1,3*n+1){
    rep(df,-3*n,3*n+1){
      dp[3][df+3*n+1] = 0;
      rep(r,1,min(ll(4),k+1)){
        dp[3][df+3*n+1] += (chc(k,r)*dp[3-r][df+ndf[r]+3*n+1])%m;
      }
    }
    rep(r,0,3) rep(i,0,6*n+10) dp[r][i] = dp[r+1][i];
  }
/*
  rep(i,0,3*n+1) {
    rep(j,-3*n,3*n+1) cout << dp[i+3*n+1][j+3*n+1] << " ";
    cout << endl;
  }*/
  ll ans = 0;
  rep(i,0,3*n+1) { ans += dp[2][i+3*n+1]; ans = ans%m; }
  cout << ans << endl;
}


Measured memory_bytes: 768
t[999];main(T,W,N,w,c,i,j,m){
for(;scanf("%d%d",&W,&N)>1;printf("Case %d:\n%d\n%d\n",T++,m-1,i)){
	for(memset(t,0,sizeof(t)),t[0]=1,i=0;i<N;i++)
		for(scanf("%d,%d",&c,&w),j=W;j>=0;j--)if(t[j])if(t[j+w]<t[j]+c)t[j+w]=t[j]+c;
	for(m=j=0;j<=W;j++)if(m<t[j])m=t[j],i=j;
}exit(0);}

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

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

	int X;
	cin >> X;

	int result = 1;

	for( int i = 2; i*i <= X; ++i ) {
		int x = i;

		while( x*i <= X ) {
			x *= i;
		}

		if( x > result ) {
			result = x;
		}
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s : String,
    }
    let pre: u64 = s[..2].parse().unwrap();
    let suf: u64 = s[2..].parse().unwrap();
    let isYYMM = 1 <= suf && suf <= 12;
    let isMMYY = 1 <= pre && pre <= 12;
    let res = match (isYYMM, isMMYY) {
        (true, true) => "AMBIGUOUS",
        (true, false) => "YYMM",
        (false, true) => "MMYY",
        _ => "NA",
    };
    println!("{}", res);
}


Measured memory_bytes: 4352
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);
        int length = nextInt();
        nextLine();
        int count = 0;
        String a = nextLine();
        char[] chars = a.toCharArray();
        for (int i = 0; i < length-2; i++) {
            if (chars[i]=='A' && chars[i+1] == 'B' && chars[i+2] == 'C') count++;
        }
        println(count);
        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

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

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

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

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

Measured memory_bytes: 29396
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        sc.close();
        for(int i = 0 ; i < a.length() + b.length() ; i++){
            if(i % 2 == 0) System.out.print(a.charAt(i / 2));
            if(i % 2 == 1) System.out.print(b.charAt(i / 2));
        }
        System.out.println();
    }
}
//鶏になれ

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    string c[h + 2];
    for (int i = 1; i <= h; i++) {
        cin >> c[i];
    }
    int x8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
    int y8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
    for (int i = 1; i <= h; i++) {
        for (int j = 0; j < w; j++) {
            if (c[i][j] == '.') {
                int b = 0;
                for (int k = 0; k < 8; k++) {
                    if (c[i + x8[k]][j + y8[k]] == '#') b++;
                }
                c[i][j] = b + '0';
            }
        }
    }
    for (int i = 1; i <= h; i++) {
        cout << c[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;

int main() {
  int n;
  cin >> n;
  double mid = 0;
  vector<int> x(n);
  rep(i, n) {
    cin >> x[i];
    mid += x[i];
  }
  mid /= n;
  mid = round(mid);
  double sum = 0;
  rep(i, n) { sum += pow(mid - x[i], 2); }

  cout << sum;
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
from functools import reduce
import copy


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    total = reduce(lambda acc, y: acc + int(y), str(N), 0)
    return 'Yes' if N % total == 0 else 'No'


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3572
from functools import reduce
from fractions import gcd

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def gcd_list(nums):
    return reduce(gcd, nums)

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
diff = [abs(xi - X) for xi in x]
print(gcd_list(diff))


Measured memory_bytes: 16304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(i=a;i<b;i++)
#define rloop(i,a,b) for(i=a;i>=b;i--)
#define vi vector<int>
#define vs vector<string>
const int inf=1e9+1;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846

int main(){
	string a,b,c;
	cin>>a>>b>>c;
	if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 764
answers = []

while (convert_num = gets.to_i) != 0
  convert_table = {}
  convert_num.times do
    befor_char, after_char = gets.chomp.split
    convert_table[befor_char] = after_char
  end

  output = ""
  gets.to_i.times do
    data = gets.chomp
    if (char = convert_table[data]) != nil
      output += char
    else
      output += data
    end
  end

  answers << output
end

puts answers

Measured memory_bytes: 99160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        if(n==52) return;
        boolean a[] = new boolean[52];
        String str[] = new String[2];
        for(int i=n;i>0;i--){
            str = br.readLine().split(" ");
            switch(str[0]){
                case "S":
                    a[Integer.parseInt(str[1])-1] = true;
                    break;
                case "H":
                    a[Integer.parseInt(str[1])-1+13] = true;
                    break;
                case "C":
                    a[Integer.parseInt(str[1])-1+26] = true;
                    break;
                case "D":
                    a[Integer.parseInt(str[1])-1+39] = true;
                    break;
                default:
                    break;
            }
        }
        for(int i=0;i<52;i++){
            if(a[i]==false){
                if(i<13) System.out.println("S "+(i+1));
                else if(i<26) System.out.println("H "+(i+1-13));
                else if(i<39) System.out.println("C "+(i+1-26));
                else  System.out.println("D "+(i+1-39));
            }
        }
    }
}

Measured memory_bytes: 24092
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
class Main {
	public static void main (String[] args)   {
	   Scanner s=new Scanner(System.in); 
       int k=s.nextInt();
       int n=s.nextInt();
       int arr[]=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=s.nextInt();
       }
       int maxdiff=0;
       for(int i=1;i<n;i++)
       {
           if(maxdiff<arr[i]-arr[i-1])
           maxdiff=arr[i]-arr[i-1];
       }
       if(maxdiff<k-arr[n-1]+arr[0])
       {
           System.out.println(k-(k-arr[n-1]+arr[0]));
       }
       else
       {
           System.out.println(k-maxdiff);
       }
	   
	    
 
	}
	
}

Measured memory_bytes: 66424
#include <stdio.h>

#pragma warning(disable:4996)

int main(void) {
	int A, B;
	scanf("%d %d", &A, &B);

	int sum = 0;
	for (int i = 0; i < 2; ++i) {
		if (A > B) {
			sum += A--;
		}
		else {
			sum += B--;
		}
	}

	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
	long long n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	long long ans,rem;
	ans=n/(a+b)*a;
	rem=n%(a+b);
	ans+=rem<a?rem:a;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
//============================================================================
// Name        : c.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<map>
using namespace std;

int main() {
	int n;cin>>n;
	vector<int> a(n);
	map<int,int> m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(m[a[i]]==1){
			cout<<"NO"<<endl;
			return 0;
		}
		m[a[i]]=1;
	}
	cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;



int main(){
    string s;
    cin >> s;
    ll a=0,b=0,c=0;
    for(ll i=0;i<ll(s.size());i++){
        if(s[i]=='a') a++;
        else if(s[i]=='b') b++;
        else c++;
    }
    if(max({a,b,c})-min({a,b,c})<=1){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}  

Measured memory_bytes: 3752
#include <stdio.h>

int main(void){
        int n, time, i, c[100], t[100], min;
        scanf("%d %d", &n, &time);
        min = 1001;
        for(i=0; i<n; i++){
                scanf("%d %d", &c[i], &t[i]);
        }
        for(i=0; i<n; i++){
                if(t[i]<=time){
                        if(c[i]<min)    min = c[i];
                }
        }
        if(min == 1001) printf("TLE\n");
        else                    printf("%d\n", min);
        return 0;
}

Measured memory_bytes: 128
from collections import Counter
n = int(input())
S = sorted([input() for i in range(n)],key=len)

x = Counter(S.pop(0))
for k,v in x.items():
    for j in S:
        if j.count(k)<v:
            x[k]=j.count(k)

ans_li = []
for k,v in x.items():
    if v!=0:
        ans_li.append(k*v)
print(''.join(sorted(ans_li)))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int f(string &s, int l, int r, int k, vector<vector<vector<int>>> &memo) {
    if (memo[l][r][k] != -1) return memo[l][r][k];

    int ans = [&] {

        if (l == r) return 1;
        else if (l + 1 == r) {
            if (s[l] == s[r] || 0 < k) return 2;
            else return 1;
        } else {
            int ans = 0;
            cmax(ans, f(s, l + 1, r, k, memo));
            cmax(ans, f(s, l, r - 1, k, memo));

            if (s[l] == s[r]) cmax(ans, f(s, l + 1, r - 1, k, memo) + 2);
            else if (0 < k) cmax(ans, f(s, l + 1, r - 1, k - 1, memo) + 2);
            return ans;
        }

    }();

    return memo[l][r][k] = ans;
}

int main() {
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    vector<vector<vector<int>>> memo(n + 1, vector<vector<int>>(n + 1, vector<int>(n + 1, -1)));
    cout << f(s, 0, n - 1, k, memo) << endl;
}


Measured memory_bytes: 110336
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)

	var ap, bp int64
	for i := int64(0); i < n; i++ {
		a := nextString(sc)
		b := nextString(sc)
		if a > b {
			ap += 3
		} else if a < b {
			bp += 3
		} else {
			ap++
			bp++
		}
	}
	fmt.Println(ap, bp)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) int64 {
	i, err := strconv.ParseInt(nextString(sc), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}



Measured memory_bytes: 1064
use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let p: Vec<f64> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect::<_>();
    
    let ans = ((p[0] - p[2]).powi(2) + (p[1] - p[3]).powi(2)).sqrt();

    println!("{}", ans);
}


Measured memory_bytes: 5060
#include<stdio.h>
#include<string.h>
int main(void){
    int f = 0, i,o, j, l, z, q, k[6], s[100][6], n[6], n2[6];
    char c;
    scanf("%d",&q);
    for (z = 0; z < q; z++){
        for (i = 0; i < 6; i++){
            scanf("%d", &s[z][i]);
            n[i] = i;
        }
    }
    for (i = 0; i < q; i++){
        for (z = 0; z < q; z++){
            if (i != z){
                for (j = 0; j < 20; j++){
                    if (j % 5 == 0){
                        n2[0] = n[1]; 
                        n2[1] = n[5]; 
                        n2[3] = n[3]; 
                        n2[4] = n[0]; 
                        n2[2] = n[2]; 
                        n2[5] = n[4];
                    }
                    else {
                        n2[0] = n[3]; 
                        n2[1] = n[1]; 
                        n2[3] = n[5]; 
                        n2[4] = n[4]; 
                        n2[2] = n[0]; 
                        n2[5] = n[2];
                    }
                    for (o = 0; o < 6; o++){
                        n[o] = n2[o];
                    }
                    for (l = 0; l < 6; l++){
                        if (s[i][l] != s[z][n[l]])break;
  
                    }
                    if (l == 6){ 
                        f = 1; 
                        break;
                    }
  
                }
            }
            if (f == 1)break;
        }
        if (f == 1)break;
    }
        if (f == 1)printf("No\n");
        else printf("Yes\n");
    return 0;
}


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

def dfs(s, mx):
    if len(s) == n:
        print(s)
    else:
        for i in range(mx + 1):
            c = chr(ord('a') + i)
            if i == mx:
                dfs(s+c, mx+1)
            else:
                dfs(s+c, mx)
dfs('', 0)


Measured memory_bytes: 4404
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    X, Y = MAP()
    for i in range(X+1):
        if 2*i + 4*(X-i) == Y:
            print("Yes")
            exit()
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 10608
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    fmt.Scan(&n)
    a := make(map[int]int)
    for i:=0; i<n; i++{
        var d int
        fmt.Scan(&d)
        a[d]++
    }
    fmt.Println(len(a))
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
# coding: utf-8

import sys
input = sys.stdin.readline

N = int(input())
# L = [int(x) for x in input().split()]
# S, P = map(int, input().split())

SP = [input().split() + [i + 1] for i in range(N)]
SP.sort(key=lambda x : int(x[1]), reverse=True)
SP.sort(key=lambda x : x[0])

for x in SP:
    print(x[2])


Measured memory_bytes: 3060
#define DEBUG 0

/**
 * File    : F2.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-26 02:29:52
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int Q;
ll A, B;
priority_queue<ll> L;
priority_queue<ll, vector<ll>, greater<ll>> R;
ll a, b;

void merge()
{
  B += b;
  L.push(a);
  R.push(a);
  if (L.top() <= R.top())
  {
    // nothing
  }
  else
  {
    ll l = L.top();
    ll r = R.top();
    A += abs(l - r);
    L.pop();
    R.pop();
    L.push(r);
    R.push(l);
  }
}

void flush()
{
  cout << L.top() << " " << A + B << endl;
}

int main()
{
  cin >> Q;
  for (auto i = 0; i < Q; i++)
  {
    char c;
    cin >> c;
    if (c == '1')
    {
      cin >> a >> b;
      merge();
    }
    else
    {
      flush();
    }
  }
}

Measured memory_bytes: 4588
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n; cin >> n;
  vector<int> hoge(n);
  // min
  int m = 3*100000;
  int count = 0;
  int tmp;
  rep_i(i, n){
    cin >> tmp;
    if(tmp <= m){
      count += 1;
      m = tmp;
    }
  }
  say(count);
}

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

int main() {

  int N;
  cin >> N;
  if (N >= 1 && N < 10) {
    cout << N << endl;
  }
  else if (N >= 10 && N < 100) {
    cout << 9 << endl;
  }
  else if (N >= 100 && N < 1000) {
    cout << N - 90 << endl;
  }
  else if (N >= 1000 && N < 10000) {
    cout << 909 << endl;
  }
  else if (N >= 10000 && N < 100000) {
    cout << N - 9090 << endl;
  }
  else {
    cout << 90909 << endl;
  }
}


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

int main() {
  int h, w;
  cin >> h >> w;

  vector <int> occurence(26,0);
  for (int i = 0; i < h*w; ++i) {
    char a;
    cin >> a;
    ++occurence[a - 'a'];
  }

  vector <int> rem(4,0);
  for (int i = 0; i < 26; ++i) {
    ++rem[occurence[i] % 4];
  }

  rem[2] += rem[3];
  rem[1] += rem[3];

  int valid2 = 0;
  int valid1 = 0;

  if (h % 2 == 0 and w % 2 == 0) {
  } else if (h % 2 == 0 and w % 2 == 1) {
    valid2 = h;
  } else if (h % 2 == 1 and w % 2 == 0) {
    valid2 = w;
  } else if (h % 2 == 1 and w % 2 == 1) {
    valid1 = 1;
    valid2 = (h - 1) + (w - 1);
  }

  valid2 /= 2;

  if (rem[2] <= valid2 and rem[1] <= valid1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll x;
    cin >> x;
    if (x>=1200)
        cout << "ARC" << endl;
    else
        cout << "ABC" << endl;

    return 0;
}


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

#Nが完全グラフの辺の数に等しい場合Yes
e=0
v=1
while e<=10**5:
    if e==N: break
    e+=v
    v+=1
else:
    print('No')
    exit()
print('Yes')

#部分集合の数=頂点数
#部分集合内の要素数=ひとつの頂点から出ている辺の数=e*2/v
subsets=[set() for _ in range(v)]
k=1
for i in range(v):
    for j in range(i+1,v):
        subsets[i].add(k)
        subsets[j].add(k)
        k+=1

print(v)
for s in subsets:
    S=[len(s)]+list(s)
    print(' '.join(map(str,S)))

Measured memory_bytes: 58204
#include <bits/stdc++.h>
using namespace std;
typedef std::pair<int, int> ipair;
#define int long long
#define pb push_back
#define ff first
#define INF INT_MAX
#define ss second
#define rep(i, a) for (int i = 0; i < a; i++)
#define fr(i, j, a) for (int i = j; i < a; i++)
#define cnt_ones(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mod 1000000007
#define IOS                                                                    \
  std::ios::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
void init() {
  int n;cin>>n;
  vector<int>h(n),dp(n+1);
  fr(i,0,n) cin>>h[i];
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  fr(i,2,n) dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i-2]-h[i]));
  cout<<dp[n-1]<<endl;
}
int32_t main() {
  IOS;
  init();
  return 0;
}


Measured memory_bytes: 1792
import sys
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
read = sys.stdin.read

N, *xy = map(int, read().split())
xy = np.array(xy, np.int64).reshape(N, 2)
x = xy[:, 0]
y = xy[:, 1]

arg_x = np.argsort(x)
arg_x1 = arg_x[1:]
arg_x2 = arg_x[:-1]

arg_y = np.argsort(y)
arg_y1 = arg_y[1:]
arg_y2 = arg_y[:-1]

edges_x = x[arg_x1] - x[arg_x2]
edges_y = y[arg_y1] - y[arg_y2]

edges = np.concatenate([edges_x, edges_y])
towns_1 = np.concatenate([np.minimum(arg_x1, arg_x2), np.maximum(arg_y1, arg_y2)])
towns_2 = np.concatenate([np.maximum(arg_x1, arg_x2), np.minimum(arg_y1, arg_y2)])

graph = coo_matrix((edges, (towns_1, towns_2)), shape=(N, N))
tree = minimum_spanning_tree(graph, overwrite=True)
answer = int(tree.sum())

print(answer)

Measured memory_bytes: 36040
from collections import deque
alphabet = "abcdefghijklmnopqrstuvwxyz"
A = input()
d = {a:deque() for a in "abcdefghijklmnopqrstuvwxyz"}
i = 0
while i < len(A):
  d[A[i]].append(i)
  i += 1
ans = 1+len(A)*(len(A)-1)//2
i = 0
while i < 26:
  a = alphabet[i]
  ans -= len(d[a])*(len(d[a])-1)//2
  i += 1
print(ans)

Measured memory_bytes: 40176
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

ll p[200001];

ll modinv(ll a, ll m = MOD) {
  ll b = m, u = 1, v = 0;
  while(b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if(u < 0) u += m;
  return u;
}

ll cmb(ll n, ll r) {
  return p[n] * modinv(p[r]) % MOD * modinv(p[n - r]) % MOD;
}

int main() {
  p[0] = 1;
  for(int i = 1; i < 200001; i++) p[i] = (p[i - 1] * i) % MOD;
  ll n, k, o = 1;
  scanf("%lld %lld", &n, &k);
  for(int i = 1; i <= min(k, n - 1); i++)
    o = (o + cmb(n, i) * cmb(n - 1, i) % MOD) % MOD;
  printf("%lld\n", o);
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<long long> a(n + 1), b(n + 1);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a[i + 1] = a[i] + x;
		b[i + 1] = b[i] + (x > 0 ? x : 0);
	}
	long long ans = 0;
	for (int i = 1; i <= n - k + 1; i++) {
		long long cur = b[i - 1] + b[n] - b[i + k - 1];
		cur += max(0LL, a[i + k - 1] - a[i - 1]);
		ans = max(cur, ans);
	}
	cout << ans << endl;
	return 0;	
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdint.h>

int main(void) {
  int64_t x;
  scanf("%ld", &x);

  int64_t z = (x / 11) * 2;
  int64_t y = (x / 11) * 11;

  while(y < x) {
    y += (z % 2) ? 5 : 6;
    z++;
  }
  printf("%ld\n", z);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n,l;
  cin >> n >> l;
  vector<int> a(n);
  int sum=0;
  rep(i,n){
    a[i]=l+i;
    sum+=a[i];
  }
  sort(all(a));
  int cur=99999,ans;
  rep(i,n){
    int res=sum-a[i];
    if(abs(sum-res)<cur){
      cur=abs(sum-res);
      ans=a[i];
    }
  }
  cout << sum-ans << endl;

  return 0;
}


Measured memory_bytes: 256
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b=int(input())
print(a[b-1])


Measured memory_bytes: 2940
X=input()
if len(X)==1:
    s=int(X)
else:
    s=int(X[-1])+int(X[-2])*10
    

b=s//5
b_=s%5
c=b_//4
c_=b_%4
d=c_//3
d_=c_%3
e=d_//2
e_=d_%2
f=e_//1
f_=e_//1

sum=b+c+d+e+f
sum_=105*b+104*c+103*d+102*e+101*f

if sum_>int(X):
    print(0)
else:
    print(1)

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

using namespace std;

const int MOD=1e9+7;

int main(){

	int n; 
	long long int k;
	cin>>n>>k;
	
	int a[n];
	for(int i=0;i<n;i++){
		 cin>>a[i];
		 a[i]=a[i]-1;
	}

	set<int> s;
	vector<int> v;

	int town=0;

	while(s.find(town)==s.end()){
		s.insert(town);
		v.push_back(town);
		town=a[town];
	}

	int start=-1,end=v.size();

	for(int i=0;i<v.size();i++){
		if(v[i]==town){
			start=i;
			break;
		}
	}

	if(k<v.size()){
		cout<<v[k]+1<<endl;
	}
	else{
		int diff=end-start;
		long long int r=(k-start)%diff;
		cout<<v[start+r]+1<<endl;
	}

	return 0;
} 

Measured memory_bytes: 13936