akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Graph{
	private:
	int n;
	vvi g,rg;
	vi scc,used;
	stack<int> stc;
	void Order(int v){
		used[v]=1;
		for(auto u:g[v]) if(!used[u]) Order(u);
		stc.push(v);
	}
	void DFS(int v,int t){
		used[v]=1;
		for(auto u:rg[v]) if(!used[u]) DFS(u,t);
		scc[v]=t;
	}
	int SCC(){
		scc=used=vi(n);
		rg=vvi(n);
		for(int i=0;i<n;i++){
			if(!used[i]) Order(i);
			for(auto v:g[i]) rg[v].push_back(i);
		}
		int t=0;
		used=vi(n);
		while(!stc.empty()){
			int v=stc.top();
			stc.pop();
			if(!used[v]) DFS(v,t++);
		}
		return t;
	}
	public:
	Graph(int v){
		n=v;
		g=vvi(v);
	}
	void add_edge(int s,int t){
		g[s].push_back(t);
	}
	void solve(){
		int N=SCC();
		cout<<(n!=N?"Yes":"No")<<endl;
	}
};

int n,m;
string s;
vvi g;
vi a;

int main(){
	cin>>n>>m>>s;
	g=vvi(n);
	a=vi(4*n);
	Graph G(4*n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(int u=0;u<n;u++) for(int v:g[u]){
		if(s[u]==s[v]){
			if(s[u]=='A') G.add_edge(u,v+n);
			else G.add_edge(u+2*n,v+3*n);
		}
		else{
			if(s[u]=='A') G.add_edge(u+n,v+2*n);
			else G.add_edge(u+3*n,v);
		}
	}
	G.solve();
}

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

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}

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

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

    string a, b, c;
    cin >> a >> b >> c;

    if(stoi(a + b + c) % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,ans=1<<30;
int main(){
	scanf("%d",&n);
	for(int i=1,a,b,now;(i<<1)<=n;i++){
		a=i,b=n-i,now=0;
		while(a) now+=a%10,a/=10;
		while(b) now+=b%10,b/=10;
		ans=min(ans,now);
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = Array(n) {
        readLine()!!.toInt()
    }
    val suma = a.sum()
    val suma2 = suma / 2
    val mod = 998244353L
    val dp1 = Array(suma2 + 1) { i ->
        if (i == 0) 3L else 0L
    }
    val dp2 = Array(suma2 + 1) { i ->
        if (i == 0) 3L else 0L
    }
    a.map { ai ->
        (suma2 downTo ai).map { j ->
            dp1[j] = (dp1[j] + dp1[j - ai] * 2) % mod
            dp2[j] = (dp2[j] + dp2[j - ai]    ) % mod
        }
    }
    val pow3 = (1 .. n).fold(1L) { x, dummy ->
        (x * 3) % mod
    }
    val ret = dp1.fold(pow3) { x, dp ->
        (x + mod - dp) % mod
    }
    val half = if (suma % 2 == 0) dp2[suma2] else 0
    print("${(ret + half) % mod}")
}

Measured memory_bytes: 172596
#include <stdio.h>

int main(void){
  int A, B, C;
  scanf ("%d %d %d", &A, &B, &C);
  if ( A == B){
    printf("%d\n",C);
  } else if (A == C){
      printf("%d\n",B);
  }  else if (B == C){
      printf("%d\n",A);
  }
    return 0;   
   }


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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;

inline int f(int x){
	int res = 0;
	while(x > 0){
		res += x % 10;
		x /= 10;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	int n;
	cin >> n;
	
	int ans = INF;
	repi(a , n - 1){
		int b = n - a;
		ans = min(ans , f(a) + f(b));
	}
	dier(ans);
	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 all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i,h) cin >> a[i];
    vector<int> r(h), c(w);
    rep(i,h){
        rep(j,w) {
            if(a[i][j]=='#') {
                r[i] = 1;
                c[j] = 1;
            }
        }
    }
    rep(i,h){
        if(r[i]!=1) continue;
        rep(j,w){
            if(c[j]!=1) continue;
            cout << a[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>

int N, M;
std::vector<std::vector<int> > tonari(200000 + 1);
int shirube[100000 + 1];
std::queue<int> que;

void search(int room_id) {
  for (int i = 0; i < tonari[room_id].size(); i++) {
    if (shirube[tonari[room_id][i]] == 0) {
      que.push(tonari[room_id][i]);
      shirube[tonari[room_id][i]] = room_id;
    }
  }

  while (que.size() > 0) {
    int next = que.front();
    que.pop();
    search(next);
  }
}

int main() {
  std::cin >> N >> M;
  for (int i = 1; i <= M; i++) {
    int tmpA, tmpB;
    std::cin >> tmpA >> tmpB;
    tonari[tmpA].push_back(tmpB);
    tonari[tmpB].push_back(tmpA);
  }

  search(1);

  std::cout << "Yes" << std::endl;
  for (int i = 2; i <= N; i++) {
    std::cout << shirube[i] << std::endl;
  }

  return 0;
}

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


int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < D; ++j) {
            cin >> X.at(i).at(j);
        }
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            double l = 0;
            for (int k = 0; k < D; ++k) {
                l += pow((X.at(i).at(k) - X.at(j).at(k)),2);
            }
            l = sqrt(l);
            bool f = false;
            for (int k = 0; k <= l; ++k) {
                if (k == l) f = true;
            }
            if (f) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
/*bool subseq(string s,string t){
    ll y=0;
    for(ll i=0;y<s.size()&& i<t.size();i++){
        if(s[y]==t[i]){
            y++;
        }
    }
        if(y==s.size())
            return true;
        else  return false;
}*/
/*ll x=1000000001;
vector<bool>p(x,false);
void prime(){
    p[2]=true;
    for(ll i=3;i<x;i=i+2)
        p[i]=true;
    for(ll i=0;i<x;i=i+2){
        if(p[i]){
            for(ll j=i*i;j<x;j=j+i)
                p[j]=false;
        }
    }
}*/
/*vector<ll> divisor(ll n){
    vector<ll> d;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i==0){
        d.push_back(i);
        d.push_back(n/i);
        }
    }
    sort(d.begin(),d.end(),greater<ll>());
    return d;
}*/
/*bool bs(ll n,string s){
    ll a[4]={0};
    for(ll i=0;i<n-1;i++){
        a[s[i]-'0']++;
    }
    for(ll i=n-1;i<s.size();i++){
        a[s[i]-'0']++;
        if(a[1]>0 && a[2]>0 && a[3]>0)
        return true;
        a[s[i-n+1]-'0']--;
    }
    return false;
}*/


/*ll binarySearch(ll n,ll a[],ll x){
    ll low=0,high=n-1,mid,ans=-1;
    while(low<=high){
        mid=low+(high-low)/2;
        if(a[mid]>=x){

            high=mid-1;
        }
        else{
                ans=mid;
            low=mid+1;
        }
    }
    return a[ans];
}*/
/*ll lcs(string a,string b,ll n,ll m){
    ll dp[n+1][m+1];
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=m;j++){
            if(i==0|| j==0)
                dp[i][j]=0;
            else if(a[i]==b[j])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    return dp[n][m];

}*/
/*ll editDist(string a,string b,ll n,ll m){
    vector<vector<ll> >dp(n+1,vector<ll>(m+1,-1));
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=m;j++){
            if(i==0)
                dp[i][j]=j;
            else if(j==0)
                dp[i][j]=i;
            else if(a[i]==b[j])
                dp[i][j]=dp[i-1][j-1];
            else{
                dp[i][j]=1+min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1]));
            }
        }
    }
    return dp[n][m];
}*/

/*ll d1(vector<string>a,ll n,ll m,vector<vector<ll> >dp){
    if(n<0 || m<0 ) return 0;
    if(n==0 && m==0) return 0;
    if(a[n][m]=='#') dp[n][m]=0;
    if((n==0 &&m==1) || (m==0&&n==1)) return 1 ;
    if(dp[n][m]!=-1)
        return dp[n][m];

    dp[n][m]=d(a,n-1,m,dp)+d(a,n,m-1,dp);
    return dp[n][m];
}*/
ll d(vector<string>a,ll n,ll m){

}
int main() {
    ll n;
    cin>>n;
    double dp[n+1]={0};
    double x;
    dp[0]=1;
    for(ll i=1;i<=n;i++){
        cin>>x;
        for(ll j=i;j>=0;j--){
            if(j==0)
            dp[j]=(1-x)*dp[j];
        else
            dp[j]=x*dp[j-1]+(1-x)*dp[j];
        }
    }
    double sum=0;
    for(ll i=n/2+1;i<=n;i++)
        sum=sum+dp[i];
    printf("%.10f",sum);
}


Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

#define INF (1<<24)

int common[10][10], N;

bool match(string a, string b, int p)
{
	int s=a.size()-1;

	for(int i=0; i<=p; i++)
		if(a[s-p+i]!=b[i]) return false;

	return true;
}

int calc(string a, string b)
{
	int ret=0, len=min(a.size(), b.size());

	if(a.find(b,0)!=a.npos) return len;
		
	for(int i=0; i<len; i++)
		if(match(a,b,i)) ret=i+1;

	return ret;
}

bool isUseless(int p, string s, int used)
{
	int sz=s.size();
	for(int i=0; i<N; i++)
	{
		if(i==p) continue;
		if((used>>i)&1) continue;
		if(common[p][i]==sz||common[i][p]==sz) return true;
	}

	return false;
}

int dp[10][1<<10];
string sss[10][1<<10];

int main()
{
	while(cin >> N, N)
	{
		string in[10];
		for(int i=0; i<N; i++)
			cin >> in[i];

		for(int i=0; i<N; i++)
		for(int j=0; j<N; j++)
			common[i][j]=calc(in[i],in[j]);

		int used=0;
		for(int i=0; i<N; i++)
			if(isUseless(i,in[i],used)) used|=(1<<i);



		for(int i=0; i<N; i++)
		for(int j=0; j<(1<<N); j++)
		{
			 dp[i][j]=INF;
			sss[i][j]="";
		}

		for(int i=0; i<N; i++)
		{
			if((used>>i)&1) continue;
			 dp[i][used|(1<<i)]=in[i].size();
			sss[i][used|(1<<i)]=in[i];
		}

		for(int i=0; i<(1<<N); i++)
		for(int u=0; u<N; u++)
		{
			if(dp[u][i]==INF) continue;
				
			for(int j=0; j<N; j++)
			{
				if( (i>>j) & 1 ) continue;

				string tmp = sss[u][i]+in[j].substr(common[u][j]);
				int cost = in[j].size()-common[u][j];
				if(  dp[j][i|(1<<j)] >  dp[u][i]+cost || 
					(dp[j][i|(1<<j)] == dp[u][i]+cost && sss[j][i|(1<<j)] > tmp) )
				{
					 dp[j][i|(1<<j)] = dp[u][i]+cost;
					sss[j][i|(1<<j)] = tmp;
				}
			}
		}

		int ret=INF;
		for(int i=0; i<N; i++)
			ret=min(ret, dp[i][(1<<N)-1]);

		string ans;
		for(int i=0; i<N; i++)
		{
			if(dp[i][(1<<N)-1]==ret)
			{
				if(ans.size()==0 || ans > sss[i][(1<<N)-1])
					ans=sss[i][(1<<N)-1];
			}
		}


		cout << ans << endl;
	}
}

Measured memory_bytes: 0
// Verified @ GRL_3_A

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v, int size){
	REP(i, size){
		cout << v[i] << " ";
	}
	cout << endl;
}

ll N, M;
vector<ll> G[101010];
vector<ll> dfs_tree[101010];
vector<ll> low(101010);
vector<ll> ord(101010, -1);
ll root = 0;
ll cnt = 0;

void dfs(ll now, ll par){
	ord[now] = cnt;
	cnt++;
	low[now] = ord[now];
	REP(i, G[now].size()){
		ll next = G[now][i];
		if(ord[next] == -1){
			dfs_tree[now].push_back(next);
			dfs(next, now);
			low[now] = min(low[now], low[next]);
		}else if(next != par){
			low[now] = min(low[now], ord[next]);
		}
	}
	return;
}

vector<ll> enum_articulation(){
	// construct lowlink
	dfs(root, -1);

	// enumerate articulation
	vector<ll> res;
	REP(i, N){
		if(i == root){
			if(dfs_tree[root].size() > 1) res.push_back(root);
		}else{
			bool flag = false;
			REP(j, dfs_tree[i].size()) if(ord[i] <= low[dfs_tree[i][j]]) flag = true;
			if(flag) res.push_back(i);
		}
	}
	return res;
}

bool is_articulation(ll v){
	if(v == root){
		return (dfs_tree[root].size() > 1);
	}else{
		bool flag = false;
		REP(j, dfs_tree[v].size()) if(ord[v] <= low[dfs_tree[v][j]]) flag = true;
		return flag;
	}
}

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

    cin >> N >> M;
    REP(i, M){
    	int s, t;
    	cin >> s >> t;
    	G[s].push_back(t);
    	G[t].push_back(s);
    }

    dfs(root, -1);
    REP(i, N){
    	if(is_articulation(i)) cout << i << endl;
    }

    //vprint(low, N);
    //vprint(ord, N);
    return 0;
}


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

int main() {
  int i;
  cin >> i;
  switch (i % 2) {
    case 0:
      cout << i << endl;
      break;
    case 1:
      cout << 2 * i << endl;
      break;
    default:
      break;
  }
  return 0;
}


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

int f(int n) {
	if(n < 6) return 0;

	int x = 1;
	int cnt = 0;
	while(x * x + 2 * x + 3 <= n) {
		int y = 1;
		while(x * x + y * y + x + y + x * y + 1 <= n) {
			int z = 1;
			while(x * x + y * y + z * z + x * y + y * z + z * x <= n) {
				if(x * x + y * y + z * z + x * y + y * z + z * x == n) {
					cnt++;
				}
				z++;
			}
			y++;
		}
		x++;
	}

	return cnt;
}

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

	for(int i = 1; i <= N; i++)
		cout << f(i) << endl;

	return 0;
}

Measured memory_bytes: 3592
using System;
using System.Linq;
class C
{
  static void  Main (string[] args)
  {
     Console.WriteLine(Enumerable.Repeat(Enumerable.Repeat(0,2).Select(_=>Console.ReadLine()).ElementAt(1).Split(' ').Select(int.Parse).ToArray(),2).Select((q,d)=>q.Where((p,i)=>i%2==d).GroupBy(p=>p).OrderBy(p=>-p.Count()).ToArray()).Aggregate(new{Sum=0,Key=-1,FSum=0,SSum=new[]{0}},(d,p)=>new{Sum=d.Sum+p.Sum(q=>q.Count()),Key=p[0].Key,FSum=(d.Key!=p[0].Key)?(d.FSum+p[0].Count()):0,SSum=d.SSum.Select(q=>q+(p.Skip(1).FirstOrDefault()?.Count()??0)).Concat(new[]{d.SSum[0]+p[0].Count()}).ToArray()},ans=>ans.Sum-Math.Max(ans.FSum,ans.SSum.Skip(1).Max())));
  }
}

Measured memory_bytes: 37908
n, x, y = gets.split.map(&:to_i)

ans = Array.new(n, 0)

(1..n).to_a.combination(2) do |s, t|
    if s < x && t <= x
        d = t - s
    elsif s < x && t <= y
        d = x - s + [y - t + 1, t - x].min
    elsif s < x 
        d = x - s + 1 + t - y
    elsif s < y && t < y
        d = [t - s, s - x + 1 + y - t].min
    elsif s < y
        d = [t - s, s - x + 1 + t - y].min
    else
        d = t - s
    end
    ans[d] += 1
end

ans[1..-1].each {|e| puts e}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int A, B, C, D; gi(A), gi(B), gi(C), gi(D);
	int i = 0;
	while(1) {
		if(i & 1) A -= D;
		else C -= B;
		if(A <= 0) {
			pstr("No\n");
			 return 0;
		}
		if(C <= 0) {
			pstr("Yes\n");
			 return 0;
		}
		i++;
	}
}


Measured memory_bytes: 3668
#include <stdio.h>

int card[4][13];
const char mark[]={'S','H','C','D'};

int main()
{
	int i,j,n;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		char a;
		int x;
		scanf(" %c %d",&a,&x);
		if(a=='S') card[0][x-1]=1;
		else if(a=='H') card[1][x-1]=1;
		else if(a=='C') card[2][x-1]=1;
		else if(a=='D') card[3][x-1]=1;
	}
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(card[i][j]==0){
				printf("%c %d\n",mark[i],j+1);
			}
		}
	}
	return 0;
}


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

int a[101],n;

bool check(){
	std::sort(a+1,a+n+1);
	if(a[n] != a[n-1]) return false;
	for(int i=1;i<n;++i)
		if(a[i+1] > a[i] + 1)
			return false;
	int md = (a[n]+1>>1);
	if(a[1] < md) return false;
	if(a[n]&1) if(a[1] != md or a[2] != md or a[3] == md) return false;
	if(!(a[n]&1)) if(a[1] != md or a[2] == md) return false;
	return true;
}

int main(){
	scanf("%d",&n);
	for(int i=n;i;--i) scanf("%d",a+i);
	puts(check()?"Possible":"Impossible");
	return 0;
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n,k = get_nums_l()
hhh = sorted(get_nums_l(), reverse=True)

print(sum(hhh[k:]))

Measured memory_bytes: 89308
import java.util.Scanner;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            
            if(op.equals("+"))
            System.out.println( a+b );
            
            if(op.equals("-"))
            System.out.println( a-b );
            
            if(op.equals("*"))
            System.out.println( a*b );
            
            if(op.equals("/"))
            System.out.println( a/b );
             
            if(op.equals("?"))
                break;
        }   
        sc.close();
    }
} 



Measured memory_bytes: 26292
// C - Candles
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N,K; cin>>N>>K;
	vi X(N); rp(i,0,N) cin>>X[i];

	vector<pair<int,int>> LR; //<left,right>
	rp(r,K-1,N){
		int l = r - (K-1);
		LR.emplace_back(X[l], X[r]);
	}

	int ans = INT_MAX;

	for(auto lr:LR){
		int l,r; tie(l,r) = lr;
		if(0 < l) ans = min(ans, abs(r));
		else if(r < 0) ans = min(ans, abs(l));
		else{ // l <= 0 && 0 <= r
				if(abs(l) > abs(r)) swap(l, r);
				ans = min(ans, abs(l)*2 + abs(r));
		}
	}

	cout<< ans <<endl;
}

Measured memory_bytes: 1276
from heapq import heappush, heappop
from math import sqrt
from sys import stdin
input = stdin.buffer.readline

def main():
    xs, ys, xt, yt = map(int, input().split())
    n = int(input())

    xyr = [(0, 0, 0)] * (n+2)
    xyr[0] = (xs, ys, 0)
    xyr[1] = (xt, yt, 0)
    for i in range(2, n+2):
        x, y, r = map(int, input().split())
        xyr[i] = (x, y, r)

    # dijkstra
    heap = []
    heappush(heap, (0.0, 0))
    times = [10**19] * (n+2)
    times[0] = 0
    yet = set(range(n+2))
    while True:
        time, ind = heappop(heap)

        if ind == 1:
            print(time)
            break

        if times[ind] == time:
            yet.remove(ind)
            x, y, r = xyr[ind]
            for i in yet:
                xi, yi, ri = xyr[i]
                new_time = max(sqrt((x-xi)*(x-xi)+(y-yi)*(y-yi))-(r+ri), 0.0) + time
                if new_time < times[i]:
                    times[i] = new_time
                    heappush(heap, (new_time, i))

main()

Measured memory_bytes: 117160
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int i,res=0;
  string s,t;
  cin >> s >> t;
  for(i=0;i<s.size();i++)
    if(s[i]!=t[i])
      res++;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
#define ll long long int
#define md 1000000007
#define pb emplace_back
#define all(s) s.begin(),s.end()
typedef vector<int>vi;
typedef vector<bool>vb;
void solve(){
	int n=0,k=0;
	cin>>n>>k;
	vi st(n+1);
	for(int i=1;i<=n;i++){
		cin>>st[i];
	}
	vi dp(n+1);
	dp[0]=0;
	dp[1]=0;
	dp[2]=abs(st[2]-st[1]);
	if(n==2)
	{
		cout<<dp[2]<<"\n";
		return;
	}
	for(int i=3;i<=n;i++){
		dp[i]=dp[i-1]+abs(st[i-1]-st[i]);
	for(int j=1;j<=k;j++){
		if(i-j>=1){
         int a= dp[i-j]+abs(st[i]-st[i-j]);
		dp[i]=min(a,dp[i]);
	} 
}
}
     cout<<dp[n]<<"\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0); 
 int t=1;
 //cin>>t; 
   while(t--){
   	solve();
   }
     return 0;
}  

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

#define INFTY (1 << 30);
typedef long long ll;

int main(void) {
  ll A[5];
  ll N;
  ll S[6] = {0, 0, 0, 0, 0, 0};

  cin >> N;
  for (int i = 0; i < 5; i++) {
    cin >> A[i];
  }

  ll step[5];
  for (int i = 0; i < 5; i++) {
    step[i] = N / A[i];
    if (N%A[i] != 0) {
      step[i] += 1;
    }
    // cout << step[i] << endl;
  }

  ll all_step = 0;
  sort (step, step+5);

  all_step = 4 + step[4];
  cout << all_step << endl;

  return 0;
}


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
	return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
	return a / gcd(a, b) * b;
}

string IntToString(int number)
{
	stringstream ss;
	ss << number;
	return ss.str();
}

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

int main()
{
    int n, k;
    ci >> n >> k;

    if(n % 2 == 1 && n / 2 + 1 >= k ||
       n % 2 == 0 && n / 2 >= k) co << "YES" << en;
    else co << "NO" << en;
  
    return 0;
}









Measured memory_bytes: 256
//#include "stdc++.h"
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
    string s;
    cin>>s;
    ll flag=0;
    for(ll i=0;i<s.length()-1;i++)
    {
        if(s[i]==s[i+1])
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"Bad"<<endl;
        return 0;
    }
    cout<<"Good"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN

    ll n;cin>>n;
    vll a(n);
    REP(i,n) {
        cin >> a[i];
        a[i] -= i-1;
    }
    VSORT(a);
    ll b=0;
    if (a.size()%2==1) b = a[(n-1)/2];
    else b=a[n/2];
    ll ans =0;
    REP(i,n) {
        ans += abs(a[i]-b);
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    cout << setprecision(20);
    ll n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];

    ll s = 0;
    rep(i, n) s += a[i];
    ll t = 0;
    rep(i, n){
        ll nt = t+a[i];
        if(nt>s/2){
            ll c = min(s-2*t, 2*nt-s);
            cout << c << endl;
            return 0;
        }
        t = nt;
    }
}


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

int main()
{
  int a,b,c,d=0,e=0;
  cin>>a>>b>>c;
  if(a==5) d++;
  else if(a==7) e++;
  if(b==5) d++;
  else if(b==7) e++;
  if(c==5) d++;
  else if(c==7) e++;
  if(d==2 && e==1) cout<<"YES\n";
  else cout<<"NO\n";
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef long long ll;

const int MOD = 1000000007;

void solve() {
  ll N, M;
  cin >> N >> M;
  ll ans = 0;
  if (N <= M / 2) {
    ans = N + (M - 2 * N) / 4;
  } else {
    ans = M / 2;
  }
  cout << ans << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
	int n, q, count = 0;
  int S[10000], T[500];

  scanf("%d", &n);
  for ( int i = 0; i < n; i++ ) scanf("%d", &S[i]);
  scanf("%d", &q);
  for ( int i = 0; i < q; i++ ) scanf("%d", &T[i]);

  for (int i = 0; i < q; i++) {
    for (int j = 0; j < n; j++) {
      if (T[i] == S[j]) {
        count++;
        break;
      }
    }
  }

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

  return 0;
}



Measured memory_bytes: 2764
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

double EPS=1e-10;
double PI=acos(-1);

double add(double a,double b){
  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;
  return a+b;
}


struct point{
  double x,y;
  point(){}
  point(double x,double y):x(x),y(y){}

  point operator + (point p){
    return point(add(x,p.x),add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x),add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  double vab(){//absolute
    return sqrt(x*x+y*y);
  }
  
  double dot(point p){//inner
    return add(x*p.x,y*p.y);
  }

  double det(point p){//cross
    return add(x*p.y,-y*p.x);
  }
  
};

vector<point> convex_hull(point* ps,int n){
  sort(ps,ps+n,[](point a,point b){
	 if(a.x!=b.x)return a.x<b.x;
	 return a.y<b.y;
    });
  
  int k=0;
  vector<point> qs(n*2);

  for(int i=0;i<n;i++){
    while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--;
    qs[k++]=ps[i];
  }
  
  for(int i=n-2,t=k;i>=0;i--){
    while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--;
    qs[k++]=ps[i];
  }

  qs.resize(k-1);
  return qs;
}

int main(){
  int n;
  cin>>n;
  point ps[111],tmp[111];
  map<double,map<double,double> > mp;
  for(int i=0;i<n;i++){
    double x,y;
    cin>>x>>y;
    tmp[i]=ps[i]=point(x,y);
    mp[x][y]=0.0;
  }

  vector<point> qs=convex_hull(tmp,n);
  int siz=qs.size();

  if(siz==2){
    for(int i=0;i<n;i++){
	 if(ps[i].x==qs[0].x&&ps[i].y==qs[0].y)cout<<0.5<<endl;
	 else if(ps[i].x==qs[1].x&&ps[i].y==qs[1].y)cout<<0.5<<endl;
	 else cout<<0<<endl;
    }
    return 0;
  }
  
  point p=point(0,0);
  for(int i=0;i<siz;i++){
    p=p+qs[i];
  }
  p=p*(1.0/(double)siz);

  // dbg(p.x);dbg(p.y);
  
  for(int i=0;i<siz;i++){ 
    point xi=qs[i]-p;
    point pi=qs[(siz+i-1)%siz]-p;
    point ni=qs[(i+1)%siz]-p;
    
    /*
    xi=xi*(1.0/xi.vab());
    pi=pi*(1.0/pi.vab());
    ni=ni*(1.0/ni.vab());
    //*/

    pi=pi-xi;
    ni=xi-ni;
    
    /*
    dbg(xi.x);dbg(xi.y);
    dbg(pi.x);dbg(pi.y);
    dbg(ni.x);dbg(ni.y);
    //*/

    double ans;
    ans=acos(pi.dot(ni)/(pi.vab()*ni.vab()));
    mp[qs[i].x][qs[i].y]=ans/(2.0*PI);
  }

  for(int i=0;i<n;i++){
    printf("%.10lf\n",mp[ps[i].x][ps[i].y]);
  }
  
  return 0;
}


Measured memory_bytes: 256
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,k,pt[100],tot[100];

LL dfs(LL pos,LL lft)
{
	if(lft<=0) return 0LL;
	LL ret=0;
	lft--;
	if(lft>=tot[pos-1])
	{
		ret+=pt[pos-1];
		lft-=tot[pos-1];
	}
	else
	{
		ret+=dfs(pos-1,lft);
		return ret;
	}
	if(lft>0)
	{
		lft--;
		ret++;
	}
	if(lft==0) return ret;
	if(lft>=tot[pos-1])
	{
		ret+=pt[pos-1];
		lft-=tot[pos-1];
	}
	else
	{
		ret+=dfs(pos-1,lft);
		return ret;
	} 
	return ret;
}

int main()
{
	cin>>n>>k;
	pt[0]=1;
	tot[0]=1;
	repn(i,50)
	{
		tot[i]=tot[i-1]*2+3;
		pt[i]=pt[i-1]*2+1;
	}
	cout<<dfs(n,k)<<endl;
	rt0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	k, n := nextInt(), nextInt()

	beforA := 0
	longest := 0
	var fa, la int
	for i := 0; i < n; i++ {
		ai := nextInt()
		sub := ai - beforA

		if sub > longest {
			longest = sub
		}

		beforA = ai

		if i == 0 {
			fa = ai
		} else if i == (n - 1) {
			la = ai
		}
	}

	if flsub := fa + (k - la); longest < flsub {
		longest = flsub
	}

	fmt.Print(k - longest)
}

func nextInt() int {
	i, _ := strconv.Atoi(nextText())
	return i
}

func nextText() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 2176
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]

res = float("inf")
for bit in range(1 << D):
    summ = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            summ += (i + 1) * 100 * PC[i][0] + PC[i][1]
            num += PC[i][0]
    if summ >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for _ in range(PC[i][0] - 1):
            summ += (i + 1) * 100
            num += 1
            if summ >= G:
                res = min(res, num)
                break
print(res)


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

int main() {

  int N;
  cin >> N;

  map<string, int> mp;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    mp[s]++;
  }

  int M;
  cin >> M;

  for (int i = 0; i < M; i++) {
    string t;
    cin >> t;
    mp[t]--;
  }

  int answer = 0;

  for (auto item:mp) {
    answer = max(answer, item.second);
  }

  cout << answer << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;

int g[15][15];

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      g[i][j] = -1;
    }
  }

  for (int i = 0; i < n; i++) {
    int m;
    cin >> m;
    for (int j = 0; j < m; j++) {
      int a, x;
      cin >> a >> x;
      a--;
      g[i][a] = x;
    }
  }

  int ans = 0;
  for (int i = 0; i < (1<<n); i++) {
    vector<int> d(n);
    for (int j = 0; j < n; j++) {
      if (i >> j & 1) {
        d[j] = 1;
      }
    }

    bool ok = true;
    for (int j = 0; j < n; j++) {
      if (d[j]) {
        for(int k = 0; k < n; k++) {
          if (g[j][k] == -1) {
            continue;
          }

          if (g[j][k] != d[k]) {
            ok = false;
          }
        }
      }
    }

    if (ok) {
      ans = max(ans, __builtin_popcount(i));
    }
  }

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


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

int main() {
  int a[4];
  for(int i=0; i<4; i++) cin >> a[i];
  sort(a,a+4);
  if(a[0]==a[1]&&a[2]==a[3]) cout << "yes" << endl;
  else cout << "no" << endl;
  return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

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

  vector <string> v = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
  string s;
  cin >> s;

  FOR (ite, begin (v), end (v))
  {
    if (* ite == s)
    {
      cout << distance (ite, end (v)) << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	ll sum = 0;
	rep(i, n) sum += a[i];
	ll ans = 1e14;
	ll b = 0;
	rep(i, n) {
		b += a[i];
		sum -= a[i];
		ans = min(ans, abs(sum - b));
	}
	dunk(ans);
	return 0;
}

Measured memory_bytes: 1792
b1, b2, b3 = map(int, input().split())

if b1==1 and b2==0 and b3==0:
    print("Close")
    
elif b1==0 and b2==1 and b3==0:
    print("Close")
    
elif b1==1 and b2==1 and b3==0:
    print("Open")
    
elif b1==0 and b2==0 and b3==1:
    print("Open")
    
elif b1==0 and b2==0 and b3==0:
    print("Close")


Measured memory_bytes: 5596
N = int(input())
Ts = [ int(x) for x in input().split() ]
M = int(input())
PXs = [ [ int(x) for x in input().split() ] for _ in range(M) ]

ans = []
s = sum(Ts)
for PX in PXs:
    P, X = PX
    ans.append(s - Ts[P - 1] + X)

print("\n".join(map(str, ans)))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int N;
    cin>>N;
    vector<int> A(N);    
    vector<int> B(N);
    vector<int> C(N);
    rep(i,N){
        cin>>A.at(i);
        B.at(i)=A.at(i)+(i+1);
        C.at(i)=-1*(A.at(i)-(i+1));
    }
    //Bi=Ai+i,Ci=-(Ai-i)を持っておき、Bi=Ciの個数をそれぞれカウントして
    //⇒例えばB={1,1,0,-3,-2,-5},C={-3,-5,-6,-5,-8,-7}だったら
    //-3のところで1*1組、-5のところで1*2組、よって3組
    //B,Cをソート
    sort(all(B));
    sort(all(C));

    map<int,int> Cmap;
    rep(i,N){
        if(Cmap.count(C.at(i))){
            Cmap[C.at(i)]++;
        }else{
            Cmap[C.at(i)]=1;
        }
    }
    long long ans =0;
    rep(i,N){
        if(Cmap.count(B.at(i))){
            ans+=Cmap[B.at(i)];
        }else{
            continue;
        }

    }
    cout << ans << endl;
    // int Bcnt=1;
    // int Ccnt=0;
    // int tmp=B.at(0);
    // int ans =0;
    // rep(i,N){
    //     // cout<<"B:"<<B.at(i)<<" C:"<<C.at(i)<<endl;
    // }
    // //探す
    // rep2(i,1,N){
    //     if(tmp==B.at(i)&&i!=N-1){
    //         Bcnt++;
    //         continue;
    //         //とりあえず同じ数だったらBを進め続ける
    //     }else{
    //         if(tmp==B.at(i)&&i==N-1){
    //             Bcnt++;
    //         }
    //         //違う数になったらtmpの数がCに何個あるか数える
    //         int lowind=lower_bound(C.begin(),C.end(),tmp)-C.begin();
    //         // cout << "low:"<<lowind;
    //         int uppind=upper_bound(C.begin(),C.end(),tmp)-C.begin();
    //         // cout << " upp:"<<uppind<<endl;
    //         Ccnt=uppind-lowind;
    //         // cout << "tmp:"<<tmp<<endl;
    //         // cout << "Bcnt:"<<Bcnt<<endl;
    //         // cout << "Ccnt:"<<Ccnt<<endl;
            
    //         ans=ans+Bcnt*Ccnt;
    //         tmp=B.at(i);//tmpを初期化
    //         Bcnt=1;//Bcntを初期化
    //     }


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

Measured memory_bytes: 14228
#include<bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i = 0;i<n;++i)
#define fri(i,a,b) for(int i= a;i<=b;++i)
#define fro(i,a,b) for(int i= a;i>=b;--i)
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define fi first
#define se second
#define pb(x) push_back(x)
#define  mp(x,y) make_pair(x,y)
#define endl  "\n"
#define  ii  pair<int,int>
#define  LL  long long
#define  maxm(a,b,c)  max(a,max(b,c))
int main()
{
	long n,s;
	cin>>n>>s;
	int w[110],v[110];
	for(int i=1;i<=n;i++){
		cin>>w[i];
		cin>>v[i];
		
	}

	long dp[n+1][s+1]={0};
	for(int i=0;i<=n;++i)
	{
		for(int j=0;j<=s;++j)
		{
			if(i==0 || j==0)
			{
				dp[i][j]=0;
				continue;
			}
			if(w[i]<=j)
			{
				dp[i][j] = max(v[i]+dp[i-1][j-w[i]],dp[i-1][j]);
			}
			else
			dp[i][j]=dp[i-1][j];
		}
	}
	cout<<dp[n][s];
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll, pair<ll,ll> >
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 20 + 5;
ll i,j,a,b,n,m,k,ans,st = 1, dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
char c[N][N];
queue<ii> q;
ll visit[N][N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>m;
    rep(i,1,n + 1) rep(j,1,m + 1) cin>>c[i][j];
    rep(i,1,n + 1) rep(j,1,m + 1) if(c[i][j] == '.'){
        q.push({0, {i, j}});
        while(!q.empty()){
            ii p = q.front();
            q.pop();
            ans = max(ans, p.f);
            visit[p.se.f][p.se.se] = st;
            for(k = 0;k < 4;k += 1){
                a = p.se.f + dx[k];
                b = p.se.se + dy[k];
                if(a >= 1 && b >= 1 && a <= n && b <= m && c[a][b] == '.' && visit[a][b] != st){
                    q.push({p.f + 1, {a, b}});
                    visit[a][b] = st;
                }
            }
        }
        st += 1;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
pair<int,int> tr[100001];
int tm[100001];
int id[100001];

int main(){
  int n,r,l;
  cin>>n>>r>>l;
  for(int i=1;i<=n;i++){
    tr[i]=make_pair(0,i);
    id[i]=i;
  }
  int rt=0;
  for(int k=0;k<r;k++){
    int d,t,x;
    cin>>d>>t>>x;
    tm[tr[1].second]+=t-rt;
    rt=t;
    tr[id[d]].first-=x;
    int u=id[d];
    pair<int,int> tem;
    if(x>0){
      while(u!=1&&tr[u]<tr[u/2]){
	tem=tr[u];
	tr[u]=tr[u/2];
	tr[u/2]=tem;
	id[tr[u].second]=u;
	id[tr[u/2].second]=u/2;
	u/=2;
      }
    }
    else {
      while(2*u+1<=n&&(tr[u]>tr[2*u]||tr[u]>tr[2*u+1])){
	int du=(tr[2*u]<tr[2*u+1])?(2*u):(2*u+1);
	tem=tr[u];
	tr[u]=tr[du];
	tr[du]=tem;
	id[tr[u].second]=u;
	id[tr[du].second]=du;
	u=du;
      }
    }
  }
  tm[tr[1].second]+=l-rt;
  int maxtm=0,tmid;
  for(int i=1;i<=n;i++){ 
    if(maxtm<tm[i]){
      tmid=i;
      maxtm=tm[i];
    }
  }
  cout<<tmid<<endl;
  
  return 0;
}

Measured memory_bytes: 2720
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    class Program
    {
        

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int R = int.Parse(input[0]);
            int G = int.Parse(input[1]);
            int B = int.Parse(input[2]);
            int N = int.Parse(input[3]);

            int cnt = 0;

            for(int r = 0; r <= N / R + 1; r++)
            {           
                for(int g = 0; g <= N / G + 1; g++)
                {
                    int ball = g * G + r * R;
                    
                    if((N - ball) % B == 0 && (N - ball) / B >= 0)
                    {
                        cnt++;
                    }                 

                }

            }

            Console.WriteLine(cnt);
            
        }
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    if ((s.charAt(0) == s.charAt(1)) || (s.charAt(1) == s.charAt(2)) || (s.charAt(2) == s.charAt(3))) {
      System.out.println("Bad");
    } else {
      System.out.println("Good");
    }

  }
}

Measured memory_bytes: 35736
//Bismillahir rahmanir rahim
#include<bits/stdc++.h>
#define ll long long
#define eps 0.000000001
using namespace std;


int main()
{   //freopen("in.txt","r",stdin);

    std::ios_base::sync_with_stdio(0);cin.tie(NULL);

    int a,b;
    cin>>a>>b;
    if(a<=5)cout<<"0"<<endl;
    else if(a>=6 && a<=12)cout<<b/2<<endl;
    else cout<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char **argv)
{
    int h, w;
    scanf("%d %d", &h, &w);

    for (int i = 0; i < h; ++i) {
        char s[128];
        scanf("%s", s);
        puts(s);
        puts(s);
    }
    return 0;
}

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll sz=100005;

ll n,ar[sz],cache[sz];
// ASLI TOP DOWN #KHUD_SE
ll dp(ll n)
{
    if(n<1)
        return 1e9;
    if(n==1)
        return 0;

    ll &ans=cache[n];
    if(ans!=-1)
        return ans;
	// cout<<n<<"<-"<<endl;
    ans=min( abs(ar[n-1]-ar[n])+dp(n-1) , abs(ar[n-2]-ar[n])+dp(n-2) );
    
    return ans;
}

int main()
{
    memset(cache,-1,sizeof cache);
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    cout<<dp(n);   
}

Measured memory_bytes: 3328
let l = [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]
let k = read_int ()
let _ = List.nth l (k-1) |> Printf.printf "%d\n"

Measured memory_bytes: 384
from collections import defaultdict

N, K = map(int, input().split())
A = list(map(int, input().split()))

d = defaultdict(int)
for a in A:
    d[a] += 1

l = sorted(d.items(), key=lambda p: p[1])
x = len(l)
ans = 0
for e in l:
    if x <= K:
        break
    x -= 1
    ans += e[1]
print(ans)


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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

template<typename T>
class Heap {
private:
    vector<T> heap;
    int lastIndex = 0;
    function<bool(T, T)> compare;

    int up(int x) {
        if(x == 1) {
            return x;
        }
        if(compare(heap[x/2], heap[x])) {
            return x;
        }
        swap(heap[x/2], heap[x]);
        return up(x/2);
    }
    int down(int x) {
        if(x == lastIndex) {
            return x;
        }
        if(x*2 > lastIndex) {
            return x;
        }
        if(x*2 == lastIndex) {
            if(compare(heap[x], heap[x*2])) {
                return x;
            }
            swap(heap[x], heap[x*2]);
            return x*2;
        }

        int i = x*2 + !compare(heap[x*2], heap[x*2 + 1]);

        if(compare(heap[x], heap[i])) {
            return x;
        }
        swap(heap[x], heap[i]);
        return down(i);
    }
public:
    Heap(int size, function<bool(T, T)> compare) {
        lastIndex = 0;
        heap.resize(size + 1);
        this->compare = compare;
    }
    Heap(int size) {
        Heap(size, less<T>());
    }

    void add(T t) {
        lastIndex++;
        heap[lastIndex] = t;
        up(lastIndex);
    }
    void del() {
        swap(heap[1], heap[lastIndex]);
        lastIndex--;
        down(1);
    }
    T get() {
        return heap[1];
    }
    bool empty() {
        return lastIndex == 0;
    }
};

struct Task {
    LL A;
    LL B;
};

int main() {
    LL N, M;
    cin >> N >> M;
    Task tasks[N];
    REP(i, N) {
        cin >> tasks[i].A >> tasks[i].B;
    }
    auto cmp = [](Task a, Task b) {return a.B > b.B;};
    sort(tasks, tasks + N, cmp);
    bool reserved[M + 1];
    fill(reserved, reserved + M + 1, false);

    vector<vector<LL>> v;
    v.resize(M + 1);

    for(int i = 0;i < N;i++) {
        if(0 <= M - tasks[i].A) {
            v[M - tasks[i].A].push_back(tasks[i].B);
        }
    }

    priority_queue<LL> q;
    LL res = 0;
    for(LL i = M;0 <= i;i--) {
        for(LL j = 0;j < v[i].size();j++) {
            q.push(v[i][j]);
        }
        if(!q.empty()) {
            res += q.top();
            q.pop();
        }
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 7296