akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
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;}

int main() {
    string s;
    cin >> s;
    if (s.substr(0, 4) == "YAKI") cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int h, w;
	int i, j;

	while (1) {
		scanf("%d %d" ,&h ,&w);

		if (h == 0 && w == 0) {
			break;
		}

		for (i = 0; i < h ;i++) {
			for (j = 0; j < w; j++) {
				if (i == 0 || i == h - 1) {
					printf("#");
				} else if (j == 0 || j == w - 1) {
					printf("#");
				} else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2036
#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include<iomanip>
#include <random>
using namespace std;

/*int median_search(vector<int> num, int start, int end,int pivot,int size)
{
    int k = start;
    int l = end;
    while(k<=l){
        if(num[k]>pivot&&num[l]<pivot){
            swap(num[k],num[l]);
        }
        k++;
        l--;
    }
    if(k < n/2)

}
*/
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


int main()
{
    int n;
    cin >> n;
    int* num;
    num = new int[n];
    for (int i = 0; i < n; i++)
    {
        cin >> num[i];

    }
    //std::mt19937_64 get_rand_mt; // 64bit版メルセンヌ・ツイスタ
    //std::shuffle( num.begin(), num.end(), get_rand_mt );
    qsort(num, n, sizeof(int),compare_int);
    /*for (int i = 0; i < n; i++)
    {
        cout << num[i] << " ";
    }
    cout << endl;
    */
    int half = n/2-1;
    if(num[half]==num[half+1]) cout << 0 << endl;
    else{
        int diff = num[half+1]-num[half];
        cout << diff << endl;
        
    }


}

Measured memory_bytes: 1020
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while (t-- != 0) {
			long a = scan.nextLong();
			long b = scan.nextLong();
			long c = scan.nextLong();
			long d = scan.nextLong();
			System.out.println(eval(a, b, c, d) ? "Yes" : "No");
		}
	}
	boolean eval(long a, long b, long c, long d) {
		if (b > a || b > d)
			return false;
		if (c >= b)
			return true;
		if (b - gcd(b, d) + (a % gcd(b, d)) > c)
			return false;
		else
			return true;
	}
	long gcd(long a, long b) {
		if (a % b == 0)
			return b;
		return gcd(b, a % b);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 25168
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
using namespace std;
int main(){
   int a,b;
   cin >> a >> b ;
   if(a<b){
     cout << b-a << endl;
   }else{
     cout << a-b << endl;
   }
   return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n, m; cin >> n >> m;
	vector<pair<pair<int, int>, ll>> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i].first.second >> a[i].first.first;
		a[i].first.second--;
		cin >> a[i].second;
	}
	auto comp = [](auto a, auto b) {
		if (a.first.first == b.first.first) {
			return a.second < b.second;
		}
		return a.first.first < b.first.first;
	};
	sort(a.begin(), a.end(), comp);
	ll INI = (ll)1e18;
	vector<ll> d(n + 2, INI);
	d[0] = 0;
	for (int i = 0; i < m; i++) {
		int l = a[i].first.second;
		int r = a[i].first.first;
		ll c = a[i].second;
		for (int j = r - 1; j >= l; j--) {
			if (d[j] <= d[l] + c) break;
			d[j] = d[l] + c;
		}
	}
	if (d[n - 1] >= INI) cout << -1 << endl;
	else cout << d[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
#include <math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,a;
    bool OK[4][15]={false};
    cin>>n;

    char c;
    rep(i,n){
	cin>>c>>a;
	if(c=='S'){
	    OK[0][a]=true;
	}
	else if(c=='H'){
	    OK[1][a]=true;
	}
	else if(c=='C'){
	    OK[2][a]=true;
	}
	else{
	    OK[3][a]=true;
	}
    }

    rep(i,4){
	reps(j,13){
	    if(!OK[i][j]){
		if(i==0){
		    cout<<'S';
		}
		else if(i==1){
		    cout<<'H';
		}
		else if(i==2){
		    cout<<'C';
		}
		else{
		    cout<<'D';
		}

		cout<<" "<<j<<'\n';
	    }
	}
    }
    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int sum=0;
    for(int i=1;i<3;++i){
        if(s.at(i)==s.at(i-1))sum++;
    }
    if(sum==2)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
/*
 
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, long long> pil;
typedef pair <int, string> pis;
typedef pair <int, char> pic;
typedef pair <long long, int> pli;
typedef pair <long long, string> pls;
typedef pair <long long, char> plc;
typedef pair <string, int> psi;
typedef pair <string, long long> psl;
typedef pair <string, char> psc;
typedef pair <char, int> pci;
typedef pair <char, long long> pcl;
typedef pair <char, string> pcs;
 
int n;
 
int main () {
	cin >> n;
	string s, s1, s2;
	cin >> s;
	if (sz(s) == 1 || sz(s) % 2 != 0) {
	    cout << "No";
	    return 0;
	}
	for (int i = 0; i < sz(s) / 2; ++i) {
	    s1.pb(s[i]);
	}
	for (int i = sz(s) / 2; i < sz(s); ++i) {
	    s2.pb(s[i]);
	}
	if (s1 == s2) {
	    cout << "Yes";
	    return 0;
	}
	cout << "No";
	return 0;
}

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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define FORR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 );
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

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

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

struct Team {
	int id;
	int time;
	int score;
	int wrong[11] = {};
};

bool compare( const Team& a, const Team& b ) {
	return a.score > b.score || ( a.score == b.score && a.time < b.time ) || 
		   ( a.score == b.score && a.time == b.time && a.id > b.id );
}

signed main() {
	int M, T, P, R;
	while( cin >> M >> T >> P >> R && M ) {
		vector<Team> team( T );
		REP( i, T ) team[i].id = i + 1;

		int m, t, p, j;
		REP( i, R ) {
			cin >> m >> t >> p >> j;
			if( j == 0 ) {
				team[t - 1].score++;
				team[t - 1].time += m + team[t - 1].wrong[p] * 20;
			} else {
				team[t - 1].wrong[p]++;
			}
		}

		sort( ALL( team ), compare );

		REP( i, T ) {
			if( i != T - 1 && team[i].score == team[i + 1].score && team[i].time == team[i + 1].time ) {
				cout << team[i].id << '=';
			} else if( i != T - 1 ){
				cout << team[i].id << ',';
			} else {
				cout << team[i].id << endl;
			}
		}
	}
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;


struct Unionfind{
    vector<int> parents;
    int n;
    Unionfind(int n):n(n),parents(n,-1){ }

    int find(int x){
        if(parents[x] < 0) return x;
        else return parents[x] = find(parents[x]);
    }

    void unite(int x,int y){
        x = find(x);
        y = find(y);

        if(x==y) return;
        if(parents[x] > parents[y]) swap(x,y);
        parents[x] += parents[y];
        parents[y] = x;
    }  

   int size(int x){
       return -parents[find(x)];
   }

   bool same(int x,int y){
       return find(x) == find(y);
   }

   vector<int> members(int x){
       int root = find(x);
       vector<int> member;
       for(int i=0;i<n;i++){
           if(find(i)==root){
               member.push_back(i);
           }
       }
      return member;
  }

  int group_cnt(){
      int c = 0;
      rep(i,n){
          if(parents[i] < 0) ++c;
      }
      return c;
  }
};

struct edge{
    int from,to,cost;  
};

int main(){
    int n;
    cin >> n;
    vector<edge> eg;
    rep(i,n)rep(j,n){
        int a;
        cin >> a;
        if(i > j) continue;
        if(a==-1) continue;
        eg.push_back(edge{i,j,a});
    }

    sort(eg.begin(),eg.end(),[](const edge &l,const edge &r){
        return l.cost < r.cost;
    });

    Unionfind uf(n);
    int ans = 0;

    rep(i,eg.size()){
        if(uf.same(eg[i].from,eg[i].to)) continue;
        uf.unite(eg[i].from,eg[i].to);
        ans += eg[i].cost;
    }
    
    cout << ans << endl;
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    stack<int> s;
    int n;
    while (cin >> n)
    {
        if (n == 0)
        {
            OP(s.top())
            s.pop();
        }
        else
        {
            s.push(n);
        }
    }

    return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>
#include <vector>
using namespace std;
int RB[11][11],j,N;bool used[11][11];vector<int>a,x;
void dfs(int here, int prev, int cost) {used[here][prev]=used[prev][here]=0;x.push_back(here);for (int i=1,k=0;i<=N;i++) {if (used[here][i] && RB[here][i]) k++,dfs(i,here,cost+RB[here][i]); if (!k) if (j<cost) j=cost,a=x;} x.pop_back();used[here][prev]=used[prev][here]=1;}
int main() {int i,k,f;for (i=0;i<11;i++) for (j=0;j<11;used[i][j++]=1);while (1) {a.clear(),x.clear();scanf("%d %d",&N,&k);if (!N && !k) return 0;for (i=1;i<=N;i++) for (j=1;j<=N;RB[i][j++]=0);while (k--) {scanf("%d %d %d",&i,&j,&f);RB[i][j]=RB[j][i]=f;}for (i=1,j=0;i<=N;i++) dfs(i,i,0);printf("%d\n",j);for (printf("%d",a[0]),i=1,j=a.size();i<j;printf(" %d",a[i++]));puts("");}}

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

using namespace std;

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

int main(){

  int n;
  bool flag = false;
  
  cin >> n;
  
  rep(i, n){
    string s;
    cin >> s;
    if(s == "Y"){
      flag = true;
    }
  }
  
  if(flag){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
  
  return 0;
}

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

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

    int x, y;
    cin >> x >> y;

    vector<int> A =  {300000, 200000, 100000};

    int ans = 0;
    if(x <= 3){
        ans += A[x - 1];
    }
    if(y <= 3){
        ans += A[y - 1];
    }

    if(x == 1 and y == 1){
        ans += 400000;
    }

    cout << ans << endl;

    return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

int main() {
	int n, h, w;
	cin >> n >> h >> w;
	cout << (n-h+1) * (n-w+1) << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nk[0];
        var k = nk[1];
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();

        long[] l = new long[n];
        for (int i = 0; i < n; i++)
        {
            int s = (int)Math.Ceiling(i + 1 - a[i] - 0.5);
            if (s <= 0) s = 1;
            int e = (int)Math.Floor(i + 1 + a[i] + 0.5);
            l[s - 1]++;
            if (e < n) l[e]--;
        }

        for (int i = 1; i < n; i++) l[i] += l[i - 1];

        k = Math.Min(k, 100);
        for (int x = 1; x < k; x++)
        {
            long[] tmp = new long[n];
            Array.Copy(l, tmp, n);
            l = new long[n];
            for (int i = 0; i < n; i++)
            {
                int s = (int)Math.Ceiling(i + 1 - tmp[i] - 0.5);
                if (s <= 0) s = 1;
                int e = (int)Math.Floor(i + 1 + tmp[i] + 0.5);
                l[s - 1]++;
                if (e < n) l[e]--;
            }

            for (int i = 1; i < n; i++) l[i] += l[i - 1];
        }



        // 出力
        for (int i = 0; i < l.Length; i++)
        {
            Console.Write(l[i] + " ");
        }

    }
}

Measured memory_bytes: 74088
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
public static void main(String[] args) {
	try {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
			String input;
			input = buf.readLine();
			
			String[] strAry = input.split(" ");
		       int x = Integer.parseInt(strAry[0]);
		       int y = Integer.parseInt(strAry[1]);
		       int z = Integer.parseInt(strAry[2]);
		       
		     if(x <  y && y  < z){
		    	 System.out.println("Yes");
		     }
		     else{
				System.out.println("No");
			}
	} catch (Exception e) {
		// TODO: handle exception
	}
}

}

Measured memory_bytes: 24176
#include <stdio.h>
#define loop(a,b) for(int i=a;i<b;i++)
#define loop2(a,b) for(int j-a;j<b;j++)
int main(){
	
	int ha,ma,hb,mb,k;
	scanf("%d %d %d %d %d", &ha, &ma, &hb, &mb ,&k);
	int time1 = ha*60 + ma;
	int time2 = hb*60 + mb;
	int length = time2 - k - time1;
	printf("%d\n", length);
	
	return 0;
}

Measured memory_bytes: 1712
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;

namespace at_coder
{
#if TEST
    [TestClass]
#endif
    public class Test_153_c
{

#if TEST
        public static void Test_Main()
#else
        public static void Main()
#endif
        {
            var ar = ReadIntArray();
            int N = ar[0];
            int K = ar[1];

            int []H = ReadIntArray();

            long n = Solve(N, K, H);

            Console.WriteLine(n.ToString());
        }

        private static long Solve(int n, int k, int[] h)
        {
            if (k > n) return 0;
            List<int> list = new List<int>(h);
            list.Sort();
            long l = 0;
            int count = n - k;
            foreach(int a in list.Select(r => r).Take(n - k)) 
            {
                l += a;
            }

            return l;
        }

        private static int[] ReadIntArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ar[i] = int.Parse(ss[i]);
            }
            return ar;
        }
#if TEST
#else
    }
}
#endif


Measured memory_bytes: 33536
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define pi pair<ll,ll>
using namespace std;
int main(){
	//	freopen("in.txt","r",stdin);
	int N;
	int x=0;
	char S[110];
	scanf("%d",&N);
	scanf("%s",S);
	int max_x=0;
	for (int i = 0; i<N; ++i)
	{
		if(S[i]=='I'){
		 	x++;
		 	if(max_x<x) max_x = x;
		}else{
		 	x--;
		}
	}
	printf("%d\n", max_x);
	return 0;
}

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

using namespace std;

template <typename T=int>
struct Rmq {
    vector<T> raw;
    static const int LOG = 18; // 20;
    int k;
    int n;
    vector<int> st[LOG];
    Rmq(vector<T> _v) { // pass in vec[0, n)
        raw = _v;
        n = raw.size();
        k = 32 - __builtin_clz(n);
        for (int j = 0; j < k; j++) {
            st[j].resize(n);
        }
        build();
    }
    inline int comp(int x, int y) { // DO! > max
        return raw[x] < raw[y] ? x : y;
    }
    void build() {
        for (int i = 0; i < n; i++) {
            st[0][i] = i;
        }
        for (int j = 1; j < k; j++) {
            for (int i = 0; i + (1<<j) <= n; i++) {
                st[j][i] = comp(st[j-1][i], st[j-1][i + (1<<(j-1))]);
            }
        }
    }
    // [l, r)
    inline int query_id(int l, int r) {
        assert(0 <= l && l < r && r <= n);
        int j = 31 - __builtin_clz(r - l);
        return comp(st[j][l], st[j][r - (1<<j)]);
    }
    inline T query(int l, int r) {
        return raw[query_id(l, r)];
    }
};

    vector<Rmq<>> R;

struct Node {
    int l, r;
    bool c;
    Node() {}
    Node(int _l, int _r, bool _c) : l(_l), r(_r), c(_c) {}
    inline int eval_id() {
        return R[c].query_id(l,r);
    }
    inline int eval() const{
        return R[c].query(l,r);
    }
    bool operator<(const Node& _oth) const {
        return eval() > _oth.eval();
    }
};

void solve() {
    int n; cin >> n;
    int m = n>>1;
    vector<vector<int>> a(2,vector<int> (m));
    for (int i = 0; i < m; i++) {
        cin >> a[0][i] >> a[1][i];
    }
    R.emplace_back(a[0]);
    R.emplace_back(a[1]);
    vector<pair<int, int>> res;

    //function<void(int,int,bool)> dfs = [&](int l, int r, bool x){
    //    if (l >= r) return; 
    //    int i = R[x].query_id(l, r);
    //    int j = R[x^1].query_id(i+x, r+x);
    //    res.emplace_back(a[x][i], a[x^1][j]);
    //    dfs(l, i, x);
    //    dfs(i+x, j, x^1);
    //    dfs(j+(x^1), r, x);
    //};
    //dfs(0, m, 0);
    //sort(res.begin(), res.end());

    priority_queue<Node> pq;
    pq.push({0, m, 0});
    while (!pq.empty()) {
        auto u = pq.top(); pq.pop();
        int l=u.l,r=u.r,c=u.c;
        int i = u.eval_id();
        int j = R[c^1].query_id(i+c, r+c);
        res.emplace_back(a[c][i], a[c^1][j]);
        if (l < i) pq.push({l,i,c});
        i += c;
        if (i < j) pq.push({i,j,c^1});
        j += c^1;
        if (j < r) pq.push({j, r, c});
    }

    for (auto& p: res) {
        cout << p.first << ' ' << p.second << ' ';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 18676
N=int(input())
if N==3:
    print(2,5,63)
else:
    ans=[2,4,3,9]
    count=4
    i=1
    while N-count>=2 and 4999>=i:
        ans.append(2*(3*i+1))
        ans.append(2*(3*i+2))
        count+=2
        i+=1
    i=1
    while N-count>=2 and 2499>=i:
        ans.append(3*(4*i+1))
        ans.append(3*(4*i+3))
        count+=2
        i+=1
    i=1
    while N-count>0:
        ans.append(6*i)
        count+=1
        i+=1
    print(*ans)

Measured memory_bytes: 42352
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int x;
	cin >> x;
	if(x < 4){
		cout << 1 << endl;
		return 0;
	}
	int ans = 0;
	repn(i, 2, 101){
		int j = i * i;
		int cnt = 1;
		while(j <= x) j *= i, cnt++;
		j /= i;
		if(cnt != 1) ans = max(ans, j);
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
const long long int mod=1e9+7;
typedef long long ll;
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
double reabs(double in){
    if(in<0){
        return (-1)*in;
    }else{
        return in;
    }
}

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

    int x[N],y[N];
    long long h[N];

    FOR(i,N){
        cin>>x[i]>>y[i]>>h[i];
    }
    int Cx,Cy;
    int H;
    bool ret=true;
    FOR(i,101){
        FOR(j,101){
            ret=true;
            Cx=i;
            Cy=j;
            H=-1;
            FOR(k,N){
                if(h[k]==0)continue;
                H=h[k]+abs(x[k]-Cx)+abs(y[k]-Cy);
                break;
            }
            //cout<<"("<<i<<","<<j<<")"<<endl;
            //cout<<"Try H="<<H<<endl;
            FOR(k,N){
                if(h[k]!=max(H-abs(x[k]-Cx)-abs(y[k]-Cy),0)){
                    ret=false;
                    //cout<<"H="<<H<<"Failed"<<endl;
                    break;
                }
            }
            if(ret){
                cout<<Cx<<" "<<Cy<<" "<<H<<endl;
                return 0;
            }
            
        }
    }
    
    
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> pop(N);
  for(int i = 1; i <= N; i++){
    cin >> pop.at(i-1);
  }
  int x = 1;
  int y = 0;
  while(!(x == 2)){
    x = pop.at(x-1);
    y++;
    if(y == N+1){break;}
  }
  if(y <= N)cout << y << endl;
  else cout << "-1" << endl;
}
  
  
  
  
 

Measured memory_bytes: 640
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    vi paint(3);
    rep(i,3)cin >> paint[i];
    int ans=3;
    rep(i,2)
    {
        if(paint[i]==paint[i+1])--ans;
    }
    if(paint[0]==paint[2])--ans;
    if(paint[0]==paint[1]&&paint[1]==paint[2])++ans;
    cout << ans << endl;
}


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

int main() {
  ll X;
  cin >> X;
  ll happy_500 = 0, happy_5 = 0;
  happy_500 = X / 500;
  X -= 500 * happy_500;
  happy_5 = X / 5;

  ll ans = 1000 * happy_500 + 5 * happy_5;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int main(){
    ll T1,T2,A1,A2,B1,B2;
    cin>>T1>>T2>>A1>>A2>>B1>>B2;
    ll S=T1*(A1-B1)+T2*(A2-B2);
    ll C=T1*(A1-B1);
    if(S==0) cout<<"infinity"<<endl;
    else if(S>0 && C>0) cout<<0<<endl;
    else if(S<0 && C<0) cout<<0<<endl;
    else{
        C=abs(C);
        S=abs(S);
        ll ans=C/S;
        ans*=2;
        if((C%S)>0) ans++;
        cout<<ans<<endl;
    }

}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline

N, K = map(int, input().split())
D = set(map(int, input().split()))

while True:
    tmp = set(str(N))
    b = True
    for x in tmp:
        if int(x) in D:
            b = False
            break 
    if b == True:
        break
    else:
        N += 1

print(N)

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define outt(x,y) cout<<(x)<<" "<<(y)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 200010
#define lim9 1000000010

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
    inn(a, b);
    inn(c, d);
    int tak = a / d;
    int aok = c / b;
    if (a % d) tak += 1;
    if (c % b) aok += 1;
    out(tak >= aok ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <functional>
#include <numeric>
#include "math.h"
using namespace std;

#define FOR(i,a,b) for (long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for (long long i=(b)-1;i>=(a);i--)
#define REP(i,n) for (long long i=0;i<(n);i++)
#define RREP(i,n) for (long long i=(n)-1;i>=0;i--)

#define inf long long_MAX/3
#define INF long long_MAX/3
#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define PII pair<long long,long long>
#define pii pair<long long,long long>
#define pcc pair<char,char>
#define pic pair<long long,char>
#define pci pair<char,long long>
#define VS vector<string>
#define VI vector<long long>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out prlong longf
#define LL long long
#define ll long long
#define ULL unsigned long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second


int n,a,b;
int main(){

	cin >> n >> a >> b;

	cout << min(n*a,b);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        Integer[] arrX = new Integer[n];
        Integer[] arrY = new Integer[m];
        Arrays.setAll(arrX, i -> Integer.parseInt(sc.next()));
        Arrays.setAll(arrY, i -> Integer.parseInt(sc.next()));
        sc.close();

        // 主処理
        int max = Arrays.stream(arrX).mapToInt(i -> i).max().getAsInt();
        int maxX = Math.max(max, x);

        int min = Arrays.stream(arrY).mapToInt(i -> i).min().getAsInt();
        int minY = Math.min(min, y);

        boolean judge = maxX < minY;
        String result = judge ? "No War" : "War";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 28244
#!/usr/bin/env python
import sys
sys.setrecursionlimit(10**9)
from collections import deque
import heapq
from itertools import combinations
import bisect

n=int(input())
l=[]
for i in range(n):
    l.append(list(input()))

p=0
q=0
for i in range(n):
    for j in l[i]:
        if j=='(':
            p+=1
        else:
            q+=1
if p!=q:
    print('No')
    exit()
pl=[]
ql=[]
ml=[]
for i in range(n):
    a=l[i]
    p=0
    q=0
    for j in a:
        if j=='(':
            p+=1
        else:
            q+=1
    if p>q:
        pl.append(a)
    elif p<q:
        ql.append(a)
    else:
        ml.append(a)
if pl:
    pp=[]
    for i in pl:
        d=0
        t=0
        for j in i:
            if j=='(':
                d+=1
            else:
                d-=1
            t=max(t,-d)
        pp.append([t,d])
    pp.sort(key=lambda x: x[0]*(10**6)-x[1])
    dd=0
    for a,b in pp:
        if dd<a:
            print('No')
            exit()
        dd+=b
if ml:
    pp=[]
    for i in ml:
        d=0
        t=0
        for j in i:
            if j=='(':
                d+=1
            else:
                d-=1
            t=max(t,-d)
        pp.append([t,d])
    pp.sort(key=lambda x: x[0]*(10**6)-x[1])
    #d=0
    if not pl:
        dd=0
    for a,b in pp:
        if dd<a:
            print('No')
            exit()
        dd+=b

if ql:
    pp=[]
    for i in ql:
        d=0
        t=0
        for j in range(len(i)):
            if i[len(i)-1-j]==')':
                d+=1
            else:
                d-=1
            t=max(t,-d)
        pp.append([t,d])
    pp.sort(key=lambda x: x[0]*(10**6)-x[1])
    dd=0
    for a,b in pp:
        if dd<a:
            print('No')
            exit()
        dd+=b

if ml:
    pp=[]
    for i in ml:
        d=0
        t=0
        for j in range(len(i)):
            if i[len(i)-1-j]==')':
                d+=1
            else:
                d-=1
            t=max(t,-d)
        pp.append([t,d])
    pp.sort(key=lambda x: x[0]*(10**6)-x[1])
    if not ql:
        dd=0
    for a,b in pp:
        if dd<a:
            print('No')
            exit()
        dd+=b

print('Yes')


Measured memory_bytes: 336020
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include<sstream>
using namespace std;

bool ans(int money) {
	if (money < 0) return false;
	else if (money == 0) return true;
	else return (ans(money - 7) || ans(money - 4));
}

int main() {
	int N;
	cin >> N;
	if (ans(N)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
# パナソニック2020D
from queue import deque
n = int(input())
q = deque([("a", "a")])
while True:
    s, m = q.pop()
    if len(s)==n:
        print(s)
    elif len(s)>=n+1:
        break
    for o in range(ord("a"), ord(m)+2):
        if ord(m)<o:
            m = chr(o)
        q.appendleft((s + chr(o), m))

Measured memory_bytes: 139736
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let mutable H = 0
let mutable W = 0

let d4 =
    [ (-1, 0)
      (0, -1)
      (0, 1)
      (1, 0) ]

let main() =
    let [| h; w |] = reada int
    H <- h
    W <- w
    let maze = Array2D.init H W (fun h w -> '#')
    for h in 0 .. H - 1 do
        let s = read string
        for w in 0 .. W - 1 do
            maze.[h, w] <- s.[w]
    let mutable ans = 0
    for sy in 0 .. H - 1 do
        for sx in 0 .. W - 1 do
            if maze.[sy, sx] = '#' then
                ()
            else
                let dist = Array2D.init H W (fun h w -> Int32.MaxValue)
                dist.[sy, sx] <- 0
                let mutable que = Queue<int * int>()
                que.Enqueue((sy, sx))
                while que.Count > 0 do
                    let y, x = que.Dequeue()
                    for (dy, dx) in d4 do
                        let ny, nx = y + dy, x + dx
                        if ny < 0 || H <= ny || nx < 0 || W <= nx then
                            ()
                        else if maze.[ny, nx] = '#' then
                            ()
                        else
                            let cost = dist.[y, x] + 1
                            if cost < dist.[ny, nx] then
                                dist.[ny, nx] <- cost
                                que.Enqueue((ny, nx))

                let mutable tmp = 0
                for y in 0 .. H - 1 do
                    for x in 0 .. W - 1 do
                        if maze.[y, x] = '.' then tmp <- max tmp dist.[y, x]
                // sprintf "sy: %d. sx: %d, tmp: %d" sy sx tmp |> puts
                ans <- max ans tmp

    puts ans
    ()

main()
writer.Close()


Measured memory_bytes: 15824
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define Pd (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll A,ll B) {if(!B)return A;return gcd(B,A%B);}
int main()
{
    ll a,v,b,w;
    cin>>a>>v>>b>>w;
    ll t;cin>>t;
    if(w>v)
    cout<<"NO"<<endl;
    else if(abs(a-b) > (v-w)*t) 
    {
        cout<<"NO"<<endl;
    }
    else cout<<"YES"<<endl;
 
    
    return 0;
}

Measured memory_bytes: 3632
# coding: utf-8
from collections import deque
n, quantum = [int(i) for i in input().split()]
dq = deque()
for i in range(n):
    p, time = [str(i) for i in input().split()]
    dq.append([p, int(time)])
time = 0
while(len(dq) != 0):
    #引き算処理
    #処理が終了しない場合
    if dq[0][1] > quantum:
        dq[0][1] -= quantum
        dq.rotate(-1)
        time += quantum
    #処理が終了する場合
    else:
        time += dq[0][1]
        print("{} {}".format(dq[0][0], time))
        dq.popleft()

Measured memory_bytes: 15928
#include<stdio.h>
int main(void)
   {int H[10000], W[10000], i, j, k, l;
    i = 0;
    while(1) {
       scanf("%d %d", &H[i], &W[i]);
       i++;
       if(H[i - 1] == 0 && W[i - 1] == 0)
          break;
    }
    for(j = 0; j < i - 1; j++) {
       for(l = 0; l < W[j] ; l++){
          printf("#");
       }
       printf("\n");
       for(k = 1; k < H[j] - 1; k++) {
          printf("#");
          for(l = 1; l < W[j] - 1; l++) {
             printf(".");
          }
          printf("#\n");
       }
       for(l = 0; l < W[j] ; l++){
          printf("#");
       }
       printf("\n\n");
    }
    return 0;
   }

Measured memory_bytes: 1748
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll power(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)

//your code here!
/*
int main(void){
    char S[110];
    ll K, ans=0;
    scanf("%s %lld", S, &K);
    ll N=strlen(S);
    if(N==1) {
        printf("%lld\n", K/2);
        return 0;
    }
    ll f=1, idx=0;
    while(f && S[++idx]!='\0') f &= (S[idx]==S[idx-1]);
    if(f){
        printf("%lld\n", N*K/2);
        return 0;
    }
    for(ll i=0; i<N-1; ) {
        if(S[i]==S[i+1]) {
            ll t=i, a=1;
            while(t<N-1 && S[t]==S[t+1]) {
            t++;
            a++;
            }
            i=t;
            ans += a/2;
        }
        else i++;
    }
    if(N>2 && S[0]==S[N-1]){
        ll l=1, r=1;
        while(l<N && S[l-1]==S[l]) l++;
        while(r<N && S[N-r-1]==S[N-r]) r++;
        if(l==r && l%2) {
            printf("%lld\n", ans*K + K-1);
            return 0;
        }
    }
    printf("%lld\n", ans*K);
    return 0;
}
*/

int main(void){
    char S[110];
    ll K;
    scanf("%s %lld", S, &K);
    ll is_allsame=1, i=0, N=strlen(S);
    while(is_allsame && ++i<N ) if(S[i-1]!=S[i]) is_allsame=0;
    if(is_allsame){
        printf("%lld\n", N*K/2);
        return 0;
    }
    ll ans=0, a[100], a_idx=0; i=0;
    while(i<N){
        char c = S[i];
        ll cnt = 1;
        while( i+1<N && S[1+i]==c ) {
            cnt++;
            i++;
        }
        a[a_idx++] = cnt;
        i++;
    }
    if(S[0]!=S[N-1]) {
        for(i=0; i<a_idx; i++) ans += a[i] / 2;
        printf("%lld\n", ans*K);
        return 0;
    }
    else {
        a[0] += a[a_idx-1];
        for(i=0; i+1<a_idx; i++) ans += a[i] / 2;
        ans *= K;
        a[0] -= a[a_idx-1];
        ans -= (a[0]+a[a_idx-1]) / 2;
        ans += a[0] / 2;
        ans += a[a_idx-1] / 2;
        printf("%lld\n", ans);
        return 0;
    }
}


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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

struct compareMap
{
    template<typename T>
    bool operator()(const T& element1, const T& element2) const
    {
        if (element1.second != element2.second)
            return element1.second < element2.second;

        return element1.first > element2.first;
    }
};

int main(void){
    
    int n;
    cin >> n;
    map<int, int> a;

    int temp;
    FOR(i, n){
        cin >> temp;
        a[i+1] =  temp;
    }

    set<pair<int, int>, compareMap> setOfWords(a.begin(), a.end());
    for(pair<int, int> element : setOfWords){
        cout << element.first << " ";
    }

    return 0;
}



Measured memory_bytes: 10240
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
	int n, y;
	cin >> n >> y;
	int k=0, l=0, m=0;
	int ans = 0;
	for (int k= 0; k <= n; k++){
		if (10000 * k > y) break;
		for (int l = 0; l <= n-k; l++) {
			int m = n - k - l;
			if (m>=0 && m<=n && y == 10000 * k + 5000 * l + 1000 * m) {
				ans++;
				cout << k <<" "<< l <<" "<< m << endl;
				goto label;
			}
		}
	}
	label:;
	if (ans == 0) cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {

	int A[4];

	for (int i = 1; i <= 3; i++) { cin >> A[i]; }

	int sum = 0;

	for (int i = 1; i <= 3; i++) {
		sum += A[i];
	}

	if (sum >= 22) { cout << "bust" << endl; }
	else {
		cout << "win" << endl;
	}
	return 0;
}

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

using namespace std;

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

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (a != i + 1) cnt++;
    }

    if (cnt == 0 or cnt == 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

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

int main() {
  int n;
  scanf("%d", &n);

  int a[10010];
  int sum = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		while (a[i] % 2 == 0) { a[i] /= 2; sum++; }
	}
	printf("%d\n", sum);
	return 0;
}

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

H = []
S = []
D = []
C = []

for x in range(1,13+1):
  H.append(x)
  S.append(x)
  D.append(x)
  C.append(x)

for x in range(n):
  a,b = input().split()
  if a == "H":
    H.remove(int(b))
  elif a == "S":
    S.remove(int(b))
  elif a == "D":
    D.remove(int(b))
  elif a == "C":
    C.remove(int(b))

for x in range(len(S)):
  print("S",S[x])
for x in range(len(H)):
  print("H",H[x])
for x in range(len(C)):
  print("C",C[x])
for x in range(len(D)):
  print("D",D[x])


Measured memory_bytes: 5612
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> P;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

vector<P>G[32];
int N;

int dfs1(int cur, int prev){
  int res = 0;
  rep(i,G[cur].size()){
    if(G[cur][i].first == prev) continue;
    res += dfs1(G[cur][i].first, cur)+G[cur][i].second;
  }

  if(res==0 && G[cur].size()== 1 && G[cur][0].first == prev) res -= G[cur][0].second;
  return res;
}

int dfs2(int cur, int prev){
  int res = 0;
  rep(i,G[cur].size()){
    if(G[cur][i].first == prev) continue;
    res = max(res, dfs2(G[cur][i].first, cur) + G[cur][i].second);
  }
  if(!res && G[cur].size()==1 && G[cur][0].first == prev) res -= G[cur][0].second;
  return res;
}

int main(){
  while(cin >> N, N){
    rep(i,32) G[i].clear();
    rep(i,N-1){
      int a, b, t;
      cin >> a >> b >> t; a--; b--;
      G[a].push_back(P(b,t)); G[b].push_back(P(a,t));
    }
    cout << 2*dfs1(0, -1) - dfs2(0, -1) << endl;
  }
  return 0;
}

Measured memory_bytes: 1196
/*
 * 2670.cc: Cram School Schedule
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int MAX_M = 100;

/* typedef */

typedef pair<int,int> pii;
typedef vector<pii> vpii;

/* global variables */

vpii cv, tvs[MAX_N], svs[MAX_M];

/* subroutines */

int hm2n(string &s) {
  int h = atoi(s.substr(0, 2).c_str());
  int m = atoi(s.substr(3, 5).c_str());
  return (h * 60 + m);
}

void read_times(vpii &v) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string ab;
    cin >> ab;
    string ai = ab.substr(0, 5), bi = ab.substr(6, 11);
    v.push_back(pii(hm2n(ai), hm2n(bi)));
  }
}

void print_vpii(vpii &v) {
  for (int i = 0; i < v.size(); i++)
    printf("(%d,%d)", v[i].first, v[i].second);
  putchar('\n');
}

bool cover(pii &c, vpii &v) {
  for (int i = 0; i < v.size(); i++)
    if (v[i].first <= c.first && c.second <= v[i].second) return true;
  return false;
}

/* main */

int main() {
  read_times(cv);
  //print_vpii(cv);

  int n;
  cin >> n;
  for (int i = 0; i < n; i++) read_times(tvs[i]);
  
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) read_times(svs[i]);

  int sum = 0;
  for (int i = 0; i < cv.size(); i++) {
    int tn = 0, sn = 0;

    for (int j = 0; j < n; j++)
      if (cover(cv[i], tvs[j])) tn++;
    for (int j = 0; j < m; j++)
      if (cover(cv[i], svs[j])) sn++;
    //printf("tn=%d, sn=%d\n", tn, sn);

    sum += min(tn, sn);
  }

  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 1420
#include <stdio.h>

int main()
{
	int n,dp[51][4];

	for(int i = 0; i < 51; i++){
		if(i < 10)
			dp[i][0] = 1;
		else
			dp[i][0] = 0;
		dp[i][1] = 0;
		dp[i][2] = 0;
		dp[i][3] = 0;
	}
	for(int i = 0; i < 3; i++){
		for(int j = 0; j <= 50; j++){
			for(int c = 0; c < 10; c++){
				if(j+c <= 50)
					dp[j+c][i+1] += dp[j][i];
			}
		}
	}

	while(scanf("%d",&n) != EOF){
		printf("%d\n",dp[n][3]);
	}

	return 0;
}

Measured memory_bytes: 1024
S = list(input())

M = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]

if "".join(S[0:2]) in M and not("".join(S[2:]) in M):
    print("MMYY")
elif not("".join(S[0:2]) in M) and "".join(S[2:]) in M:
    print("YYMM")
elif "".join(S[0:2]) in M and "".join(S[2:]) in M:
    print("AMBIGUOUS")
else:
    print("NA")

Measured memory_bytes: 3064
n = int(input())
x = [list(input().split()) for i in range(n)]
j = 0
b = 0
for i in range(len(x)):
    if x[i][1]=='JPY':
        j+=int(x[i][0])
    else:
        b+=float(x[i][0])
print(j+b*380000)

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;

const int MAX_N = 10001;

int N;
char S[MAX_N];

int divide(int a) {
	int res = 0;
	while (a % 2 == 0) {
		res++;
		a /= 2;
	}
	return res;
}

int main() {
	int N;
	int a[10001];
	int sum=0;
	
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];

	for (int i = 0; i < N; i++) {
		sum += divide(a[i]);
	}

	cout << sum << endl;


}

Measured memory_bytes: 256