akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <stack>
#include <set>
#include <vector>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INF = 1 << 29;
const double EPS = 1e-10;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
    return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
    os<<'[';
    rep(i,a.size()) os<<(i?" ":"")<<a[i];
    return os<<']';
}

typedef pair<int, pii> State;

int H, W, N;
char m[1010][1010];

vi bfs(int x, int y) {
	vi res(N + 1, 0);
	
	queue<pair<int, pii> > q;
	q.push(mp(0, mp(x, y)));
	map<pii, bool> visited;
	
	while(!q.empty()) {
		pair<int, pii> p = q.front();
		q.pop();
		if (visited[p.snd]) continue;
		visited[p.snd] = true;
		
		if (isdigit(m[p.snd.snd][p.snd.fst])) {
			res[m[p.snd.snd][p.snd.fst] - '0'] = p.fst;
		}
		if (m[p.snd.snd][p.snd.fst] == 'S') {
			res[0] = p.fst;
		}
		
		static const int dx[] = {1, 0, -1, 0};
		static const int dy[] = {0, 1, 0, -1};
		rep(d, 4) {
			int tx = p.snd.fst + dx[d];
			int ty = p.snd.snd + dy[d];
			if (tx < 0 || tx >= W || ty < 0 || ty >= H) continue;
			if (m[ty][tx] == 'X') continue;
			q.push(mp(p.fst + 1, mp(tx, ty)));
		}
	}
	
	return res;
}

int main() {
	cin >> H >> W >> N;
	pii start;
	rep(i, H) rep(j, W) {
		cin >> m[i][j];
		if (m[i][j] == 'S') {
			start.fst = j;
			start.snd = i;
		}
	}
	
	vvi mt(N + 1);
	rep(i, H) rep(j, W) {
		if (isdigit(m[i][j])) mt[m[i][j] - '0'] = bfs(j, i);
		else if (m[i][j] == 'S') mt[0] = bfs(j, i);
	}
	
	priority_queue<State, vector<State>, greater<State> > q;
	q.push(mp(0, mp(0, 0)));
	map<pii, bool> visited;
	
	while(!q.empty()) {
		State st = q.top();
		q.pop();
		if (visited[st.snd]) continue;
		visited[st.snd] = true;
		
		int pos = st.snd.snd;
		int ate = st.snd.fst;
		if (__builtin_popcount(ate) == N) {
			cout << st.fst << endl;
			break;
		}
		int hp = 1 + __builtin_popcount(ate);
		rep(i, N) if ((ate & 1 << i + 1) == 0) if (hp >= i + 1) {
			q.push(mp(st.fst + mt[pos][i + 1], mp(ate | 1 << i + 1, i + 1)));
		}
	}
    
    return 0;
}

Measured memory_bytes: 30268
#include<stdio.h>
int main(){
	int H,W;
	int map[51][51];
	int i,j;
	scanf("%d %d",&H,&W);
	getchar();
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			map[i][j]=getchar();
			map[i][j]-='0';
		}
		getchar();
	}
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(i==0){
				if(j!=0){
					map[i][j]+=map[i][j-1];
				}
			}else{
				if(j==0){
					map[i][j]+=map[i-1][j];
				}else{
					map[i][j]+=(map[i][j-1]<map[i-1][j])?map[i][j-1]:map[i-1][j];
				}
			}
		}
	}
	printf("%d\n",map[H-1][W-1]);
	return 0;
}

Measured memory_bytes: 608
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int K;
    in(K);

    ll tmp = 0;
    rep(i, 10000000)
    {
        tmp *= 10;
        tmp += 7;
        tmp %= K;

        if (tmp == 0)
        {
            outl(i + 1);
            return 0;
        }
    }

    outl(-1);
    return 0;
}

Measured memory_bytes: 3636
import math

n, d = input().split()
n = int(n)
d = int(d)

cnt = 0
for i in range(n):
    xy = [int(x) for x in input().split()]
    
    if math.sqrt(xy[0]**2 + xy[1]**2) <= d:
        cnt += 1

print(cnt)

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

class union_find {
private:
    vector<int> parent, rank, gs;
    int size;

public:
    int count_group;
    union_find() = default;
    union_find(int n) { init(n); }

    void init(int n) {
        size = n;
        count_group = n;
        parent.resize(size);
        rank.assign(size, 0);
        gs.assign(size, 1);
        for (int i = 0; i < size; ++i) parent[i] = i;
    }

    int find(int x) {
        if (parent[x] == x)
            return x;
        else
            return parent[x] = find(parent[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            parent[x] = y;
            gs[y] += gs[x];
        } else {
            parent[y] = x;
            gs[x] += gs[y];
            if (rank[x] == rank[y]) ++rank[x];
        }
        --count_group;
    }

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

    int group_size(int x) {
        return gs[find(x)];
    };
};

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N,M;
    cin >> N >> M;

    union_find uf(N);
    vector<vector<i64>> diff(N);
    rep(i,0,M){
        i64 X,Y,Z;
        cin >> X >> Y >> Z;
        --X;
        --Y;
        Z%=2;
        if(Z==1){
            uf.unite(X,Y);
        }else{
            uf.unite(X,Y);
        }
    }

    cout << uf.count_group << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 3840
def main():
    S = input()
    T = input()
    d = dict()
    flg = True
    for s, t in zip(S, T):
        # 同アルファベット、違アルファベット変換チェック
        if s in d and d[s] != t:
            flg = False
            break
        d[s] = t
    # 変換先の重複チェック
    if len(d.values()) != len(set(d.values())):
        flg = False
    print("Yes" if flg else "No")
    return


main()


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

vector<ll> build_z(const string& s) {
  ll n = s.size();
  vector<ll> z(n, 0);
  ll l = -1, r = -1;
  for (ll i = 1; i < n; ++i) {
    if (i <= r) {
      z[i] = min<ll>(r - i + 1, z[i - l]);
    }
    while (i + z[i] < n && s[i + z[i]] == s[z[i]]) {
      ++z[i];
    }
    if (i + z[i] - 1 > r) {
      r = i + z[i] - 1;
      l = i;
    }
  }
  return z;
}

void search(const string& text, const string& pattern, vector<ll>& result) {
  vector<ll> z = build_z(pattern + "$" + text);

  ll p = pattern.length();
  for (ll i = p + 1; i < z.size(); ++i) {
    if (z[i] == p) {
      result.push_back(i-p-1);
    }
  }
}

// int main(int argc, char** argv) {
//   string s, t;
//   cin >> s;
//   cin >> t;
//
//   vector<int> matches;
//   search(s, t, matches);
//
//   for (auto e : matches) {
//     cout << e << endl;
//   }
//
//   cout << s << endl;
//   cout << t << endl;
// }

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  string t, p;
  cin >> t;
  cin >> p;
  ll n = t.size();
  ll m = p.size();

  vector<ll> matches;
  search(t, p, matches);
  for (ll v : matches) {
    cout << v << endl;
  }
}



Measured memory_bytes: 20904
n=int(input())
ns=list(map(int,input().split()))
ans=0
for i in range(n):
    minj=i
    for j in range(i,n):
        if(ns[j]<ns[minj]):
            minj=j

    if i!=minj:
        ans+=1
        k=ns[i]
        ns[i]=ns[minj]
        ns[minj]=k

for i in range(n):
    if(i!=n-1):
        print(ns[i],end=' ')
print(ns[n-1])
print(ans)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
数値型から文字列に変換　to_string(number);これは簡単
文字列から数値型に変換　stoi(number)
文字列からllに変換　stoll(number)*/

//ここから書き始める

int main()
{
    ll S;cin>>S;
    ll x = ceil(sqrt(S));
    ll a = x;
    ll d = x;
    ll b = 1;
    ll c = x * x - S;
    cout<<0<<" "<<0<<" "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	ll N=in(),M=in(),L=in();
	vector<vector<ll>> A(N,vector<ll>(M)),B(M,vector<ll>(L)),C(N,vector<ll>(L,0));
	REP(i,N){
		REP(j,M){
			A[i][j] = in();
		}
	}
	REP(i,M){
		REP(j,L){
			B[i][j] = in();
		}
	}
	REP(i,N){
		REP(j,L){
			REP(k,M){
				C[i][j] += A[i][k]*B[k][j];
			}
		}
	}
	REP(i,N){
		REP(j,L-1){
			cout << C[i][j] << ' ';
		}
		out(C[i][L-1]);
	}

	return 0;
}



Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

using PLL = pair<long long, long long>;
using VPLL = vector <PLL>;

bool cmp1(const PLL& a, const PLL& b) {
    return (a.first + a.second) < (b.first + b.second);
}

bool cmp2(const PLL& a, const PLL& b) {
    return (a.first - a.second) < (b.first - b.second);
}


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

    VPLL pnts(N);
    for (int i = 0; i < N; ++i) {
        cin >> pnts[i].first >> pnts[i].second;
    }

    long long ans = 0;

    // case 1 abs((xi+yi) - (xj+yj))
    sort(pnts.begin(), pnts.end(), cmp1);

    for (int i = 0; i < pnts.size(); ++i) {
        if (i != 0) {
            ans = max(ans, abs(pnts[i].first- pnts[0].first) + abs(pnts[i].second- pnts[0].second));
        }

        if (i != pnts.size()-1) {
            ans = max(ans, abs(pnts[i].first- pnts.back().first) + abs(pnts[i].second- pnts.back().second));
        }
    }

    // case 2 abs((xi-yi) - (xj-yj))
    sort(pnts.begin(), pnts.end(), cmp2);

    for (int i = 0; i < pnts.size(); ++i) {
        if (i != 0) {
            ans = max(ans, abs(pnts[i].first- pnts[0].first) + abs(pnts[i].second- pnts[0].second));
        }

        if (i != pnts.size()-1) {
            ans = max(ans, abs(pnts[i].first- pnts.back().first) + abs(pnts[i].second- pnts.back().second));
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6404
#include<bits/stdc++.h>
using namespace std;
string solve(string s){
	if(s.size()<26){
		for(char c='a';c<='z';c++){
			if(s.find(c)==string::npos){
				s+=c;
				return s;
			}
		} 
	}
	char t[26];
	for(int i=0;i<s.size();i++)t[i]=s[i]; 
	if(s=="zyxwvutsrqponmlkjihgfedcba")return "-1";
	next_permutation(t,t+s.size());
	string cnt="";
	for(int i=0;i<s.size();i++){
		cnt+=t[i];
		if(s[i]!=t[i])break;
	}
	return cnt;
}
int main(){
	string s;
	cin>>s;
	cout<<solve(s)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll c;
    cin >> n >> c;
    VL x(n), v(n);
    REP(i, n) cin >> x[i] >> v[i];
    VL xx(n);
    REP(i, n) xx[i] = c - x[n - i - 1];
    VL intake_clock(n);
    intake_clock[0] = v[0];
    FOR(i, 1, n - 1) intake_clock[i] = v[i] + intake_clock[i - 1];
    VL intake_unclock(n);
    intake_unclock[0] = v[n - 1];
    FOR(i, 1, n - 1) intake_unclock[i] = v[n - i - 1] + intake_unclock[i - 1];
    
    ll only_clock = intake_clock[0] - x[0];
    VL opt_clock(n);
    REP(i, n) {
        only_clock = max(only_clock, intake_clock[i] - x[i]);
        opt_clock[i] = only_clock;
    }
    ll only_unclock = intake_unclock[0] - xx[0];
    VL opt_unclock(n);
    REP(i, n) {
        only_unclock = max(only_unclock, intake_unclock[i] - xx[i]);
        opt_unclock[i] = only_unclock;
    }
    ll fold = 0;
    FOR(i, 0, n - 2) {
        fold = max(fold, opt_clock[i] - x[i] + opt_unclock[n - i - 2]);
        fold = max(fold, opt_unclock[i] - xx[i] + opt_clock[n - i - 2]);
    }

    fold = max(fold, only_clock);
    fold = max(fold, only_unclock);
    cout << fold << endl;
    
    return 0;
}


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

int n;
int dp[5005][4];
int p[5005];

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

  fill(dp[0], dp[5005], 1 << 29);
  cin >> n; rep(i, n) cin >> p[i];
  rep(j, 4) dp[0][j] = j;
  rep(i, n) rep(j, 4) rep(k, 4) if (j + k >= p[i]) {
    dp[i+1][k] = min(dp[i+1][k], dp[i][j] + k*2);
  }
  int res = 1 << 29;
  rep(k, 4) res = min(res, dp[n][k] - k);
  cout << res << "\n";
}


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

int main() {
    int n;
    cin>>n;
    if(n>= 400 && n <= 599) {cout<<"8"<<endl;}
    else if(n>= 600 && n <= 799) {cout<<"7"<<endl;}
    else if(n>= 800 && n <= 999) {cout<<"6"<<endl;}
    else if(n>= 1000 && n <= 1199) {cout<<"5"<<endl;}
    else if(n>= 1200 && n <= 1399) {cout<<"4"<<endl;}
    else if(n>= 1400 && n <= 1599) {cout<<"3"<<endl;}
    else if(n>= 1600 && n <= 1799) {cout<<"2"<<endl;}
    else if(n>= 1800 && n <= 1999) {cout<<"1"<<endl;}
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ri register int
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> poly;
#define pb push_back
#define fi first
#define se second
const int rlen=1<<18|1;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read() {
  int ans=0;
  char ch=gc();
  while(!isdigit(ch)) ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return ans;
}
char c3[3][3]={
  {'.','.','a'},
  {'.','.','a'},
  {'a','a','.'}
};
char c4[4][4]={
  {'a','b','e','e'},
  {'a','b','f','f'},
  {'c','c','g','h'},
  {'d','d','g','h'}
};
char c5[5][5]={
  {'a','a','b','b','a'},
  {'b','c','c','.','a'},
  {'b','.','.','c','b'},
  {'a','.','.','c','b'},
  {'a','b','b','a','a'}
};
char c7[7][7]={
  {'a','.','a','a','.','a','a'},
  {'a','b','.','.','b','b','.'},
  {'.','b','.','a','a','.','a'},
  {'a','.','a','.','.','.','a'},
  {'a','.','a','.','.','b','.'},
  {'.','b','b','.','.','b','a'},
  {'a','a','.','a','a','.','a'}
};
int n;
char ans[1005][1005];
int main() {
  #ifdef ldxcaicai
  freopen("lx.in","r",stdin);
  #endif
  cin>>n;
  if(n<3) puts("-1");
  else {
    for(ri i=1;i<=n;++i) for(ri j=1;j<=n;++j) ans[i][j]='.';
    if(n%3==0) {
      for(ri i=1;i<=n;i+=3) for(ri dx=0;dx<3;++dx)
      for(ri dy=0;dy<3;++dy)ans[i+dx][i+dy]=c3[dx][dy];
    }
    else {
      int x=-1,y=-1,z=-1;
      for(ri i=0;i*4<=n&&x==-1;++i) for(ri j=0;i*4+j*5<=n;++j) if((n-i*4-j*5)%7==0) {
        x=i,y=j,z=(n-i*4-j*5)/7;
        break;
      }
      int ps=1;
      while(x--) {
        for(ri dx=0;dx<4;++dx) for(ri dy=0;dy<4;++dy) ans[ps+dx][ps+dy]=c4[dx][dy];
        ps+=4;
      }
      while(y--) {
        for(ri dx=0;dx<5;++dx) for(ri dy=0;dy<5;++dy) ans[ps+dx][ps+dy]=c5[dx][dy];
        ps+=5;
      }
      while(z--) {
        for(ri dx=0;dx<7;++dx) for(ri dy=0;dy<7;++dy) ans[ps+dx][ps+dy]=c7[dx][dy];
        ps+=7;
      }
    }
    for(ri i=1;i<=n;++i,puts("")) for(ri j=1;j<=n;++j) cout<<ans[i][j];
  }
  return 0;
}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		long sum=0;
		for(int i=0;i<n;i++) {
			for(int j=i+1;j<n;j++) {
				sum+=arr[i]*arr[j];
			}
		}
		System.out.println(sum);
	}

}


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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  
  ll ans = 1;
  for (ll i = 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 256
// https://onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/2/ITP2_2_B

#include <iostream>
#include <vector>
#include <queue>

int main()
{
    int n, q;
    std::cin >> n >> q;
    std::vector<std::queue<int>> qu(n);

    int m, t, x;
    for (int i = 0; i < q; i++)
    {
        std::cin >> m >> t;
        if (m == 0)
        {
            std::cin >> x;
            qu[t].push(x);
        }
        else if (m == 1)
        {
            if (qu[t].size() > 0)
            {
                std::cout << qu[t].front() << std::endl;
            }
        }
        else if (m == 2)
        {
            if (qu[t].size() > 0)
            {
                qu[t].pop();
            }
        }
    }
}


Measured memory_bytes: 4448
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n, i, j;
	char a[2][3];
	while(scanf("%d", &n)!=EOF)
	{
		for(i=1; i<=2; i++)
		{
			for(j=1; j<=3; j++)
			{
				scanf(" %c", &a[i][j]);
			}
		}
		if(a[1][1] == a[2][3] && a[1][2] == a[2][2] && a[1][3] == a[2][1])
			printf("YES");
	    else
	    	printf("NO");
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int a,b;
  rep(i,7){
    cin>>a>>b;
    cout<<a-b<<endl;
  }
}

Measured memory_bytes: 3076
/*
 * ABC091_A.cpp
 *
 *  Created on: May 21, 2018
 *      Author: 13743
 */
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	int A, B, C;
	cin >> A >> B >> C;
	if(A+B < C) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}






Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
    int n = scan!int;
    int x = scan!int - 1, y = scan!int - 1;

    int[] ans = new int[](n);
    foreach(i; 0 .. n) foreach(j; 0 .. i){
        int d = min(abs(i - j), abs(i - y) + abs(j - x) + 1, abs(i - x) + abs(j - y) + 1);
        ans[d] += 1;
    }

    foreach(an; ans[1 .. $]) an.print;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,m,q;
    cin>>n>>m>>q;
    vector<ll> t,s;
    t.push_back(-longinf);
    s.push_back(-longinf);
    rep(i,n){
        ll x;
        cin>>x;
        t.push_back(x);
    }
    rep(i,m){
        ll x;
        cin>>x;
        s.push_back(x);
    }
    t.push_back(longinf);
    s.push_back(longinf);
    while(q--){
        ll cur;
        cin>>cur;
        auto itr=lower_bound(t.begin(),t.end(),cur);
        ll lt=*prev(itr),rt=*itr;
        itr=lower_bound(s.begin(),s.end(),cur);
        ll ls=*prev(itr),rs=*itr;
        ll ans=min(max(rt,rs)-cur,cur-min(ls,lt));
        ans=min(ans,rt-ls+min(rt-cur,cur-ls));
        ans=min(ans,rs-lt+min(rs-cur,cur-lt));
        cout<<ans<<endl;
    }
    return 0;

}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
bool you[105];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		int d;
		cin>>d;
		for(int j=0;j<d;j++)
		{
			int a;
			cin>>a;
			you[a]=true;
		}
	}
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(you[i]==false)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n,k,D[100005],S[100005],a[100005],mod=1e9+7;
main () {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin>>n>>k;
	for (int i=1; i<=n; i++) 
		cin>>a[i];
	
	for (int i=1; i<=n; i++) {
		D[k]=1,S[k]=S[k-1]+D[k];
		for (int j=0; j<k; j++) {
			int L=j,R=min(j+a[i],k);
			if (!L) D[j]=(D[j]+S[R])%mod;
				else D[j]=(D[j]+S[R]-S[L-1]+mod)%mod;
		}
		for (int j=0; j<k; j++) {
			if (!j) S[j]=D[j];
				else S[j]=(S[j-1]+D[j])%mod;
			D[j]=0;
		}
	}
	cout<<S[0]<<endl;
}

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

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

int main(void)
{
  int n;
  scanf("%d", &n);
  int d[n];
  int i = 0;
  while (i < n)
  {
    scanf("%d", &d[i]);
    i++;
  }
  
  qsort(d, n, sizeof(int), compare_int);
  
  if (d[n / 2 - 1] == d[n / 2])
  {
    printf("0");
    return 0;
  }
  
  int cnt = 0;
  i = d[n / 2 - 1] + 1;
  while (i <= d[n / 2])
  {
    cnt++;
    i++;
  }
  printf("%d", cnt);
  return 0;
}


Measured memory_bytes: 892
gets
nums = gets.split(" ").map(&:to_i)
bunbos = []
nums.each do |ele|
  bunbos << Rational(1,ele)  
end
bunbo = bunbos.inject(:+)
bs = Rational(1,bunbo)
num = bs.numerator.to_f / bs.denominator.to_f

puts num


Measured memory_bytes: 1788
import java.util.*;
import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String n_ = String.valueOf(n);
        String[] str = n_.split("");
        int l = str.length;
        int m = 0;
        for(int i=0;i<l;i++){
            if(Integer.parseInt(str[i])==1) m += 9*(Math.pow(10,l-i-1));
            else if(Integer.parseInt(str[i])==9) m += Math.pow(10,l-i-1);
        }
        System.out.println(m);
    }
}

Measured memory_bytes: 22612
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
infants = []
for i in range(n):
    infants.append((a[i],i))
infants.sort()
dp = [defaultdict(int) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    score,initial = infants.pop()
    for right in dp[i].keys():
        dp[i+1][right] = max(dp[i][right]+abs(initial-(i-right))*score,dp[i+1][right])
        dp[i+1][right+1] = max(dp[i][right]+abs((n-1-right)-initial)*score,dp[i+1][right+1])
print(max(dp[n].values()))

Measured memory_bytes: 150024
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    ll x,co=0;
    std::cin >> x;
    for (int i = 1; ; i++) {
        /* code */
        co+=i;
        //std::cout << c << std::endl;
        if(co==x)std::cout << i << std::endl;
        else if(co>x)std::cout << i << std::endl;
        else continue;
        exit(0);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define fi              first
#define se              second
#define ll             long long
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll              vector<int>
#define mll             map<ll,ll>
#define pqg             priority_queue<ll>
#define pqs             priority_queue<ll,vll,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define md             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
 
#define IJ \
    freopen("input.txt", "r", stdin); 
#define OJ \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
int main()
{
    //IJ; OJ; 
    FIO;
    int a,a1;
    cin>>a;
  string s;
  cin>>s;
  int t1=s.length();
  if(t1>a)
  {  cout<<s.substr(0,a)<<"...";}
  else{
    cout<<s;
  }
    return 0;
} 


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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;

char s[1000000];
int N;

int main() {

	cin>>s;
	N=strlen(s);
	int ans=0;
	int a0,a1,a2,a3;

	for(a0=0; a0<N; a0=a3){
		for(a1=a0; s[a1]=='J'; a1++);
		for(a2=a1; s[a2]=='O'; a2++);
		for(a3=a2; s[a3]=='I'; a3++);
		if(a1-a0>=a2-a1 && a2-a1<=a3-a2){
			if(ans<a2-a1){
				ans=a2-a1;
			}
		}
	}






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

Measured memory_bytes: 4040
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(i<10&&i>0)cnt++;
		if(i<1000&&i>99)cnt++;
		if(i<100000&&i>9999)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
 } 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();

        int ans = dfs("", n);
        System.out.println(ans);
    }

    // n以下の、strで始まる753数の数を返す
    static int dfs(String str, int n) {
        if (!str.equals("") && Long.parseLong(str) > n) {
            return 0;
        }
        int ret = 0;
        if (str.contains("7") && str.contains("5") && str.contains("3")) {
            ret++;
        }
        ret += dfs(str + "7", n);
        ret += dfs(str + "5", n);
        ret += dfs(str + "3", n);
        return ret;
    }

}


Measured memory_bytes: 37076
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	while (1){
		int temp = 1;
		int a= 1, x = 2, z = 3, b = 4, w = 5, y = 6;
		string p;
		cin >> p;
		if (p == "#") break;
		for (int i = 0; i < p.size(); i++){
			switch (temp){
				case 1 : 
					if (p[i] == '0') temp = x;
					else temp = y;
					break;
				case 2 :
					if (p[i] == '1') temp = z;
					else temp = 7;
					break;
				case 3 :
					if (p[i] == '0') temp = w;
					else temp = b;
					break;
				case 4 :
					if (p[i] == '0') temp = y;
					else temp = x;
					break;
				case 5 :
					if (p[i] == '0') temp = b;
					else temp = y;
					break;
				case 6 :
					if (p[i] == '0') temp = x;
					else temp = 7;
					break;
				default : i = p.size();
					break;
			}
		}
		if (temp == b)
			printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3120
#include<iostream>
int main(){
  int a,b,c;
  std::cin >> a >> b >> c;
  if (a < b) {
    if (b < c) {
      std::cout << a << " " << b  << " "<< c << std::endl;
    }
    else if (a < c) {
      std::cout << a << " " << c << " "<< b << std::endl;
    }
    else{
      std::cout << c << " "<< a << " " << b << std::endl;
    }
  }
  else if (a < c) {
    std::cout << b << " " << a << " " << c << std::endl;
  }
  else if (b < c){
    std::cout << b << " " << c << " " << a << std::endl;
  }
  else {
    std::cout << c << " " << b << " " << a << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3020
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){

	int a,b,c;
	cin>>a>>b>>c;
	for(int i=0;i<10;i++){
		c=c*a-b;
		cout<<c<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

int main()
{
    string s;cin >> s;

    for(int i=0;i<s.size();i+=2){
        cout << s.substr(i,1);
    }
    cout << endl;

}

Measured memory_bytes: 512
#include<iostream>
#include<utility>
#include<string>
#include<cmath>
typedef long long LL;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	pair<LL,LL> a[55], b[55];
	for (int i = 0; i < n; i++) {
		LL c, d;
		cin >> c >> d;
		a[i] = pair<LL,LL>(c, d);
	}
	for (int i = 0; i < m; i++) {
		LL c, d;
		cin >> c >> d;
		b[i] = pair<LL,LL>(c, d);
	}

	for (int i = 0; i < n; i++) {
		LL dis = 100000000000000000;
		int num = 0;
		for (int j = 0; j < m; j++) {
			LL now = abs(a[i].first - b[j].first) + abs(a[i].second - b[j].second);
			if (dis > now) {
				dis = now;
				num = j;
			}
		}
		cout << num+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

vector<pair<long long, int>> factor(long long x) {
    vector<pair<long long, int>> res;
    for (long long i = 2; i*i <= x; ++i) {
        if (x % i) continue;
        res.emplace_back(i, 0);
        while (x % i == 0) {
            x /= i;
            res.back().second++;
        }
    }
    if (x != 1) res.emplace_back(x, 1);
    return res;
}

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

    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n; ++i) {
        auto f = factor(i);
        for (auto p : f) {
            mp[p.fi] += p.se;
        }
    }
    vll cnt(150);
    for (auto p : mp) cnt[p.se]++;
    for (int i = 149; i >= 1; --i) cnt[i-1] += cnt[i];
    ll ans = 0;
    ans += cnt[74];
    ans += cnt[24] * (cnt[2] - 1);
    ans += cnt[14] * (cnt[4] - 1);
    ans += cnt[4] * (cnt[4] - 1) / 2 * (cnt[2] - 2);
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;

class Program
{
  private static int getElemNum(char ch)
  {
    switch (ch)
    {
      case 'S': return 0;
      case 'H': return 1;
      case 'C': return 2;
      case 'D': return 3;
    }
    return -1;
  }
  static void Main()
  {
    int i, j, row, col;
    char[] suits = { 'S', 'H', 'C', 'D' };
    string[] data;


    bool[,] cards = new bool[4, 13];
    for (i = 0; i < 4; i++)
      for (j = 0; j < 13; j++)
        cards[i, j] = false;


    int n = int.Parse(Console.ReadLine());

    for (i = 0; i < n; i++)
    {
      data = Console.ReadLine().Split(' ');
      row = getElemNum(data[0][0]);
      col = int.Parse(data[1]) - 1;
      cards[row, col] = true;
    }

    for (i = 0; i < 4; i++)
      for (j = 0; j < 13; j++)
        if (!cards[i, j]) Console.WriteLine("{0} {1}", suits[i], j + 1);
  }
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll W, H, x, y;
    double Centerx, Centery;
    double ans0;
    int ans1;
    scanf("%lld %lld %lld %lld", &W, &H, &x, &y);

    Centerx = (double) W / 2.0;
    Centery = (double) H / 2.0;
    ans0 = W * H / 2.0;
    if ( x == Centerx && y == Centery){
        ans1 = 1;
    }
    else{
        ans1 = 0;
    }
    printf("%lf %lld\n", ans0, ans1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int h,w; cin >> h >> w;
	char c[h][w];
	rep(i,h)rep(j,w) cin >> c[i][j];
	rep(i,h) {
		rep(j,w) {
			cout << c[i][j];
		}
		cout << endl;
		rep(j,w) {
			cout << c[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll > 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define pi pair<int, int>
#define ppi pair<pair<int, int>, int>
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
#define s(v) v.size()
#define e(v) v.empty()

using namespace std;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);}
// bool sortbysec(const pll &a, const pll &b){return (a.second < b.second);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("../input.txt", "r", stdin);
    //     freopen("../output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
        ll n, k;
        cin>>n>>k;
        vl vec(n);
        rep(i, n)   cin>>vec[i];
        sort(vec.begin(), vec.end());
        vl fact(n+1);
        // rep(i, n)   cout<<vec[i];
        fact[0] = 1;
        rep1(i, n+1) fact[i] = (i*fact[i-1])%MOD;
        ll minsum = 0;
        ll con = inverse(fact[k-1], MOD);
        rep(i, n-k+1){
            minsum += -vec[i]*(((fact[n-1-i]*con)%MOD)*inverse(fact[n-k-i], MOD) %MOD) %MOD;
        }
        ll maxsum = 0;
        foi(i, k-1, n){
            maxsum+= vec[i]*((((fact[i]*con)%MOD)*inverse(fact[i-k+1], MOD)%MOD)) %MOD;
        }
        // cout<<minsum<<" "<<maxsum;
        ll ans = minsum+maxsum;
        ans%=MOD;
        ans += MOD;
        ans %=MOD;
        cout<<ans;
    }
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<stdbool.h>

void dice_change_east(int d2[6])
{
  int t = d2[2];
  d2[2] = d2[0];
  d2[0] = d2[3];
  d2[3] = d2[5];
  d2[5] = t;

}


void dice_change_south(int d2[6])
{
  int t = d2[1];
  d2[1] = d2[0];
  d2[0] = d2[4];
  d2[4] = d2[5];
  d2[5] = t;

}

void dice_change_rotate(int d2[6])
{
  int t = d2[3];
  d2[3] = d2[1];
  d2[1] = d2[2];
  d2[2] = d2[4];
  d2[4] = t;
}
bool compare(int d[6],int d2[6])
{
  int f,s;
  int i;

  f = d[0];
  s = d[1];

  for(i = 0;i < 4; i++)
    {
      if(d2[1] == s)
	break;

      dice_change_south(d2);
    }

  if(d2[1] != s)
    {
      for(i = 0;i < 4;i++)
	{
	  if(d2[1] == s)
	    break;

	  dice_change_rotate(d2);
	}
    }

  /*if(d->men[1] != v)
    return hantei;*/
  if (d2[1] != s)
    return false;

  for (i = 0;i < 4;i++)
    {
      if (d2[0] == f)
	break;

      dice_change_east(d2);
    }

  for (i = 0;i < 6;i++)
    {
      if (d[i] != d2[i])
	break;
    }

  /*if (i == 6){
    hantei = 1;
    return hantei;
  }
  else
    return hantei;*/

  //if((d[0] == d2[0]) && (d[1] == d2[1]) && (d[2] == d2[2]) && (d[3] == d2[3]) && (d[4] == d2[4]) && (d[5] == d2[5]))
	  // hantei = 1;
  if(i == 6)
	  return true;
      else
	  return false;
	//return hantei;
}


bool solve(int dice[2][6])
{
  if(compare(dice[0],dice[1]))
    return true;
  else
    return false;
}


int main()
{

  int i,j;
  int dice[2][6];
  int n = 2;
  /*int s[6];
  int d[6];
  int hantei;*/

  for (i = 0; i < n; i++)
    {
      for (j = 0; j < 6; j++)
	scanf("%d", &dice[i][j]);
    }

  //compare(s,d,n);

  //if((d.men[0] == s.men[0]) && (d.men[1] == s.men[1]) && (d.men[2] == s.men[2]) && (d.men[3] == s.men[3]) && (d.men[4] == s.men[4]) && (d.men[5] == s.men[5]))
  /*  if(hantei == 1)
    printf("Yes\n");
  else
  printf("No\n"); */
  printf("%s\n",solve(dice)? "Yes" : "No");

  return 0;
}


Measured memory_bytes: 2100
// AOJ 1591 Graph Making
// 2018.4.18 bal4u

#include <stdio.h>

// バッファを経ずstdinから数値を得る
#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int main()
{
	int n, d;

	n = in(), d = in();
	if (d == 1) printf("%lld\n", (long long)n*(n-1)>>1);
	else printf("%lld\n", (n-1)+(long long)(n-d-1)*n-((long long)(n-d-1)*(n+d-2)>>1));
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	ll n;
	ll ans = 0;

	cin >> n;

	V a(n);
	rep(i, n) {
		cin >> a[i];
	}

	sort(RALL(a));

	ll v = 0;
	V r;
	rep(i, n) {
		if (a[i] != v) {
			v = a[i];
		}
		else {
			r.push_back(v);
			if (r.size() == 2) {
				break;
			}
			v = 0;
		}
	}

	if (r.size() != 2) {
		ans = 0;
	}
	else {
		ans = r[0] * r[1];
	}

	cout << ans << "\n";
}

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

	solve_abc_c();

	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

ll W, H, x, y;

int main() {
    cin >> W >> H >> x >> y;
    cout << fixed << setprecision(6) << double(W * H) / double(2) << ' ';
    if (x * 2 == W && y * 2 == H)
        cout << 1 << endl;
    else
        cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        
        int W = sc.nextInt();
        int H = sc.nextInt();
        int N = sc.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];
        int[] a = new int[N];
        int x_min = 0;
        int x_max = W;
        int y_min = 0;
        int y_max = H;
        
        for(int i = 0; i < N; i++){
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            a[i] = sc.nextInt();
        }
        
        for(int i = 0; i < N; i++){
            if(a[i] == 1){
                if( x[i] > x_min )x_min = x[i];
            }
            if(a[i] == 2){
                if( x[i] < x_max )x_max = x[i];
            }
            if(a[i] == 3){
                if( y[i] > y_min )y_min = y[i];
            }
            if(a[i] == 4){
                if( y[i] < y_max )y_max = y[i];
            }
        }
        
        int ans;
        if((x_min < x_max) && (y_min < y_max)){
            ans = (x_min - x_max) * (y_min - y_max);
        }else{
            ans = 0;
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 21972