akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <array>
#include <vector>
#include <map>
#include <cmath>
#include <cfloat>
#include <algorithm>

using namespace std;

using ll = unsigned long long int;

int main(){
    
    ll N, A, B;
    array<ll, 64> V;
    
    cin >> N >> A >> B;
    for(ll i = 0; i < N; ++i){
        cin >> V[i];
    }
    
    sort(V.begin(), V.begin() + N, [](ll a, ll b)->bool{
        return a > b;
    });
    
    pair<long double, ll> dp[64][64];
    for(ll i = 0; i < N; ++i){
        for(ll j = 0; j < N; ++j){
            dp[i][j] = make_pair(0.0, 0);
        }
    }
    
    dp[0][0].first = V[0];
    dp[0][0].second = 1;
    
    for(ll i = 1; i < N; ++i){
        dp[i][0].first = max(dp[i - 1][0].first, (long double)V[i]);
        if(fabs(V[i] - dp[i - 1][0].first) < 0.0000001){
            dp[i][0].second = dp[i - 1][0].second + 1;
        }else if(V[i] > dp[i - 1][0].first){
            dp[i][0].second = 1;
        }else{
            dp[i][0].second = dp[i - 1][0].second;
        }
        for(ll j = 1; j < i; ++j){
            long double t = (dp[i - 1][j - 1].first * j + V[i]) / (j + 1);
            long double f = dp[i - 1][j].first;
            dp[i][j].first = max(t, f);
            if(fabs(t - f) < 0.0000001){
                dp[i][j].second = dp[i - 1][j - 1].second + dp[i - 1][j].second;
            }else if(t > f){
                dp[i][j].second = dp[i - 1][j - 1].second;
            }else{
                dp[i][j].second = dp[i - 1][j].second;
            }
        }
        dp[i][i].first = (dp[i - 1][i - 1].first * i + V[i]) / (i + 1);
        dp[i][i].second = dp[i - 1][i - 1].second;
    }
    
    double best = 0;
    ll okn = 0;
    
    for(ll j = 0; j < N; ++j){
        for(ll i = 0; i < N; ++i){
            cerr << dp[i][j].second << " ";
        }cerr << endl;
    }

    for(ll j = A - 1; j < B; ++j){
        double v = dp[N - 1][j].first;
        if(fabs(v - best) < 0.00001){
            okn += dp[N - 1][j].second;
        }else if(v > best){
            best = v;
            okn = dp[N - 1][j].second;
        }
    }
    
    printf("%.6f\n%llu\n", best, okn);
    
    return 0;
}

Measured memory_bytes: 384
n = int(input())
s = {}
for i in range(n):
    tmp = input()
    if tmp not in s:
        s[tmp] = 1
    else:
        s[tmp] += 1

ans_n = max(s.values())

sorted_s = sorted(s.items())

for i in range(len(sorted_s)):
    if sorted_s[i][1] == ans_n:
        print(sorted_s[i][0])

Measured memory_bytes: 44252
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#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 vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<ll>A(n); 
	vector<ll>sum(n + 1);
	
	rep(i, n) {
		scanf("%d", &A[i]);
		A[i] -= (i + 1);
	}
	sort(all(A));
	sum[0] = 0;
	ll Sum = 0;
	rep(i, n) {
		Sum += A[i];
		sum[i+1] = Sum;
	}
	ll ans = 1e20;
	FOR(ite, 0, n) {
		ll tmp = (ll)(n - 2 * ite)*A[ite]*(-1) + (sum[n] - 2 * sum[ite]);
		ans = min(ans, tmp);
	}
	cout << ans << endl;

}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    for(int c = 1 ; c <= 3 ; c++) {
      int sumAll = a * b * c;
      
      if(sumAll % 2 == 1) {
        System.out.print("Yes");
        return;
      }
    }
    sc.close();
    System.out.print("No");
  }
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define x first
#define y second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ve vector
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define sz(a) (int)(a.size())
//using namespace __gnu_pbds;
using namespace std;

// // // functions: find_by_order  & order_of_key
// typedef tree<
// int,
// null_type,
// less<int>,
// rb_tree_tag,
// tree_order_statistics_node_update>
// ordered_set;

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

const int inf=(int)2e9;
const long long mod=1000000007; //1E9+7
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

ll powmod(ll a,ll p){
	ll ans=1;
	while(p){
		if(p&1) ans*=a;
		p/=2;a*=a; ans%=mod;a%=mod;
	}
	return ans;
}
ll mdinv(ll a){return powmod(a,mod-2); }

class RMQ{
public:
	ve<int> A,st;int n;

	RMQ(int givenSize){
		n=givenSize;
		A.resize(n);
		st.resize(4*n);
	}

	void update(int x,int val){
		update(x,-val,0,n-1,1);
	}

	void update(int x,int val,int l,int r,int id){
		if(l>x||r<x) return;
		if(l==r){
			st[id]=l;
			A[l]=val;return;
		}
		update(x,val,l,(l+r)/2,id*2);
		update(x,val,(l+r)/2+1,r,id*2+1);
		if(A[st[id*2]] < A[st[id*2+1]])
			st[id]=st[id*2];
		else
			st[id]=st[id*2+1];
	}

	int query(int x,int y){
		return -A[query(x,y,0,n-1,1)];
	}

	int query(int x,int y,int l,int r,int id){
		if(l>y||r<x) return -1;
		if(x<=l && r<=y) return st[id];
		int lind=query(x,y,l,(l+r)/2,id*2);
		int rind=query(x,y,(l+r)/2+1,r,id*2+1);
		if(lind==-1) return rind;
		if(rind==-1) return lind;
		if(A[lind]<A[rind]) return lind;
		else return rind;
	}
};

signed main(){
	IOS
	int n;cin>>n;
	vi h(n),v(n);
	forn(i,n) cin>>h[i];
	forn(i,n) cin>>v[i];
	RMQ seg(n+10);
	int ans=0;
	for(int i=0;i<n;i++){
		int b=seg.query(0,h[i]-1);
		ans=max(ans,v[i]+b);
		seg.update(h[i],v[i]+b);
	}
	cout<<ans;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  ll ans = (ll)(n)*(n-1)/2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	long long x[3] = {};
	int n;
	cin>>n;
	unordered_map<int,int> m;
	rep(i,n){
		int a;
		cin>>a;
		if (++m[a]==2){
			m[a]=0;
			x[0]=a;
			sort(x,x+3);
		}
	}
	cout << (long long)x[1] * x[2]<<endl;

	return 0;
}

Measured memory_bytes: 4388
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
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;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int t, x;

signed main() {
	cin >> t >> x;
	printf("%.14lf\n", 1.*t/x);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <functional>
#include <algorithm>

template <class T>
constexpr T inf=(T(1)<<(8*sizeof(T)-3));

template <class Weight>
struct Edge {
  const size_t src, dst;
  const Weight cost;
  Edge(size_t src, size_t dst, Weight cost=1):
    src(src), dst(dst), cost(cost)
  {}
};

template <class Weight>
using Graph=std::vector<std::vector<Edge<Weight>>>;

template <class Weight>
std::vector<size_t> any_path(const Graph<Weight> &g, size_t v) {
  std::vector<bool> visited(g.size());
  std::vector<size_t> res{v};
  
  std::function<void (size_t)> dfs=[&](size_t i)->void {
    visited[i] = true;
    for (const Edge<Weight> &e: g[i]) {
      if (visited[e.dst]) continue;
      res.push_back(e.dst);
      dfs(e.dst);
      break;
    }
  };

  dfs(v);
  return res;
}

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  Graph<int> g(N);
  std::vector<size_t> deg(N);
  for (size_t i=1; i<=M; ++i) {
    size_t A, B;
    scanf("%zu %zu", &A, &B);
    --A;
    --B;

    g[A].emplace_back(A, B);
    g[B].emplace_back(B, A);
    ++deg[A];
    ++deg[B];
  }

  size_t v=0;
  for (size_t i=1; i<N; ++i) {
    if (deg[i] == 1) {
      v = i;
      break;
    }
  }

  std::vector<size_t> path=any_path(g, any_path(g, v).back());
  printf("%zu\n", path.size());
  for (size_t i=0; i<path.size(); ++i)
    printf("%zu%c", path[i]+1, i+1<path.size()? ' ':'\n');
}


Measured memory_bytes: 17012
#include <iostream>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.totaltime", "r", stdin );
	int t1, t2, t3, t4;

	while (cin >> t1 >> t2 >> t3 >> t4 ){
		int sum = t1 + t2 + t3 + t4;
		cout << (sum / 60 ) << endl;
		cout << (sum % 60 ) << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
# ABC148 E
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
import math
n=ni()

if n==0:
    print(0)
    exit()

if n%2==1:
    print(0)
    exit()

five=math.floor(math.log(n,5))
ans=0

# for i in range(five):
for j in range(five):
    t=n//(5**(five-j))
    ans+=t//2
print(ans)



Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

int main() {
    int K, X;
    scanf("%d %d", &K, &X);
    if(500 * K >= X) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
int main(void)
{
  int n,k,j=0,a[200005],cnt[200005]={},count=0,ans=0;
  scanf("%d%d",&n,&k);

  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    cnt[a[i]-1]++;
    if(cnt[a[i]-1]==1){
      count++;
    }
  }
  qsort(cnt,n,sizeof(int),compare_int);

  while(count>k){
    if(cnt[j]>0){
      ans+=cnt[j];
      cnt[j]=0;
      count--;
    }
    j++;
  }

  printf("%d",ans);
  return 0;

}


Measured memory_bytes: 2556
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod=1e9+7;
static const ll INF=1LL<<50;
using namespace std;

vector<vector<pair<int,int>>>edge;
int n;
vector<int>color;

void dfs(int v,int c){
	if(color[v]!=-1)
    for(auto x:edge[v]){
    	if(color[x.first]!=-1)continue;
      	if(x.second==0){
          color[x.first]=c;
          dfs(x.first,c);
        }
      	else {
        	color[x.first]=1-c;
           	dfs(x.first,1-c);
        }
    }
}

int main() {
	cin>>n;
  	edge.resize(n);
  	color.resize(n);
  	repp(i,0,n)color[i]=-1;//未訪問
  	repp(i,0,n-1){
    	int u,v,w;
      	cin>>u>>v>>w;
      	u--;v--;
      	edge[u].emplace_back(v,w%2);
      	edge[v].emplace_back(u,w%2);
    }
  color[0]=0;
  dfs(0,0);
  repp(i,0,n)cout<<color[i]<<endl;
  return 0;
}


Measured memory_bytes: 8192
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner s  = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int K = s.nextInt();
        
        for(int i = 0; i < K; i++){
            if(i % 2 == 0){
                B += A / 2;
                A /= 2;
            } else {
                A += B / 2;
                B /= 2;
            }
        }
        
        System.out.println(A + " " + B);
    }
    
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
int par[114514], rrank[114514];//親、木の深さ
void init(int n) {
	rep(i, n) {
		par[i] = i;
		rrank[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rrank[x] < rrank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rrank[x] == rrank[y])rrank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
int n, x;
signed main() {
	cin >> n >> x;
	if (500 * n >= x)puts("Yes");
	else puts("No");
	ggr
}

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

int n,m;
int a[100000],b[100000];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n>>m;
	
	for (int i=0; i<n; i++) a[i]=1;
	b[0]=1;
	
	while (m--)
	{
		int x,y;
		cin>>x>>y; x--,y--;
		a[x]--,a[y]++;
		b[y]|=b[x];
		b[x]&=(a[x]>0);
	}
	
	m=0;
	for (int i=0; i<n; i++)
		m+=b[i]*(a[i]>0);
		
	cout<<m;
	
	return 0;
}

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

string fun(string s){
    int len = s.length();
    for(int i = 0; i < len; i+=2){
        if(s[i] == 'L') return "No";
    }
    for(int i = 1; i < len; i+=2){
        if(s[i] == 'R') return "No";
    }
    return "Yes";
}

int main(){
    string s;
    cin >> s;
    cout << fun(s) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
  using namespace std; 
  #define ll long long
  int main()
  {
    ll n,cnt=0,sum=1;
    cin>>n;
    int b=ceil(log2(n+1));
    for(int i=0;i<b;i++)
    {
      sum=sum*2;
    }
    cout<<sum-1;
 }

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
#include <cstring>

int main() {
  ll n, k, l, r, mid;
  cin >> n >> k;
  vector<ll> w(n), d(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> d[i];
  }
  l = 0;
  r = 2000000000000000000;
  while (l <= r) {
    ll cnt = 0;
    mid = (l + r) / 2LL;
    for (int i = 0; i < n; i++) {
      if (mid >= w[i]) {
        cnt += (mid - w[i]) / d[i] + 1LL;
      }
    }
    if (cnt >= k) {
      r = mid - 1LL;
    } else {
      l = mid + 1LL;
    }
  }
  cout << l << endl;
}

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

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

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

  map<int, int> students;
  for (int i = 0; i < N; i++) {
    students[A[i] - 1] = i + 1;
  }

  for (int i = 0; i < N; i++) {
    cout << students[i] << " ";
  }

  cout << endl;
}

Measured memory_bytes: 5888
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

int n, s[32];

int main() {
    cin >> n;
    int i = 0;
    if (n == 0) {
        printf("0\n");
        return 0;
    }

    while (n != 0) {
        if (n % 2 != 0) {
            s[i++] = 1;
            n--;
        } else {
            s[i++] = 0;
        }
        n /= -2;
    }
    for (int j = i - 1; j >= 0; --j) {
        printf("%d", s[j]);
    }
    return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i

spade = []
heart = []
club = []
diamond = []

n.times do
	suit, rank = gets.split
	
	case suit
	when 'S'
		spade << rank.to_i
	when 'H'
		heart << rank.to_i
	when 'C'
		club << rank.to_i
	when 'D'
		diamond << rank.to_i
	end
end

1.upto(13) do |r|
	puts "S #{r}" unless spade.include?(r)
end
1.upto(13) do |r|
	puts "H #{r}" unless heart.include?(r)
end
1.upto(13) do |r|
	puts "C #{r}" unless club.include?(r)
end
1.upto(13) do |r|
	puts "D #{r}" unless diamond.include?(r)
end

Measured memory_bytes: 6112
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a * b % 2 == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
	
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
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__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<ll>
#define M map<ll,ll>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>
 
#define str string
 
#define pb(a) push_back(a)
#define mp make_pair
 


int main(){
  SCIN(s);int n=s.size();
  V v(3,0);REP(i,n)v[s[i]-'a']++;
  YES(*max_element(ALL(v))-*min_element(ALL(v))<2);

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  double  X;
  cin >> X;

  double cur = 100;
  int64_t cnt = 0;
  while (cur < X) {
    cnt++;
    cur *= 1.01;
    cur = floor(cur);
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 3756
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto a = RDR.ARR;
	long ans;
	long last, streak;
	foreach (i; 0..N)
	{
		if (a[i] != last)
		{
			ans += streak / 2;
			streak = 1;
		}
		else
			++streak;

		last = a[i];
	}
	ans += streak / 2;

	writeln(ans);
	stdout.flush();
	debug readln();
}


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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
	freopen ("F.in", "r", stdin);
	freopen ("F.out", "w", stdout);
}

const int N = 2010, Mod = 1e9 + 7;

int fac[N * N], ifac[N * N];

int fpm(int x, int power) {
	int res = 1;
	for (; power; power >>= 1, x = 1ll * x * x % Mod)
		if (power & 1) res = 1ll * res * x % Mod;
	return res;
}

void Math_Init(int maxn) {
	fac[0] = ifac[0] = 1;
	For (i, 1, maxn) fac[i] = 1ll * fac[i - 1] * i % Mod;
	ifac[maxn] = fpm(fac[maxn], Mod - 2);
	Fordown (i, maxn - 1, 1) ifac[i] = ifac[i + 1] * (i + 1ll) % Mod;
}

inline int Comb(int n, int m) {
	if (n < 0 || m < 0 || n < m) return 0;
	return 1ll * fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;
}
 
int n, k, dp[N][N];

int main () {

	n = read(); k = read();

	if (k == 1) return puts("1"), 0;

	Math_Init(n * k);

	dp[0][0] = 1;
	For (i, 0, n) For (j, 0, i) if (dp[i][j]) {
	//	cout << i << ' ' << j << ' ' << dp[i][j] << endl;
		(dp[i + 1][j] += dp[i][j]) %= Mod;

		dp[i][j + 1] = (dp[i][j + 1] + 
				1ll * (n - j) * Comb(n * k - (i + 1) - j * (k - 1), k - 2) % Mod * dp[i][j]) % Mod;
	}
	printf ("%d\n", dp[n][n]);

    return 0;

}

Measured memory_bytes: 46592
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;

//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  using M = Mint<Int>;
  M ans{0};
  Int n=s.size();
  Int cnt=0;
  for(Int i=0;i<n;i++){
    if(s[i]=='0') continue;
    ans+=M(2).pow(cnt)*M(3).pow(n-(i+1));
    cnt++;
  }
  ans+=M(2).pow(cnt);
  cout<<ans.v<<endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
import java.util.HashSet;
import java.util.Iterator;

class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N  = sc.nextInt();
        System.out.println((N/2+N%2)/(double)N);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	map<int, int> mp;
	REP(i,n){
		int a;
		cin >> a;
		mp[a]++;
	}
	for(auto itr=mp.begin(); itr!=mp.end(); itr++){
		if(itr->second>1){
			cout << "NO" << '\n';
			return 0;
		}
	}
	cout << "YES" << '\n';
	return 0;
}



Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int main(){
	int n;
	cin>>n;
	int g[n][n];
	rep(i,n){
		rep(j,n) g[i][j]=-1;
	}
	rep(i,n){
		int a;
		cin>>a;
		rep(j,a){
			int x,y;
			cin>>x>>y;
			x--;
			g[i][x]=y;
		}
	}
	int res=0;
	for(int bit=0;bit<1<<n;bit++){
		bool ok=true;
		for(int i=0;i<n;i++){
			if(bit & (1<<i)){
				rep(j,n){
					if(j==i) continue;
					if(g[i][j]==-1) continue;
					if(g[i][j]==1 && g[j][i]==0) ok=false;
					if(g[i][j]==1 && !(bit & (1<<j))) ok=false;
					if(g[i][j]==0 && (bit & (1<<j))) ok=false;
					rep(k,n){
						if((bit & (1<<k)) && ((g[k][j]==0 && g[i][j]==1) || (g[k][j]==1 && g[i][j]==0))) ok=false;
					}
				}
			}
		}
		if(ok){
			res=max(res,__builtin_popcount(bit));
			//cout<<bit<<endl;
		}
	}
	cout<<res<<endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007ll)

int n,k;
vi g[111111];

ll dfs(int x,int pre,int b){
	if(pre!=-1&&g[x].size()==1){
		return max(0,k-b);
	}
	ll ret=k-b;
	int cnt=0;
	if(pre==-1)cnt=1;
	else cnt=2;
	FOR(i,0,g[x].size()){
		if(g[x][i]==pre)continue;
		ret*=dfs(g[x][i],x,cnt);
		ret%=mod;
		cnt++;
	}
	return ret;
}

int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	n=read();k=read();
	FOR(i,1,n){
		int a=read()-1,b=read()-1;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	cout<<dfs(0,-1,0)<<endl;
	return 0;
}


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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	long long x;
	cin >> x;

	int ans = 0;
	for (long long i = 100; i < x; ) {
		i *= 1.01;
		ans++;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3652
a = map(int, input().split())
list_int = list(a)

list_int.sort()
min_num = min(list_int)
max_num = max(list_int)
mid_num = list_int.pop(1)

minimum_cost = abs(mid_num - min_num) + abs(max_num - mid_num)
print(minimum_cost)


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

int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  --A, --B, --C, --D;
  string S;
  cin >> S;
  for (int i{A+1}; i < max(C, D); ++i) {
    if (S[i] == '#' && S[i+1] == '#') {
      cout << "No" << endl;
      return 0;
    }
  }

  if (C > D) {
    S.append("#");
    for (int i{B}; i <= D; ++i) {
      if (S[i-1] == '.' && S[i] == '.' && S[i+1] == '.') {
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 200100;
string s;
int n, k, c;
int pref[maxn], suff[2*maxn];

int main() {
	cin>>n>>k>>c;
	cin>>s;
	s = "#" + s;

	for(int i=1;i<=n;i++) {
		pref[i] = pref[i-1];
		if(i - c >= 1 && s[i-c] == 'o') pref[i] = max(pref[i], pref[i-c-1] + 1);
	}

	for(int i=n;i>=1;i--) {
		suff[i] = suff[i+1];
		if(s[i] == 'o') suff[i] = max(suff[i], suff[i+c+1]+1);
	}

	vector<int>v;
	deque<pair<int,int> > vals;
	for(int i=1;i<=n;i++) {
		if(!vals.empty() && vals.front().second == i - c - 1) vals.pop_front();

		int maxv = pref[i-1] + suff[i+1];
		if(!vals.empty()) maxv = max(maxv, vals.front().first);

		int nw = pref[i-1] + 1 + suff[i+c+1];
		if(s[i] == 'o') {
			while(!vals.empty() && vals.back().first < nw) vals.pop_back();
			vals.pb(mp(nw, i)); 
		}

		if(maxv >= k) continue;
		else v.pb(i);
	}

	for(int i:v) cout<<i<<"\n";
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
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;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while(1){
    int n;
    cin >> n;
    if(n==0) break;
    vd vec(n);
    ld ave = 0.0;
    REP(i,n){
      cin >> vec[i];
      ave += vec[i];
    }
    ave /= n;
    ld sum = 0;
    REP(i,n){
      sum += (vec[i]-ave) * (vec[i]-ave);
    }
    sum /= n;
    cout << sqrt(sum) <<endl;
  }

  return 0;
}



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

typedef vector< int >      vi;
typedef vector< vi >       vvi;
typedef pair<int, int>     pi;
typedef vector< pi >       vpi;

typedef long long          ll;
typedef vector<ll>         vl;
typedef vector< vl >      vvl;

const int LARGE_INT = 1000000007;
const ll LARGE_LONG = 1L << 62;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = (int)(a); i < (int)(b); i++)

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll  n, x, ans=0;
    cin >> n;
    if (n % 2 == 1)  cout << "0\n";
    else if (n == 0) cout << "0\n";
    else {
        x = n / 2;
        ll y = 5;
        while (y <= x) { ans += x/y;  y *= 5; }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int k,t,ans=0;

int main(){
	cin>>k>>t;
	int M=-1;
	for(int i=0;i<t;i++){
		int t;
		cin>>t;
		M=max(M,t);
	}
	if(k-M<M) cout<<2*M-k-1;
	else cout<<0<<endl;
}

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

void solve() 
{
    int n,m;cin>>n>>m;
    vector<int>a(n,0);
    REP(i,m){
        int k;cin>>k;
        REP(j,k){
            int s;cin>>s;s--;
            a[s]|=1<<i;
        }
    }
    int p=0;
    REP(i,m){
        int x;cin>>x;
        p|=x<<i;
    }
    int ans=0;
    REP(s,1<<n){
        int tmp=0;
        REP(i,n)if(s>>i&1)tmp^=a[i];
        if(tmp==p)ans++;
    }
    cout<<ans<<endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(){
	int a, b, n;
	int result = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	while(ifs >> a >> b >> n){
#else
	while(std::cin >> a >> b >> n){
#endif
		a = 10 * (a % b);

		result = 0;
		for(int i = 0; i < n; i++){
			result += a / b;
			a = 10 * (a % b);
		}
		std::cout << result << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3020
#include <bits/stdc++.h>
using namespace std;
 
int findSumOfDigits10(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  int N; 
  cin >> N; 
  if(N % findSumOfDigits10(N) == 0) 
  cout << "Yes" << endl;
  else cout << "No" << endl; 
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
ostream &operator<<(ostream &os, const vector<int> &a) {
	os<<"[";
	rep(i,a.size()){
		os<<a[i];
		if(i<a.size()-1) os<<",";
	}
	os<<"]";
	return os; 
}
map<int,int> dp,me;
int num[252521];
int main()
{
	int n,now=0,out=0;string s;
	cin>>s;n=s.size();num[0]=0;
	rep(i,n){
		num[i+1]=(num[i]^(1<<(s[i]-'a')));
	}
	rep(i,n+1) me[num[i]]=max(me[num[i]],i);
	//map<int,vector<int> >::iterator it=me.begin();
	/*while(it!=me.end()){
		(*it).se.pb(252521);
		cout<<(*it).fi<<' '<<(*it).se<<endl;
		it++;
	}*/
	if(__builtin_popcount(num[n])<2){
		cout<<1<<endl;return 0;
	}
	rep(i,n){
		rep(j,26){
			int t=(num[i]^(1<<j));
			if(me.find(t)==me.end()) continue;
			if(dp.find(t)==dp.end()) dp[t]=dp[num[i]]+1;
			else dp[t]=min(dp[t],dp[num[i]]+1);
		}
		//cout<<now<<endl;
	}
	cout<<dp[num[n]]<<endl;
}


Measured memory_bytes: 19972
#include<stdio.h>
int main(){
    int N,thus,hun,ten,one;
    scanf("%d",&N);
    one=N%10;
    N=N/10;
    ten=N%10;
    N=N/10;
    hun=N%10;
    N=N/10;
    thus=N;
    if((thus==hun && hun==ten)||(hun==ten && ten==one)){
       printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main(){
  long long N;
  cin  >> N ;
  vector<long long> A(N);
  rep(i,N){
    long long x;
    cin >>x;
    A[i]=x;
  }
  vector<long long> B(N);
  rep(i,N){
    B[i]=A[i]-i-1;
  }
  map<long long,int> C;
  rep(i,N){
    C[A[i]+i+1]++;
  }
  //sort(B.begin(),B.end());
  //sort(C.begin(),C.end());
  long long c=0;
  for(int i=0;i<N;i++){
    //count+=upper_bound(C.begin(),C.end(),-B[i])-lower_bound(C.begin(),C.end(),-B[i])+1;
    c+=C[-B[i]];
  }
  //rep(i,N)cout << B[i] << endl;
  cout << c << endl;
}

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

using namespace std;

#define run_forrest_run ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define vi vector <int>
#define sz(a) (int)a.size()
#define fi first
#define se second
#define si set <int>
#define all(x) (x).begin(),(x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);} 

const int inf = 1e9;	
const int mod = inf + 7;

const int N = 205000;
vector <int> g[N];
vector <bool> visited(N);
vector <int> color(N);

ll temp[55][55], M[55][55], K[55][55];
int n;

void matrix_multiplication()
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			temp[i][j] = 0;
			for (int k = 0; k < n; k++)
			{
				temp[i][j] = (temp[i][j] + (M[i][k] * K[k][j]))%mod;
			}
		}
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			K[i][j] = temp[i][j];
}

void matrix_multiplication_k()
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			temp[i][j] = 0;
			for (int k = 0; k < n; k++)
			{
				temp[i][j] = (temp[i][j] + (M[i][k] * M[k][j]))%mod;
			}
		}
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			M[i][j] = temp[i][j];
}

void matrix_power(ll k)
{
	for (int i = 0; i < n; i++)
		K[i][i] = 1;
	while(k > 0)
	{
		if (k % 2 == 1)
			matrix_multiplication();
		k/=2;
		matrix_multiplication_k();
	}
}


int main()
{
	run_forrest_run;
	ll k;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> M[i][j];

	matrix_power(k);
	ll ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			ans = (ans + K[i][j]) % mod;

	cout << ans;
}


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

A = [int(x) for x in input().split()]

s = set()
god = 0
for a in A:
    if a >= 3200:
        god += 1
    else:
        s.add(a // 400)

print("{} {}".format(max(len(s), 1), len(s) + god))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
 
#define mem(dp,a)       memset(dp,a,sizeof dp)
#define ninja           ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)           push_back(x)
#define mp(x,y)         make_pair(x,y)
#define all(c)          c.begin(), c.end()
#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'
#define inf             1e9+7

signed main()
{
	ninja
	int t; 
	t=1;
	while(t--)
	{
		float r; cin>>r;
		float pi=3.141592653589793238;
		cout<<fixed<<setprecision(9)<< 2*pi*r;
	}
}



Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

signed main()
{
    ll n,ans=0;
    cin >> n;
    vector<vector<ll>> v(n + 1, vector<ll>(n-1));
    rep(i, n) rep(j, n - 1)
    {
        cin >> v[i+1][j];

        if (j == n - 2){
            reverse(all(v[i + 1]));

        }
    }

    while (1)
    {

        set<ll> se;
        bool f=true;
        ll cnt=0;

        for (int i = 1; i <= n; i++)
        {
            if(siz(v[i])==0){
                cnt++;
                continue;
            }

            if (v[v[i].back()].back() == i && !se.count(i) && !se.count(v[i].back()))
            {
                f=false;
                //cout<<"DE"<<endl;
                se.insert(i);
                se.insert(v[i].back());
                v[v[i].back()].pop_back();
                v[i].pop_back();
            }
        }

        if(cnt==n){
            break;
        }
        if(f){
            cout<<-1<<endl;
            return 0;
        }
        se.clear();
        ans++;
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 10112
#include<bits/stdc++.h>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int MAX_V=105;
 
int main(){
  
  long long X,t;
  
  cin >> X >> t;
  
  if(X<=t){
    cout << 0 << endl;
  }else{
  cout << X-t << endl;
  }
  
    return 0;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#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;
typedef long long ll;
const int MAX = 999999999;

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

    vector<vector<int>> nums(n, vector<int>(3));
    rep(i, n) rep(j, 3) cin >> nums[i][j];

    int x = 0, y = 0, b_time = 0;
    bool success_flag = true;
    rep(i, n){
        if(abs(nums[i][1] - x) + abs(nums[i][2] - y) > nums[i][0] - b_time) success_flag = false;
        if((nums[i][0] - b_time) % 2 != (abs(nums[i][1] - x) + abs(nums[i][2] - y)) % 2) success_flag = false;

        b_time = nums[i][0];
        x = nums[i][1];
        y = nums[i][2];
    }

    if(success_flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 5760