akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
int main()
{
   IOS;
   ll x;
   cin >> x;
   ll t1=x/500;
   ll t2=(x-t1*500)/5;
   cout<<t1*1000+t2*5;
}


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

int main(){
  int N;
  cin>>N;
  
  vector<long> a(3*N);
  
  for(int i=0;i<3*N;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  long sum = 0;
  for(int i=0;i<N;i++){
    sum += a.at(2*i+1);
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 2688
def greedy(J, L, I):
    ans = 0
    ans += (J // 2) * 2
    ans += (L // 2) * 2
    ans += (I // 2) * 2
    return ans


def solve(I, O, T, J, L, S, Z):
    ans = O
    tmp1 = greedy(J, L, I)
    if J * L * I > 0:
        tmp1 = max(tmp1, 3 + greedy(J - 1, L - 1, I - 1))
    ans += tmp1
    return ans


I, O, T, J, L, S, Z = map(int, input().split())
print(solve(I, O, T, J, L, S, Z))

Measured memory_bytes: 3192
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, M, Q;
int A[101010];
int cnt[101010];
set<int> poss[101010];

int main()
{
	scanf("%d%d%d", &N, &M, &Q);
	for (int i = 0; i < Q; ++i) {
		scanf("%d", A + i);
		--A[i];
	}
	for (int i = 0; i < Q; ++i) {
		++cnt[A[i]];
		poss[A[i]].insert(i);
	}
	set<int> rem;
	for (int i = 0; i < M; ++i) rem.insert(i);
	vector<int> req;
	for (int i = Q - 1; i >= 0; --i) {
		if (rem.count(A[i]) == 0) continue;
		if (0 && rem.size() > 0 && *(rem.begin()) == A[i]) {
			// you can ignore it
		} else {
			req.push_back(A[i]);
		}
		rem.erase(A[i]);
	}
	for (int i : rem) req.push_back(i);
	vector<bool> ok(req.size(), true);
	for (int i = 0; i < req.size() - 1; ++i) if (req[i] > req[i + 1]) ok[i] = false;
	for (int i = req.size() - 2; i >= 0; --i) ok[i] = ok[i] && ok[i + 1];

	for (int i = 0; i < N; ++i) {
		int lp = Q;
		int fg = -1;
		for (int _j = 0; _j < req.size(); _j++) {
			int j = req[_j];
			int nxtp = -1;
			auto pt = poss[j].upper_bound(lp);
		//	printf("%d ", lp);
			if (pt == poss[j].begin()) {
				if (ok[_j]) break;
				else {
					puts("No");
					return 0;
				}
			} else {
				nxtp = *(--pt);
				lp = nxtp;
				poss[j].erase(lp);
			}
		}
	//	puts("");
	}
	puts("Yes");

	return 0;
}


Measured memory_bytes: 15740
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }

  int ans=0;
  for(int i=0;i<n-1;i++){
      int count=0;
      int j=i+1;
    for(j;j<n;j++){
      if(vec.at(j-1)>=vec.at(j)){
        count++;
      }
      else{
        break;
      }
    }
    ans=max(ans,count);
    if(j-i>=(n+1)/2){
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,x;
  cin >> n >> x;
  ll ans = n;
  n = n-x;
  if(n<x)swap(n,x);
  while(n%x!=0){
      ans += (n/x) * x * 2;
      n = n%x;
      if(n<x){
          swap(n,x);
      }
  }
  ans += ((n/x -1) * 2 +1) * x;
   cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;

// auto mod int
// depends on Template

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

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


// combination mod prime
// depends on Template, Modint
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

//input
ll h,w,a,b;


int main(){
    combination c(1e7);
    cin >> h >> w >> a >> b;
    mint ans = 0;
    rep(i,h-a){
        mint tmp = 1;
        tmp *= c(b+i-1,i);
        tmp *= c(w-b-1+h-i-1,w-b-1);
        ans += tmp;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 159368
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let m: usize = scan(tokens);
    let a: Vec<usize> = {
        let mut a: Vec<usize> = rep(n, || scan(tokens));
        a.sort();
        a.reverse();
        a
    };
    let mut l = 0;
    let mut u = 200001;
    let mut u_count = 0;
    while l + 1 < u {
        let c = (l + u) / 2;
        let mut count = 0;
        let mut j = 0;
        for i in (0..n).rev() {
            while j < n && a[i] + a[j] >= c {
                j += 1;
            }
            count += j;
        }
        if count >= m {
            l = c;
        } else {
            u = c;
            u_count = count;
        }
    }
    let cumsum = {
        let mut cumsum = vec![0; n + 1];
        for i in 0..n {
            cumsum[i + 1] = cumsum[i] + a[i];
        }
        cumsum
    };
    let mut ans = 0;
    let mut j = 0;
    for i in (0..n).rev() {
        while j < n && a[i] + a[j] >= u {
            j += 1;
        }
        ans += j * a[i] + cumsum[j];
    }
    ans += (m - u_count) * l;
    println!("{}", ans);
}


Measured memory_bytes: 6396
require("fs").readFileSync("/dev/stdin","utf8").split('\n').map(function(i){z=i.split(' '),a=z[0],b=z[1],c=+z[2],d=z[3],e=z[4],f=+z[5],r=Math.sqrt((a-d)*(a-d)+(b-e)*(b-e));c?console.log(r>c+f?0:r<c-f?2:r<f-c?-2:1):0})

Measured memory_bytes: 7644
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 998244353;

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

  ll n, x, m;
  cin >> n >> x >> m;

  vector<bool> visited(m);
  vector<ll> loop;
  loop.push_back(x);
  visited[x] = true;
  ll now = x;
  while (true) {
    now = (now * now) % m;
    if (visited[now]) break;
    loop.push_back(now);
    visited[now] = true;
  }

  if ((int) loop.size() >= n) {
    ll ans = 0;
    for (int i = 0; i < n; i++) ans += loop[i];
    cout << ans << endl;
    return 0;
  }

  int loop_begin = 0;
  for (int i = 0; i < (int) loop.size(); i++) {
    if ((loop[loop.size()-1] * loop[loop.size()-1]) % m == loop[i]) {
      loop_begin = i;
      break;
    }
  }
  ll loop_size = loop.size() - loop_begin;

  ll loop_init = 0;
  for (int i = 0; i < loop_begin; i++) loop_init += loop[i];
  ll loop_sum = 0;
  for (int i = loop_begin; i < (int) loop.size(); i++) loop_sum += loop[i];

  if (loop[loop.size()-1] == 0) {
    cout << loop_init + loop_sum << endl;
    return 0;
  }

  ll ans = loop_init + loop_sum * ((n - loop_begin) / loop_size);
  ll rem = (n - loop_begin) % loop_size;
  for (int i = loop_begin; i < loop_begin + rem; i++) ans += loop[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3884
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/


int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
       ll x,k,d;
       cin>>x>>k>>d;
       x=abs(x);
       ll y=x/d;
       if(k==y){
        cout<<x-y*d<<endl;
       }
       else if(k>y){
         ll z1=x-y*d;
         ll z2=z1-d;
         k-=y;
         if(k%2==0){
             cout<<z1<<endl;
         }else{
            cout<<abs(z2)<<endl;
         }
       }
       else{
          cout<<x-k*d<<endl;
       }
    }
}















Measured memory_bytes: 3644
#include <stdio.h>
int main(){
	int a,b,c,d,p,x,y;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	x = p * a;
	if(p > c){
		y = b + (p - c)*d;
	}else{
		y = b;
	}
	if(x > y){
		printf("%d\n",y);
	}else{
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	ll ans = 0;
	vl v(n);
	rep(i, n) {
		cin >> v[i];
		ans += v[i];
	}
	ans -= ((*(max_element(all(v)))) / 2);
	cout << ans << endl;
}


Measured memory_bytes: 256
/****JMD****/
/*
Nagendra Jha-11011
acm18in1495
*/
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long int
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define f(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll(a.size())
 
using namespace std;
 
inline void display(vector<ll> v)
{
    for(auto x:v) cout<<x<<" ";
    cout<<"\n";
}
 
vector<ll> check;
 
void SieveOfEratosthenes(ll n,ll mac)
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
 
    for (ll p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
 
    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          {
            if(mac%p==0)
            {
                check.pb(p);
            }
          }
}
 
ll ans=1;
 
void solve(ll n,ll p,ll x)
{
    ll count=0;
 
    while(p%x==0)
    {
        count++;
        p/=x;
    }
 
    ll val=(count/n);
 
    ans*=(int) pow(x,val);
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    ll n,p;
    cin>>n>>p;
 
    if(n==1)
    {
        cout<<p;
        return 0;
    }
 
    SieveOfEratosthenes(1000001,p);
 
    f(i,check.size()) solve(n,p,check[i]);
 
    cout<<ans;
 
    return 0;
}

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

int32_t main(){
	ios::sync_with_stdio(0);
	int a, b, c;
	cin >> a >> b >> c;
	if((a==b and b==c) or (a!=b and b!=c and c!=a))
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  val sc = new Scanner(System.in)

  def main(args: Array[String]): Unit = {
    val s = sc.next
    val res =
      if(s.length == 1) s.toLong
      else
        (0 until Math.pow(2, s.length - 1).toInt).foldLeft(0L) { (sum, acc) =>
          val ss = acc.toBinaryString.toInt
          val sss = s"%0${s.length - 1}d".format(ss) // s.length = 1 だと、エラーになる
          sum + buildFormula(s, sss)
        }
    println(res)
  }

  def buildFormula(numStr: String, binaryStr: String): Long = {
    val l = binaryStr.zipWithIndex.filter(_._1 == '1').map(_._2 + 1) :+ (binaryStr.length + 1)
    val ll =
      l.foldLeft(0L, 0) { (res, acc) =>
        val (sum, i) = res
        (sum + numStr.substring(i, acc).toLong, acc)
      }._1
    ll
  }
}


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

int main(void){
    int n; cin >> n;
    vector<int> vec1(n);
    vector<int> vec2(n);
    for(int i=0;i<n;i++) cin >> vec1.at(i);
    for(int i=0;i<n;i++) cin >> vec2.at(i);

    int point=0;
    for(int i=0;i<n;i++){
        int tmp=0;
        for(int j=0;j<=i;j++) tmp += vec1.at(j);
        for(int j=i;j<n;j++) tmp += vec2.at(j);
        point  = max(point,tmp);
        //cout << point << endl;
    }
    cout << point << endl;
    return 0;
}   

Measured memory_bytes: 256
n = int(input())
a0 = list(map(int, input().split()))
a1 = list(map(int, input().split()))

def max_candy(i, j):
	if i == 0:
		if (j == n - 1):
			return a0[j] + a1[j]
		else:
			return max(max_candy(0, j + 1), max_candy(1, j)) + a0[j]
	else:
		return sum(a1[j:])

ans = max_candy(0, 0)
print(ans)

Measured memory_bytes: 3064
//g++  5.4.0

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(void)
{
    ll n,m,c;
    cin>>n>>m>>c;
    ll car[m];
    for(ll i=0;i<m;++i)
    {
        cin>>car[i];
    }
    ll res=0;
    ll tsum;
    for(ll i=0;i<n;++i)
    {
        ll ar;
        tsum=0;
        for(ll j=0;j<m;++j)
        {
            cin>>ar;
            tsum+=ar*car[j];
            //cout<<ar<<" ";
        }
        if(tsum+c>0)
        {
            ++res;
        }
        //cout<<"\n";
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
using namespace std;



int main(){
	int n;
	cin>>n;
	int *a;
	a=new int[n];
	rep(i,n){
		cin>>a[i];
	}
	int x=n;
	while(x>0){
		//cout<<x<<" ";
		cout<<a[x-1]<<" ";
		x-=2;
	}
	if(x==-1) x+=3;
	else x++;
	while(x<n){
		//cout<<x<<" ";
		cout<<a[x-1]<<" ";
		x+=2;
	}
	//cout<<n-1<<endl;

	//cout<<a[n-2]<<endl;
		

	delete []a;

	return 0;
	

}

Measured memory_bytes: 2944
#include <cstdio>
#define N 200100

int n,m,q,i,dep[N],col[N],tot;
bool vis[N];
struct C {int v,d,c;} c[N];
struct node {int to;  node* nxt;} g[N],*last[N];

inline void read(int &p) {
	char c = getchar();	 p = 0;
	while (c < '0' || c > '9') c = getchar();
	while (c >= '0' && c <= '9') p = p*10+c-48,c=getchar();
}

void dfs(int v,int d,int c) {
	vis[v] = true;
	if (!col[v]) col[v] = c;  dep[v] = d;
	for (node *p=last[v];p;p=p->nxt) if (dep[p->to] < d-1 && !vis[p->to]) dfs(p->to,d-1,c);
	vis[v] = false;
}

int main() {
	read(n);  read(m);
	for (i=0;i<m;i++) {
		int a,b;  read(a);  read(b);
		last[a] = &(g[tot++] = (node){b,last[a]});
		last[b] = &(g[tot++] = (node){a,last[b]});
	}
	read(q);
	for (i=0;i<q;i++) read(c[i].v),read(c[i].d),read(c[i].c);
	while (q--) dfs(c[q].v,c[q].d+1,c[q].c);
	for (i=1;i<=n;i++) printf("%d\n",col[i]);
}

Measured memory_bytes: 8192
n = int(input())
nums = list(map(int, input().split()))

nums1 = nums[0::2]
nums2 = nums[1::2]

bug1 = [0] * 100001
bug2 = [0] * 100001

for num in nums1:
    bug1[num] += 1

for num in nums2:
    bug2[num] += 1

max_v_1 = max(bug1)
max_i_1 = bug1.index(max_v_1)
max_v_2 = max(bug2)
max_i_2 = bug2.index(max_v_2)

if max_i_1 == max_i_2:
    bug1[max_i_1] = 0
    bug2[max_i_2] = 0
    sec_max_v_1 = max(bug1)
    sec_max_v_2 = max(bug2)
    print(n - max(max_v_1, max_v_2) - max(sec_max_v_1, sec_max_v_2))
else:
    print(n - max_v_1 - max_v_2)

Measured memory_bytes: 14404
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int nums[15];

int f(int n){
  n--;
  int res = 0;
  rep(i, 15){
    if(nums[i] >= n) res++;
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
  rep(n, 2, N + 1){
    int num = n;
    rep(i, 15){
      while(num % primes[i] == 0){
        num /= primes[i];
        nums[i]++;
      }
    }
  }
  int num3 = f(3);
  int num5 = f(5);
  int num15 = f(15);
  int num25 = f(25);
  int num75 = f(75);
  int ans = 0;
  ans += num5 * (num5 - 1) / 2 * (num3 - 2);
  ans += num25 * (num3 - 1);
  ans += num15 * (num5 - 1);
  ans += num75;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <typeinfo>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

int main()
{
    ll k, rate = 1, sum = 0;

    cin >> k;

    for (int i = 0; i < k; i++)
    {
        for (int j = 0; j < k; j++)
        {
            for (int l = 0; l < k; l++)
            {
                if (i != j && j != l && l != i)
                {
                    rate = 6;
                }
                else if (i == j && j == l)
                {
                    rate = 1;
                }
                else
                {
                    rate = 3;
                }
                sum += gcd(i + 1, gcd(j + 1, l + 1));
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
#ABC142-E Get Everything
"""
宝箱の制約が12個なので、これの状態を集合とする.
鍵をcost昇順に並べる。
ある鍵について、新たに埋められる場所が存在するなら、その鍵を使ってみる
"""
import sys
readline = sys.stdin.buffer.readline

n,m = map(int,readline().split())
INF = 10**10
cost_len_key = []
for i in range(m):
    a,b = map(int,readline().split())
    lst1 = list(map(int,readline().split()))
    res = 0
    for j in lst1:
        res += 1<<(j-1)
    cost_len_key.append([a,INF-b,res])

cost_len_key.sort()

#dp:状態s(か、s以上)の箱を開けた場合の最小コスト
dp = [INF for _ in range(1<<n)]
dp[0] = 0

for i in range(1<<n):
    for j in cost_len_key:
        s = i|j[2]
        dp[s] = min(dp[s],dp[i]+j[0])

ans = dp[-1]
if ans < INF:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 42332
// Example program
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int n;
  cin >>n;
  int a[n];
  for(int i =0;i<n;i++) cin >>a[i];
  sort(a,a+n);
  bool x=0;
  for(int i=0;i<n-1;i++)
  if(a[i] ==a[i+1]) {
      x=1;
      break;}
  
 if(!x)cout<<"YES\n";
  else cout <<"NO\n";
      return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;



int main(){
  ll c=100;
  ll x;
  cin>>x;
  ll yr=0;
  bool judge=true;
  while(judge){
    yr++;
    c*=1.01;
    
    if(c>=x){
      cout<<yr<<endl;
      
      judge=false;
      return 0;
      break;
    }
    
    
  }

 
}


Measured memory_bytes: 3584
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();     
        int N = r.i();
        println(N*N*N);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 20948
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ull Pow(ull a , ull b){
	if(b == 0) return 1 ;
	ull c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c) % mod)) % mod;
	return (c * c) % mod ;
}
ll countDivisibles(ll A, ll B, ll M) 
{ 
    // Add 1 explicitly as A is divisible by M 
    if (A % M == 0) 
        return (B / M) - (A / M) + 1; 
  
    // A is not divisible by M 
    return (B / M) - (A / M); 
} 
int main(){
	IOS;
	cout.precision(30) ;
	long double n , k ; cin >> n >> k ;
	long double ans = max((long double)0.00 , (n - k + 1)) / n ;
	for(int i = 1 ; i < min(n + 1 ,k) ; i++){
		//long double q = k / i ;
		ll alpha = log2(k / i) + (log2(k / i) != (int)log2(k /i)) ;
		//cout << alpha << endl; 
		ans += (1.0 / n) * (1.0 / Pow(2 , alpha)) ;
	}
	cout << ans << endl ;
	return 0;
}


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

using namespace std;

#define int long long



main(){

	string s; cin >> s;

	for(int i = 0; i < s.size(); i += 2){
		if(s.substr(i, 2) != "hi"){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	

	




	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int power(int n){
	return n*n*n*n*n;
}


int32_t main(){
	int x;
	cin >> x;
	
	int flag = 0;
	for(int i = -200; i <= 200; i++){
		for(int j = -200; j <= 200; j++){
			if(power(i)-power(j) == x){
				cout << i << " " << j << " " << endl;
				flag = 1;
				break;
			}
		}
		if(flag)
			break;
	}
	
	//int cur = 1;
	
	//map<int,int> m;
	//m[0] = 0;
	//m[1] = 1;
	//while(power(cur) <= 1e18){
		//m[power(cur)] = cur;
		//cur++;
	//}
	
	//if(m.count(x)){
		//cout << m[x] << " " << 0 << endl;
		//return 0;
	//}
	//if(m.count(-x)){
		//cout << -m[x] << " " << 0 << endl;
		//return 0;
	//}
	
	
	//for(auto e : m){
		//int a1 = x + e.first;
		//int a2 = x - e.first;
		
		//if(m.count(a1)){
			//cout << e.second << " " << m[a1];
			//return 0;
		//}
		
		//if(a2 > 0 && m.count(a2)){
			//cout << m[a2] << " " << -e.second;
			//return 0;
		//}
		
		//if(a2 < 0 && m.count(-a2)){
			//cout << -m[-a2] << " " << e.second;
			//return 0;
		//}
	//}

	return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int X;
struct func
{
int a,b,c;
int operator () (int x)
{
	if(x<=a) return a+c;
	if(x>=b) return b+c;
	return x+c;
}
};
func operator - (func a,int x)
{
	a.c-=x;
	if(a.c+a.b<0) {a.a=0; a.b=0; a.c=0; return a;}
	if(a.a+a.c<0) a.a=-a.c;
	return a;
}
func operator + (func a,int x)
{
	a.c+=x;
	if(a.c+a.a>X) {a.a=0; a.b=0; a.c=X; return a;}
	if(a.b+a.c>X) a.b=X-a.c;
	return a;
}
#define SZ 233333
int k,r[SZ]; func fs[SZ];
int main()
{
	scanf("%d%d",&X,&k);
	fs[0].a=0; fs[0].b=X; fs[0].c=0;
	for(int i=1;i<=k;++i)
	{
		scanf("%d",r+i);
		if(i&1)
			fs[i]=fs[i-1]-(r[i]-r[i-1]);
		else
			fs[i]=fs[i-1]+(r[i]-r[i-1]);
	}
	int q,t,a;scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d",&t,&a);
		int g=upper_bound(r,r+k+1,t)-r-1;
		func s=fs[g];
		if(g&1) s=s+(t-r[g]);
		else s=s-(t-r[g]);
		printf("%d\n",s(a));
	}
}

Measured memory_bytes: 2816
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
    char a[4];
    char b;
    int i;
    for (i = 0; i < 3; i++)
    {
        scanf("%c", &b);
        a[i] = b;
    }
    if (!strcmp(a, "SUN"))
    {
        printf("7\n");
    }
    else if (!strcmp(a, "MON"))
    {
        printf("6\n");
    }
    else if (!strcmp(a, "TUE"))
    {
        printf("5\n");
    }
    else if (!strcmp(a, "WED"))
    {
        printf("4\n");
    }
    else if (!strcmp(a, "THU"))
    {
        printf("3\n");
    }
    else if (!strcmp(a, "FRI"))
    {
        printf("2\n");
    }
    else if (!strcmp(a, "SAT"))
    {
        printf("1\n");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int C = sc.nextInt();

        int[] Bi = new int[M];
        for (int i=0; i<M; i++) {
            Bi[i] = sc.nextInt();
        }
        int cnt = 0;
        for (int i=0; i<N; i++) {
            int cal = 0;
            for (int j=0; j<M; j++) {
                int A = sc.nextInt();
                int B = Bi[j];
                cal = cal + (A * B);
            }
            if ((cal + C) > 0) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

}


Measured memory_bytes: 24148
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

/*bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}*/
/*ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/
/*ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}*/
/*ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}*/
/*ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}*/
//printf("%.10f\n", n);

signed main() {
	string s, t;
	ll n, m, k, q, a = 0, b = 0, c = 0;
	cin >> n;
	if (n >= 30) { cout << "Yes\n"; }
	else { cout << "No\n"; }
	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
  
int main(){
  int n, x, i, j, k, c = 0;
  while(scanf("%d%d", &n, &x)){
    if(n == 0 && x == 0) break;
    for(i = 1;i < n - 1;i++)
      for(j = i + 1;j < n;j++)
        for(k = j + 1;k < n + 1;k++)
          if((i + j + k) == x) c++;
    printf("%d\n", c);
    c = 0;
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)

struct Node {
    int   key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z        = (Node *)malloc(sizeof(Node));
    z->key   = k;
    z->left  = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if (u == NIL) return;
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int    n, i, x;
    string com;
    cin >> n;

    rep(i, n) {
        cin >> com;
        if (com == "insert") {
            cin >> x;
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}



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

int main()
{
    int N, M, T;
    scanf("%d%d%d", &N, &M,&T);
    int t{-M}, sum{};
    for (int i{}; i < N; i++)
    {
        int a;
        scanf("%d", &a);
        sum += std::max(0, a - t - 2 * M);
        t = a;
    }
    sum += std::max(T - t - M, 0);
    printf("%d\n", sum);
    return 0;
}


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

using namespace std;

int H, W;
int DpOfRow[500][500];

int calculation() {
	int len, ans;

	ans = 0;
	for (int i = 0; i < H; i++) {
		for (int j = W - 1; j > -1; j--) {
			if (DpOfRow[i][j] == 0) {
				continue;
			}
			len = INT_MAX;
			for (int k = i; k < H; k++) {
				len = min(len, DpOfRow[k][j]);
				if (len == 0) {
					break;
				}
				ans = max(ans, len*(k - i + 1));
			}
		}
	}
	
	return ans;
}


int main() {
	char c;

	while (cin >> H >> W, H) {
		memset(DpOfRow, 0, sizeof(DpOfRow));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> c;
				if (c == '.') {
					DpOfRow[i][j] = (j == 0 ? 1 : DpOfRow[i][j - 1] + 1);
				}
			}
		}
		cout << calculation() << endl;
	}

	return 0;
}


Measured memory_bytes: 3980
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019

min = 2019
if LL >= RR:
    min = 0
elif R-L >= 2018:
    min = 0
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min = (i*j)%2019
            if (i*j)%2019 == 0:
                min = 0
                break
        else:
            continue
        break


print(min)


Measured memory_bytes: 12504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl <<"\n"
#define con continue
#define br break
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
ll mx=INT_MAX;
ll mi=INT_MIN;
const ll MOD=998244353;
const ll inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define io { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

int main()
{
        io;
        //////////////////////////////////
        ll a;
        cin>>a;
        cout<<a+a*a+a*a*a;
        //////////////////////////////////
        cer;
}

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

int main() {
	int n;
	cin >> n;
	vector<pair<int, int> > a(n);
	for(int i=0; i<n; i++){
		int b;
		cin >> b;
		a.at(i) = make_pair(b, i+1);
	}
	sort(a.begin(), a.end());
	for(int i=0; i<n; i++){
		cout << a.at(i).second << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin >> x;
    int m = x, sum = 0;
    while (m)
        sum += m % 10, m /= 10;
    if (x % sum == 0)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(n-1):
    if a[i+1] - a[i] == 1:
        add = a[i]
        ans += c[add-1]
    else:
        pass
print(ans)

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

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

    int N, M; cin >> N >> M;
    int ans = 0;
    for (int i = 1; i <= max(N, (int)sqrt(M) + 1); ++i) {
        if (M % i == 0) {
            if (i >= N) ans = max(ans, M / i);
            if (M / i >= N) ans = max(ans, i);
        }
    }
    cout << ans << endl;

    return 0;
}

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

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

	int c[4][14] = { {0} };
	for (int i = 0; i < n; i++) {
		char e;
		int f;
		cin >> e >> f;
		if (e == 'S')c[0][f] = 1;
		else if (e == 'H')c[1][f] = 1;
		else if (e == 'C')c[2][f] = 1;
		else if (e == 'D')c[3][f] = 1;
	}
	for (int i = 0; i < 4; i++)
		for (int j = 1; j <= 13; j++) {
			if (c[i][j])continue;
			else {
				switch (i) {
				case 0:
					cout << "S ";
					break;
				case 1:
					cout << "H ";
					break;
				case 2:
					cout << "C ";
					break;
				case 3:
					cout << "D ";
					break;
				}
				cout << j << endl;
			}
		}


	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n,a,b,c,l[10];
int ans=INF;
int e,f,g;
int cnt;
void func(int m){
	if(m==n){
		int z=ans;
		if(!e||!f||!g)return;
		ans=min(ans,(cnt-3)*10+abs(e-a)+abs(f-b)+abs(g-c));
		return;
	}
	rep(i,4){
		if(!i)func(m+1);
		else{
			if(i==1){
				e+=l[m];
				cnt++;
				func(m+1);
				cnt--;
				e-=l[m];
			}
			else if(i==2){
				f+=l[m];
				cnt++;
				func(m+1);
				cnt--;
				f-=l[m];
			}
			else{
				g+=l[m];
				cnt++;
				func(m+1);
				cnt--;
				g-=l[m];
			}
		}
	}
}
signed main(){
	cin>>n>>a>>b>>c;
	rep(i,n)cin>>l[i];
	func(0);
	cout<<ans<<endl;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int maxn = 1e6 + 5;


int n;
int a[maxn];

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

  cin>>n;
  int hi = 0;
  for (int i=0; i<n; i++) {
    cin>>a[i];
    hi = max(hi, a[i]);
  }
  int mid = hi/2;
  int best = 1e9;

  for (int i=0; i<n; i++) {
    if (a[i] == hi) continue;
    int dx = abs(mid-a[i]);
    if (dx < abs(best-mid)) {
      best = a[i];
    }
  }

  cout<<hi<<" "<<best<<endl;
  
  

  return 0;
}


Measured memory_bytes: 640
import scala.io.StdIn.{readLine,readInt}

object Main {

  def main(args: Array[String]) = {
    val n = readInt
    val (min,max,sum):(Int,Int,Long) = readLine.split(" ")
                                .map(_.toInt)
                                .foldLeft(Int.MaxValue,Int.MinValue,0.toLong){ case ((min,max,sum),x)=>(Math.min(min,x),Math.max(max,x),sum+x) }
    printf("%d %d %d\n",min,max,sum)
  }
}

Measured memory_bytes: 49940
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<string>
using namespace std;
int main(){
  int x,a,b;
  cin>>x>>a>>b;

  x-=a;
  while(x-b>=0)
    x-=b;

  cout<<x<<endl;
return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

map <int, ll> mp;
vector <int> cnt;
void solve(void){
    int N, K, k = 0;
    cin >> N >> K;
    rep(N, i) {
        int d;
        cin >> d;
        if (mp[d] == 0) k++;
        mp[d]++;
    }
    ll ans = 0LL;
    for (auto p : mp) {
        cnt.pb(p.second);
    }
    sort(all(cnt));
    rep(k-K, i) {
        ans += cnt[i];
    }
    cout << ans << endl;
}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


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

int main(){

    long long N, W; cin >> N >> W;
    vector<long long> w(N);
    vector<long long> v(N);
    for(long long i = 0; i < N; i++) cin >> w[i] >> v[i];
    vector<long long> a(1, 0LL);
    vector<long long> b(1, 0LL);    
    vector<long long> c(1, 0LL);    
    vector<long long> d(1, 0LL);
    a.push_back(v[0]);
    for(long long i = 1; i < N; i++){
        if(w[i] == w[0]) a.push_back(v[i]);
        else if(w[i] == w[0] + 1LL) b.push_back(v[i]);
        else if(w[i] == w[0] + 2LL) c.push_back(v[i]);
        else d.push_back(v[i]);
    }

    sort(a.begin() + 1, a.end(), greater<long long>());
    sort(b.begin() + 1, b.end(), greater<long long>());
    sort(c.begin() + 1, c.end(), greater<long long>());
    sort(d.begin() + 1, d.end(), greater<long long>());

    
    

    for(long long i = 1; i < (long long)a.size(); i++) a[i] += a[i - 1];
    for(long long i = 1; i < (long long)b.size(); i++) b[i] += b[i - 1];
    for(long long i = 1; i < (long long)c.size(); i++) c[i] += c[i - 1];
    for(long long i = 1; i < (long long)d.size(); i++) d[i] += d[i - 1];
    

    long long ans = 0LL;
    //全探索
    for(long long i = 0; i < (long long)a.size(); i++){
        for(long long j = 0; j < (long long)b.size(); j++){
            for(long long k = 0; k < (long long)c.size(); k++){
                for(long long l = 0; l < (long long)d.size(); l++){
                    long long tmp_w = i * w[0] + j * (w[0] + 1LL) + k * (w[0] + 2LL) + l * (w[0] + 3LL);
                    //cout << i << " " << j << " " << k << " " << l << endl;                    

                    if(tmp_w > W) continue;
                    long long tmp_v = a[i] + b[j] + c[k] + d[l];

                    ans = max(ans, tmp_v);
                    //cout << i << " " << j << " " << k << " " << l << " " << tmp_w << " " << tmp_v << endl;
                }
            }
        }
    }
    
    cout << ans << endl;    
    
    
    return 0;
}

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

int main( int argc, char *argv[] )
{
int A;
int B;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> A;
	cin >> B;
	if( A == B )
		cout << "Draw" << endl;
	else if( A == 1 )
		cout << "Alice" << endl;
	else if( B == 1 )
		cout << "Bob" << endl;
	else if( A < B )
		cout << "Bob" << endl;
	else
		cout << "Alice" << endl;

	return 0;
}



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

int main() {
    int N;
    cin >> N;
    int res = 0;
    for (int i = 1; i <= N; ++i) {
        int a;
        cin >> a;
        if (i & 1 && a & 1) {
            ++res;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3620
s = input()
t = input()
d1 = {}
d2 = {}

for i in range(len(s)):
  if s[i] not in d1:
    d1[s[i]] = t[i]
  elif d1[s[i]] != t[i]:
    print("No")
    break
  if t[i] not in d2:
    d2[t[i]] = s[i]
  elif d2[t[i]] != s[i]:
    print("No")
    break
  
else:
  print("Yes")

Measured memory_bytes: 3632
#include<bits/stdc++.h>//author::@whohet-->Het Patel
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define test int T; cin>>T; while(T--)
#define endl "\n"
#define int long long
#define uint unsigned long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vvi vector<vector<int>>
#define mii map<int,int>
#define msi map<string,int>
#define mis map<int,string>
#define pb push_back
#define mod 1000000007
#define PI 3.141592653589793238

using namespace std;

//author::@whohet-->Het Patel

signed main()
{
	fasterthanlight;
	int p,s;
	cin>>p>>s;int arr[p]={};
	vi v[s];
	for(int i=0;i<s;i++)
	{
		int d;
		cin>>d;
		while(d--)
		{
			int t;
			cin>>t;
			arr[t-1]=1;
		}
	}int x=0;
	for(int i=0;i<p;i++)
		if(arr[i]==0)
			x++;

	cout<<x;
}


Measured memory_bytes: 3640