akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

ll a[100000];
signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int2(n, k);
    rep(i, n)scanf("%lld", a + i);

    ll tmp = 0;
    rep(i, n)if(a[i] >= 0)tmp += a[i];

    ll sum1 = 0LL, sum2 = 0LL;
    rep(i, k){
      sum1 += a[i];
      if(a[i] >= 0)sum2 += a[i];
    }
    ll res = 0;
    res = max(res, tmp - sum2 + sum1);
    res = max(res, tmp - sum2);
    i = 0;
    //pri(tmp);
    //debug2(i, res);
    //debug2(sum1, sum2);

    for(i = 0;i < n - k;++i){
      sum1 += a[i + k] - a[i];
      if(a[i] >= 0)sum2 -= a[i];
      if(a[i + k] >= 0)sum2 += a[i + k];
      res = max(res, tmp - sum2 + sum1);
      res = max(res, tmp - sum2);
      //debug2(i + 1, res);
      //debug2(sum1, sum2);
    }
    pri(res);

/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int A[N];
    int i;
    rep(i,N) cin >> A[i];
    int count = 0;
    for (int j = 0; j < N; ++j)
    {
        int minj = j;
        for (int k = j; k < N; ++k)
        {
            if(A[minj] > A[k]){
                minj = k;
            }
        }
        if (j != minj)
        {
            count++;
            int tmp = A[j];
            A[j] = A[minj];
            A[minj] = tmp;
        }
    }
    rep(i,N - 1) cout << A[i] << " ";
    P(A[N-1]);
    P(count);

    return 0;
}

Measured memory_bytes: 3084
#include <stdio.h>
int main()
{
	int a, b,d,r;
	double f;
	scanf("%d %d", &a, &b);
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	printf("%d %d %f\n", d, r, f);
	return 0;
}


Measured memory_bytes: 2764
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	string s;cin>>s;set<char> se;for(char c:s)se.insert(c);
	if(se.count('N')==se.count('S') && se.count('E')==se.count('W')) cout<<"Yes";
	else cout<<"No";
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep0c(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep1c(i, n) for (int i = 1; i <= (int)(n); i++)
#define repc0(n, i) for (int i = (int)(n); i >= 0; i--)

using namespace std;
typedef long long ll;

int N, K;
deque<int> D;
map<pair<int, deque<int> >, int> memo;

int dfs(int k, deque<int> d, multiset<int> pos, multiset<int> neg) {
  if(memo.find(make_pair(k, d)) != memo.end()) return memo[make_pair(k, d)];
  if(k<=0) return 0;
  int maxv = 0; // noop
  if(!d.empty()) {
    int v;
    multiset<int>::iterator itr;
    // left
    v = d.front(); d.pop_front();
    if(v >= 0) itr = pos.insert(v);
    else itr = neg.insert(v);
    maxv = max(maxv, v+dfs(k-1, d, pos, neg));
    if(v >= 0) pos.erase(itr);
    else neg.erase(itr);
    d.push_front(v);
    // right
    v = d.back(); d.pop_back();
    if(v >= 0) itr = pos.insert(v);
    else itr = neg.insert(v);
    maxv = max(maxv, v+dfs(k-1, d, pos, neg));
    if(v >= 0) pos.erase(itr);
    else neg.erase(itr);
    d.push_back(v);
  }
  if(!neg.empty()) {
    // dispose neg
    multiset<int>::iterator itr = neg.cbegin();
    int sum = 0;
    rep(i, k) {
      sum -= *itr;
      ++itr;
      if(itr == neg.cend()) break;
    }
    maxv = max(maxv, sum);
  }
  return memo[make_pair(k, d)] = maxv;
}

void solve() {
  printf("%d\n", dfs(K, D, multiset<int>{}, multiset<int>{}));
}

int main() {
  scanf("%d %d", &N, &K);
  int v;
  rep(i, N) {
    scanf("%d", &v);
    D.push_back(v);
  }
  solve();
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 998244353;


int main() {
    int n; cin >> n;
    vector<ll> as(n);
    bool done = false;
    rep(i, n) {
        ll a; cin >> a;
        if (a == 0) done = true;
        as[i] = a;
    }
    if (done) {
        cout << 0 << endl;
        return 0; 
    }
    ll ans = 1;
    ll base = 1e18;
    ll ch = 1e18;
    for (ll a : as) {
        if (a > ch) {
            ans = -1;
            break;
        } 
        ans *= a;
        ch = base / ans;
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int h[10];
  for(int i = 0; i < 10; i++){
    cin >> h[i];
  }
  sort(h, h + 10);
  cout << h[9] << endl << h[8] << endl << h[7] << endl;
}

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

int main(){

    while(1){
        int n;
        cin >> n;
        if(n==0)break;
        vector<string> s(n);
        int ma=0;
        for(int i=0;i<n;i++){
            cin >> s[i];
            ma=max(ma,(int)s[i].size());
        }

        string o=" +|";
        int st=0;
        for(int i=0;i<ma;i++){
            st=0;
            for(int j=n-1;j>=0;j--){
                if(i<s[j].size()){
                    if(s[j][i]!='.'){
                        st=-1;
                    }else{
                        if(i+1<s[j].size()){
                            if(s[j][i+1]!='.'){
                                st=1;
                            }
                        }
                    }
                    if(st!=-1){
                        s[j][i]=o[st];
                    }else{
                        st=0;
                    }
                    if(st==1)st++;
                }
            }
        }
        for(int i=0;i<n;i++){
            cout << s[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3732
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
N=int(input())
for i in range(N):
  tmp=int(input())
  for j in range(3):
    if tmp ==A[j]:
      A[j]=-1
    if tmp ==B[j]:
      B[j]=-1
    if tmp ==C[j]:
      C[j]=-1
if A[0]==A[1]==A[2]==-1:
  print('Yes')
  exit()
if B[0]==B[1]==B[2]==-1:
  print('Yes')
  exit()
if C[0]==C[1]==C[2]==-1:
  print('Yes')
  exit()
if A[0]==B[0]==C[0]==-1:
  print('Yes')
  exit()
if A[1]==B[1]==C[1]==-1:
  print('Yes')
  exit()
if A[2]==B[2]==C[2]==-1:
  print('Yes')
  exit()
if A[0]==B[1]==C[2]==-1:
  print('Yes')
  exit()
if C[0]==B[1]==A[2]==-1:
  print('Yes')
  exit() 
print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N;
  cin >> N;

  for (int i = 0; i < N; ++i)
  {
    string S;
    cin >> S;
    if (S == "Y")
    {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}


Measured memory_bytes: 3532
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    int N;
    ll A, B;
    cin >> N >> A >> B;
    vector<int> X(N);
    for(int i = 0; i < N; ++i){
        cin >> X[i];
    }
    
    ll res = 0;
    
    for(int i = 0; i < N - 1; ++i){
        ll temp = A * (X[i + 1] - X[i]);
        if(temp < B){
            res += temp;
        }
        else{
            res += B;
        }
    }
    
    cout << res << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
//#define vi vector<int>
#define vb vector<bool>
#define pii pair<int, int>
#define mii map<int, int>
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define inf (long long)1e18
#define F first
#define S second
#define SZ(x) ((int)(x).size())
//#define rep(i, n) for (int i = 0; i < n; i++)
//#define repd(i,n) for(int i=n-1;i>=0;i--)
//#define rep1(i,n) for(int i=1;i<=n;i++)
const int N = 1e9 + 7;

int pow(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = ((res) * (x));
        res %= N;
        y = y >> 1;
        x = ((x) * (x));
    }
    return res;
}
int powm(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll mxn(ll a, ll b)
{
    if (a > b)
        return a;
    else
    {
        return b;
    }
}

void solve()
{
    double d, t, s;
    cin >> d >> t >> s;
    double ans;
    ans = d / s;
    if (ans <= t)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}

int32_t main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int t;
    // cin >> t;
    // while (t--)
    // {
    solve();
    // }
}

Measured memory_bytes: 3660
sx,sy,tx,ty=map(int,input().split())
one_go=abs(tx-sx)*"R"+abs(ty-sy)*"U"
one_back=abs(tx-sx)*"L"+abs(ty-sy)*"D"
two_go="L"+abs(ty-sy+1)*"U"+"R"*abs(tx-sx+1)+"D"
two_back="R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"
print(one_go+one_back+two_go+two_back)

Measured memory_bytes: 3060
k,x=map(int,input().split())
pos=[]
for i in range(x-k+1,x+k):
  if -1000000<=i and i<=1000000:
    pos.append(i)

for idx,el in enumerate(pos):
  if idx==0:
    print(el,end='')
  else:
    print(' '+str(el),end='')
print()

Measured memory_bytes: 3060
s=list(input())

ima=0
wNum=0
for i in range(len(s)):
  if s[i]=="W":
    ima += i
    wNum += 1

def kasan(n):
  if n==0:
    return 0
  else:
    return kasan(n-1) + n

saigo = ((wNum-1)+0)*wNum//2
print(ima-saigo)

Measured memory_bytes: 4840
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807

using namespace std;

long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}
bool sosuu_check(int num) {
	int i;
	for (i = 2; i <= sqrt(num); ++i) {
		if (num%i == 0)
			return false;
	}
	return (num < 2) ? false : true;
}
int main() {
	int N, M, X, Y, i, xmax = -100, xmin = 100, ymax = -100, ymin = 100, x, y;
	cin >> N >> M >> X >> Y;
	REP(i, N) {
		cin >> x;
		xmax = max(xmax, x);
		xmin = min(xmin, x);
	}
	REP(i, M) {
		cin >> y;
		ymax = max(ymax, y);
		ymin = min(ymin, y);
	}
	xmax = max(X, xmax);
	ymin = min(Y, ymin);
	if (xmax < ymin) {
		cout << "No War" << endl;
		return 0;
	} 
	else {
		cout << "War" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
import math
a, b=map(int, input().split())
n=s=0
if b<=a:
	n=a-b+1
for i in range(1, min(a+1,b)):
	p=b/i
	p=math.ceil(math.log2(p))
	s+=(1/a)*(0.5**p)
print(s+(n/a))

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    int a[11],k;
    cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>k;
    int ans=1;
    for(int i=1;i<=4;i++){
        for(int z=1;z<=4;z++){
            if(z!=i){
                if(a[i+1]-a[z] > k){
                    ans=0;
                }
            }
        }
    }
    if(ans==1){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}

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

#define rep(i, cc, n) for (int i = cc; i < n; ++i)
using namespace std;

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

    bool rank[8];
    rep(i, 0, 8)
    {
        rank[i] = false;
    }

    int over3200 = 0;
    rep(i, 0, N)
    {
        int a;
        cin >> a;

        if (a >= 3200)
        {
            over3200++;
        }
        else
        {
            rank[a / 400] = true;
        }
    }

    int ans = 0;
    rep(i, 0, 8)
    {
        if (rank[i])
        {
            ans++;
        }
    }

    if (ans >= 1)
    {
        cout << ans << " " << (ans + over3200) << endl;
    }
    else
    {
        cout << 1 << " " << over3200 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z;
    cin>>x>>y;
    ll ans = LLMAX;
    for(ll i=x;i<=min(x+3000,y);i++){
        for(ll j=i+1;j<=min(x+3000,y);j++){
            ans = min(ans,(i*j)%2019);
        }
    }
    cout<<ans;


    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <deque>

using namespace std;

template<typename T, typename S>
istream& operator >> (istream& is, pair<T, S>& p) {
    is >> p.first >> p.second;
    return is;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& v) {
    for (auto& x : v) {
        is >> x;
    }
    return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& v) {
    for (auto& x : v) {
        os << x << " ";
    }
    os << "\n";
    return os;
}

struct MaxQueue {
    deque<int64_t> q;

    int64_t max() const {
        return q.front();
    }

    void push(int64_t x) {
        while (!q.empty() && q.back() < x)
            q.pop_back();
        q.push_back(x);
    }

    void pop(int64_t x) {
        if (!q.empty() && q.front() == x)
            q.pop_front();
    }
};

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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int N, M, K;
    cin >> N >> M >> K;
    vector<int64_t> A(N);
    cin >> A;
    vector<vector<int64_t>> dp(K + 1, vector<int64_t>(N + 1, 0));
    for (int64_t k = 1; k <= K; ++k) {
        MaxQueue prev_M;
        if (k == 1) prev_M.push(0);
        for (int i = 0; i < N; ++i) {
            if (i >= k - 1) {
                dp[k][i + 1] = prev_M.max() + k * A[i];
            }
            prev_M.push(dp[k - 1][i + 1]);
            if (i >= M) prev_M.pop(dp[k - 1][i + 1 - M]);
        }
    }
    int64_t max_ans = dp[K][N];
    for (int i = 1; i < N; ++i) {
        if (dp[K][i] > max_ans) max_ans = dp[K][i];
    }
    cout << max_ans;
}


Measured memory_bytes: 240852
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
6
)");
#define cin input
#endif

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

	int k = sqrt((long double)n * 2) + 1;
	if (k * (k - 1) / 2 == n)
	{
		cout << "Yes" << endl;
		cout << k << endl;
		REP (i, k)
		{
			cout << k - 1;
			int x = i * (i - 1) / 2;
			REP (j, i)
				cout << ' ' << ++x;
			++x;
			FOR (j, i, k - 1)
				cout << ' ' << (x += j);
			cout << endl;
		}
	} else
		cout << "No" << endl;

	return 0;
}
/*
0
11
223
3456
47890
 01234
 */

Measured memory_bytes: 1408
using System;
class MainClass
{
	static void Main(string[] args)
	{
      string[] strArr = Console.ReadLine().Split(' ');
      int InitnumOfRow = int.Parse(strArr[0]);
      for (int i = 0; i < InitnumOfRow; i++)
      {
        string strRow = Console.ReadLine();
        Console.WriteLine(strRow);
        Console.WriteLine(strRow);
      }
	}
}


Measured memory_bytes: 11092
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>
#include <limits>

using namespace std;

int main() {
  int x, a;
  scanf("%d%d", &x, &a);
  printf("%d\n", (x < a) ? 0 : 10);
  return 0;
}


Measured memory_bytes: 128
package main

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

// 不足しているカードの発見
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	m := map[string][]bool{
		"S": []bool{false, false, false, false, false, false, false, false, false, false, false, false, false},
		"H": []bool{false, false, false, false, false, false, false, false, false, false, false, false, false},
		"C": []bool{false, false, false, false, false, false, false, false, false, false, false, false, false},
		"D": []bool{false, false, false, false, false, false, false, false, false, false, false, false, false},
	}

	for i := 0; i < n; i++ {
		sc.Scan()
		ary := strings.Split(sc.Text(), " ")
		s := ary[0]
		v, _ := strconv.Atoi(ary[1])
		mv, _ := m[s]
		mv[v-1] = true
	}

	s, _ := m["S"]
	h, _ := m["H"]
	c, _ := m["C"]
	d, _ := m["D"]
	str := print("S", s)
	str += print("H", h)
	str += print("C", c)
	str += print("D", d)
	fmt.Print(str)
}

func print(suit string, ary []bool) string {
	s := ""
	for i, v := range ary {
		if !v {
			s += fmt.Sprintf("%v %v\n", suit, i+1)
		}
	}
	return s
}



Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define D(x) cerr << #x << " = " << (x) << '\n'
using ll = long long;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	n %= 10;
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9 ) cout << "hon\n";
	else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon\n";
	else cout << "bon\n";
}


Measured memory_bytes: 3616
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
  long long int b[100010],dis,dis1=0,r,tmp,x,y,z,i,n,m,a[100010],ans,l=0;
  scanf("%lld %lld\n",&n,&m);
  for(i=0;i<n;i++){
    scanf("%lld ",&a[i]);
    if(a[i]%2==1){
      l=1;
    }
    b[i]=a[i];
    a[i]=a[i]/2;
  }
  sort(a,a+n);
  for(i=0;i<n;i++){
    while(b[i]%2==0){
      dis1++;
      b[i]=b[i]/2;
    }
    if(i!=0 && dis!=dis1){
      l=1;
      break;
    }
    dis=dis1;
    dis1=0;
  }
  x=a[0],y=a[1];
  for(i=1;i<n;i++){
    z=x*y;
    if(x<y){
      tmp=x;
      x=y;
      y=tmp;
    }
    r=x%y;
    while(r!=0){
      x=y;
      y=r;
      r=x%y;
    }
    x=z/y;
    y=a[i+1];
    if(x>m){
      l=1;
      break;
    }
  }
  if(l==1){
    printf("0\n");
  }
  else{
  ans=m/x;
  if(ans%2==0){
  printf("%lld\n",ans/2);
  }
  else{
    printf("%lld\n",(ans+1)/2);
  }
  }
  return 0;
}

Measured memory_bytes: 1664
using System;
using System.Linq;

class ABC119A{
    public static void Main(){
        var t = int.Parse(new String(Console.ReadLine().Where(x=>x!='/').ToArray()));
        if(t<=20190430){
            Console.WriteLine("Heisei");
        }else{
            Console.WriteLine("TBD");
        }
    }
}

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

int main(){
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    int l = max(n,k);
    int f[l+1];
    f[1] = 0;
    for(int i=2;i<=k;i++){
        f[i] = INT32_MAX;
        for(int j=1;j<i;j++){
            int temp = f[i-j] + abs(arr[i] - arr[i-j]);
            if(f[i] > temp)
                f[i] = temp;
        }
    }
    for(int i=k+1;i<=n;i++){
        f[i] = INT32_MAX;
        for(int j=i-1;j>=(i-k);j--){
            int temp = f[j] + abs(arr[i] - arr[j]);
            if(f[i] > temp)
                f[i] = temp;
        }
    }
    cout<<f[n]<<endl;
    return 0;
}

Measured memory_bytes: 4340
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"abc"# => r#"yes"#,
r#"aba"# => r#"no"#,

}

fn solve(src: &str) -> String {
    input! {
        source = src,
        s: chars,
    }
    let mut c = s.clone();
    c.sort();
    c.dedup();

    if s.len() == c.len() {
        "yes"
    } else {
        "no"
    }.to_string()
}

Measured memory_bytes: 4352
N = int(input())
cnt = 0
i = 0
if N%2 == 1:
	cnt = 0
else:
	while N >= 10*(5**i):
		cnt += N//(10*(5**i))
		i += 1
		#print(10*(5**i), N//(10*(5**i)))
print(cnt)

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

using namespace std;

template<typename T>
long long modpow(const T n,const T p,const T mod);
template<typename T>
long long modinv(const T n,const T mod);
template<typename T>
bool chmax(T &a,const T &b);
template<typename T>
bool chmin(T &a,const T &b);

long long inf=1000000007;

int main(){
	long long h,w;
	cin>>h>>w;
	long long sx,sy,gx,gy;
	cin>>sy>>sx>>gy>>gx;
	vector<string> grid(h);
	for(long long i=0;i<h;i++){
		cin>>grid.at(i);
	}
	sx--;sy--;gx--;gy--;
	vector<vector<long long>> dis(h,vector<long long>(w,inf));
	dis.at(sy).at(sx)=0;
	priority_queue<pair<long long,pair<long long,long long>>,vector<pair<long long,pair<long long,long long>>>,greater<pair<long long,pair<long long,long long>>>> que;
	que.push(make_pair(0,make_pair(sy,sx)));

	while(!que.empty()){
		long long ny=que.top().second.first,nx=que.top().second.second;
		long long nowdis=que.top().first;
		que.pop();

		if(dis.at(ny).at(nx)!=nowdis) continue;

		vector<long long> dy={1,0,-1,0},dx={0,1,0,-1};
		for(long long i=0;i<4;i++){
			long long py=ny+dy.at(i);
			long long px=nx+dx.at(i);
			if(py<0 || py>=h || px<0 || px>=w || grid.at(py).at(px)=='#' || dis.at(py).at(px)<=nowdis) continue;

			dis.at(py).at(px)=dis.at(ny).at(nx);
			que.push(make_pair(nowdis,make_pair(py,px)));
		}

		for(long long i=-2;i<=2;i++){
			for(long long j=-2;j<=2;j++){
				long long py=ny+i;
				long long px=nx+j;
				if(py<0 || py>=h || px<0 || px>=w || grid.at(py).at(px)=='#' || dis.at(py).at(px)<=nowdis+1) continue;

				dis.at(py).at(px)=dis.at(ny).at(nx)+1;
				que.push(make_pair(nowdis+1,make_pair(py,px)));
			}
		}
	}

	if(dis.at(gy).at(gx)==inf) cout<<-1<<endl;
	else cout<<dis.at(gy).at(gx)<<endl;

	return 0;
}

template<typename T>
long long modpow(const T n,const T p,const T mod){
	if(p==0) return 1;
	if(p%2==0){
		long long a=modpow(n,p/2,mod);
		return a*a%mod;
	}
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}

template<typename T>
long long modinv(const T n,const T mod){
	return modpow(n,mod-2,mod);
}

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

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


Measured memory_bytes: 13580
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int a;

	while (cin >> a) {
		int counter = 0;
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				for(int k = 0; k < 10; k++) {
					for(int l = 0; l < 10; l++) {
						if(i+j+k+l == a) {
							counter++;
						}
					}
				}
			}
		}
		cout << counter << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;

class FC{
public:
 int p[31];
 int n;

 bool is_over(){
  return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] &&p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21] && p[22]==p[23] && p[23]==p[24] && p[24]==p[25] && p[25]==p[26] && p[26]==p[27] && p[27]==p[28] && p[28]==p[29] && p[29]==p[30];
 }

 void rot1(){
  swap(p[7],p[22]); swap(p[8],p[23]); swap(p[9],p[24]); swap(p[13],p[18]);    swap(p[10],p[12]);
 }

 void rot2(){
  swap(p[1],p[28]); swap(p[2],p[29]); swap(p[3],p[30]); swap(p[15],p[16]);     swap(p[19],p[21]);
 }

 void rot3(){
  swap(p[1],p[24]); swap(p[4],p[27]); swap(p[7],p[30]); swap(p[10],p[21]);    swap(p[16],p[18]);
 }
 
 void rot4(){
  swap(p[3],p[22]); swap(p[6],p[25]); swap(p[9],p[28]); swap(p[12],p[19]);    swap(p[13],p[15]);
 }
};

int main(){
 int N;
 cin >> N;
 for(int i=0; i<N; i++){
  FC now;
  for(int j=1; j<=30; j++){
   cin >> now.p[j];
  }
  now.n = 0;

  queue<FC> que;
  que.push(now);
  
  while(!que.empty()){
   now = que.front();
   que.pop();
 
   if(now.is_over()){
    cout << now.n << endl; break;
   }

   FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1);
   FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2);
   FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3);
   FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4);

  }
 }

 return 0;
}

Measured memory_bytes: 13920
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    string S;
    cin >> S;
    int cnta = 0, cntb = 0, cntc = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'a')cnta++;
        if(S[i] == 'b')cntb++;
        if(S[i] == 'c')cntc++;
    }
    if(max(cnta, max(cntb, cntc)) - min(cnta, min(cntb, cntc)) <= 1)cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

bool comp(pair<int,int>a,pair<int,int>b){
	return a.second<b.second;
}

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

	pair<int,int>p[n];

	for (int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;

		p[i].first = a-b;
		p[i].second = a+b;

	}

	sort(p,p+n,comp);
	int curr=INT_MIN,ans=0;
	for (int i=0;i<n;i++){
		if (curr<=p[i].first)
				ans++,curr=p[i].second;

	}
	cout<<ans<<'\n';

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
ll dp[110][110000];//iまで　価値vになる最小値w
ll w[110],v[110];

int main(){cout<<fixed<<setprecision(10);
		   int n,W;
           cin>>n>>W;
           rep(i,1,n+1){
             cin>>w[i]>>v[i];
           }
           rep(i,1,110000)dp[0][i]=INF;
           
           rep(i,1,n+1){
            rep(j,0,110000){
             dp[i][j]=dp[i-1][j];
             if(j-v[i]>=0)dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
            }
           }
           int ans=0;
           rep(i,0,110000){
             if(dp[n][i]<=W)
             chmax(ans,i);
           }
           cout<<ans<<endl;
}

Measured memory_bytes: 90380
#include<iostream>
using namespace std;
#define ll long long
#define mod 1000000007


ll dp[2001];

ll solve(ll s)
{
    if(s==0)
    {
        return(1);
    }
    if(dp[s]!=-1)
    {
        return(dp[s]);
    }
    ll i;
    ll ans=0;
    for(i=3;i<=s;i++)
    {
        ans=(ans+solve(s-i))%mod;
    }
    return(dp[s]=ans);
}

int main()
{
    ll i;
    for(i=0;i<=2000;i++)
    {
        dp[i]=-1;
    }
    ll s;
    cin>>s;
    cout<<solve(s)<<"\n";
}

Measured memory_bytes: 3608
N, K = map(int, input().split())

import string
numbers = "0123456789"
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = numbers + alphabets
 
def base_cvt(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)
 
    if n < 2 or n > len(characters):
        raise ValueError('Invalid n:', value)
 
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result

print(len(str(base_cvt(N, n=K))))

Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int val;
    cin>>val;
    long long int money=100;
    for(int i=1;i<=100000;++i)
    {
        double bonus=1.01*money;
        money=bonus;
        if(money>=val)
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main() {
	int n, m;
	cin >> n >> m;
	
	int ans = (n - 1)*(m - 1);

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    string s; cin >> s;
    int res = INF;
    for(char ch='a'; ch <= 'z'; ch++){
        string t = s;
        while(!t.empty()){
            bool fg = true;
            for(int j=1; j<t.size(); j++){
                if(t[j] != t[0]){
                    fg = false; break;
                }
            }
            if(fg){
                chmin(res, (int)s.size() - (int)t.size());
                break;
            }
            string u = "";
            rep(i, t.size()-1){
                if(t[i] == ch || t[i+1] == ch) u += ch;
                else u += t[i];
            }
            t = u;
        }
    }
    cout << res << ln;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int a[500], b[500];
    string name[9];
    int i;
 
    for(i = 0; i < 9; i++){
        cin >> name[i] >> a[i] >> b[i];
    }
 
    long int earnings[9];
    int sum_ab[9];
 
    for(i = 0; i < 9; i++){
        sum_ab[i] = a[i] + b[i];
        earnings[i] = 200 * a[i] + 300 * b[i];
 
        cout << name[i] << " " << sum_ab[i] << " " << earnings[i] << endl;
    }
}


Measured memory_bytes: 3120
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define FP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define FS(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define IT(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector< pair<int, int> > VPII;
typedef vector< pair<int, PII > > VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

int main(int argc, char* argv[])
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	double p[1001];
	double sum=0;
	for(int i=1;i<=1001;++i)
	{
		sum+=i;
		p[i]=sum/(double)i;
		//cout<<p[i]<<' ';
	}
	int n,k;
	cin>>n>>k;
	VII arr(n);
	for(auto &x:arr)cin>>x;
	double mx = 0, tmp = 0;
	
	int st=0;
	for(int i=0;i<k;++i)
	mx+=p[arr[i]];
	tmp=mx;
	for(int i=k;i<n;++i)
	{
		tmp-=p[arr[st]];
		st++;
		tmp+=p[arr[i]];
		//if(i-st+1==k)
		mx=max(mx,tmp);

	}
	cout<<std::fixed<<setprecision(12)<<mx;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int N=1e5;

int s[N],t[N],c[N];
int sm[N*2];
int tt[N*2];


int main(){
	int n,C;
	cin>>n>>C;
	
	for(int i=0;i<n;i++){
		cin>>s[i]>>t[i]>>c[i];
	}
	
	for(int i=1;i<=C;i++){
		memset(tt,0,sizeof(tt));
		
		for(int j=0;j<n;j++){
			if(c[j]==i)
				tt[2*s[j]-1]++,
				tt[2*t[j]]--;
		}
		
		for(int j=0;j<2*N;j++)
			tt[j]+=tt[j-1];

		for(int j=0;j<2*N;j++)
			if(tt[j]>0)
				sm[j]++;
	}
	
	cout<<*(max_element(sm,sm+2*N))<<endl; 
}


Measured memory_bytes: 6324
#include <stdio.h>
#include <math.h>

int main(void) {
    int n,t,a,h[1000],i,ans;
    double dif = 999;
    scanf("%d",&n);
    scanf("%d %d",&t,&a);
    for (i = 0;i < n;i++) {
        scanf("%d",&h[i]);
        if (fabs(a - (t - h[i] * 0.006)) < dif) {
            dif = fabs(a - (t - h[i] * 0.006));
            ans = i;
        }
    }
    printf("%d\n",ans + 1);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
const ll INF = 1e9 + 7;
typedef pair<int,int> P;// pair型は２つの値の組を表せる

int main(){
    string S; cin >> S;
    if (S[0]==S[1] && S[1]==S[2]) cout << "No";
    else cout << "Yes";
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            List<Integer> A = new ArrayList<>();
            List<Integer> B = new ArrayList<>();

            List<Integer> Aa = new ArrayList<>();
            List<Integer> Ba = new ArrayList<>();

            for (int i = 0; i < 4; i++) A.add(Integer.parseInt(sc.next()));
            for (int i = 0; i < 4; i++) B.add(Integer.parseInt(sc.next()));

            List<Integer> rIndex = new ArrayList<>();

            int hit = 0;
            for (int i = 0; i < 4; i++) {
                if (Objects.equals(A.get(i), B.get(i))) {
                    hit++;
                } else {
                    Aa.add(A.get(i));
                    Ba.add(B.get(i));
                }
            }
            
            int blow = 0;
            for (Integer aB : Ba) {
                if (Aa.contains(aB)) {
                    blow++;
                }
            }



            System.out.printf("%d %d\n", hit, blow);
        }
    }
}

Measured memory_bytes: 26532
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x,T a,T b){return a<=x&&x<=b;}
template<class T> void amin(T &a,T v){if(a>v) a=v;}
template<class T> void amax(T &a,T v){if(a<v) a=v;}
int ROUND(double x) { return (int)(x+0.5); }
bool ISINT(double x) { return fabs(ROUND(x)-x)<=EPS; }
bool ISEQUAL(double x,double y) { return fabs(x-y)<=EPS*max(1.0,max(fabs(x),fabs(y))); }
double SQSUM(double x,double y) { return x*x+y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;

	ll ret = 0;

	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
	{

	}
	else
	{
		ret = min(a*b, min(b*c, c*a));
	}

	cout << ret << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;

int main () {

  int N; cin >> N;
  vector<int> a(3*N);

  for (int i = 0; i < 3 * N; i++ ) {
    cin >> a[i];
  }

  priority_queue<int> pqr;
  priority_queue<int, vector<int>, greater<int> > pql;
  vector<ll> vl(N+1, 0), vr(N+1, 0);
  for (int i = 0; i < N; i++ ) {
    pql.push(a[i]);
    pqr.push(a[3*N-i-1]);

    vl[0] += a[i];
    vr[N] += a[3*N-i-1];
  }

  for (int i = N; i < 2*N; ++i ) {

    vl[i-N+1]   = vl[i-N];
    vr[2*N-i-1] = vr[2*N-i];

    int l = pql.top();
    if (a[i] > l) {
      pql.pop();
      pql.push(a[i]);
      vl[i-N+1] += a[i]-l;
    }

    int r = pqr.top();
    if (a[3*N-i-1] < r) {
      pqr.pop();
      pqr.push(a[3*N-i-1]);
      vr[2*N-i-1] -= r - a[3*N-i-1];
    }

  }

  /*
  for (int i = 0; i <= N; ++i ) 
    cout << vl[i] << " ";
  cout << endl;

  for (int i = 0; i <= N; ++i ) 
    cout << vr[i] << " ";
  cout << endl;
  */

  ll ans = LLONG_MIN;
  for (int i = 0; i <= N; ++i ) 
    ans = max(ans, vl[i]-vr[i]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#define DIVCEIL(A,B) ((A+(B-1))/B)
using namespace std;


void solve(string abcd){
    for(unsigned int mask=0; mask< 1<<4; mask++){
        int total = abcd[0] - '0';
        vector<char> tmp;

        for(int j=0; j<3; j++){
            auto c=abcd[j+1];
            if(mask & 1<<j){
                total+=c-'0';
                tmp.push_back('+');

            }else{
                total-=c-'0';
                tmp.push_back('-');
            }
            tmp.push_back(c);
        }
        if(total==7){
            cout <<  abcd[0];
            for(auto c:tmp)cout << c;
            cout << "=7" << endl;
            return;
        }
    }
}

int main(){
    long long ABCD;
    string s;
    cin >> s;
    solve(s);
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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



int main(void) {
	int n;
	int total = 0;
	
	cin >> n;

	vector<int> p(n);

	FOR(i, 0, n - 1) {
		cin >> p[i];
	}
	sort(p.begin(), p.end());

	FOR(i, 0, n - 2) {
		total += p[i];
	}
	total += p[n - 1]/2;
	cout << total << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{

  int n,a[1000],i,j,key,u;

  scanf("%d",&n);

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

  for(i=0;i < n-1;i++){
    printf("%d ",a[i]);
  }

  printf("%d\n",a[i]);

  for( i = 1 ; i < n ; i++){
    key = a[i];
    j = i - 1;
    while(j >= 0 && a[j] > key)
      {
	a[j+1] = a[j];
	j--;
	a[j+1]= key;
      }

    for(u=0;u<n-1;u++){
      printf("%d ",a[u]);
    }

    printf("%d\n",a[u]);

  }

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
//long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    string S;
    cin >> S;
    ll N = S.size();
    bool flag = true;
    rep(i,N){
        if(S[i] == S[N-1-i]){
            continue;
        }else{
            flag = false;
        }
    }
    int j = 0;
    rep(i,((N-1)/2)){
        if(S[i] == S[(N-1)/2 -1 -i]){
            continue;
        }else{
            flag = false;
        }
    }
    j = 0;
    for(int i = (N+3)/2 -1; i<N;i++){
        if(S[i] == S[N-1-j]){
            j++;
            continue;
        }else{
            flag = false;
            j++;
        }
        
    }

    cout << (flag?"Yes":"No") << endl;
    
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
//const int INF = INT_MAX  ;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;

//< ave , a(time), b(manzoku) >
typedef tuple<double, int, int> A;

int gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    if (y == 0) {
        return x;
    }
    return gcd(y, x % y);
}

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

    bool kitai = true; // trueが0
    int count = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != (kitai ? '0' : '1')) {
            count++;
        }
        kitai = !kitai;
    }

    bool kitai2 = false; // trueが0
    int count2 = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != (kitai2 ? '0' : '1')) {
            count2++;
        }
        kitai2 = !kitai2;
    }

    cout << min(count, count2) << endl;

}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int N;
    string S;
    cin >> N >> S;
    int A[214514]={},B[214514]={};
    //AiはS[0]~S[i]までにある黒の数
    //BiはS[i]~S[N-1]までにある白の数
    if(S[0]=='#')A[0]=1;
    for(int i=1;i<N;i++){
        A[i]=A[i-1]+(S[i]=='#'?1:0);
    }
    if(S[N-1]=='.')B[N-1]=1;
    for(int i=N-2;i>=0;i--){
        B[i]=B[i+1]+(S[i]=='.'?1:0);
    }
    int Ans=INF;
    Ans=min(A[N-1],B[0]);
    
    REP(i,N-1){
        //0~iまでが白、i+1~N-1までが黒
        Ans=min(Ans,A[i]+B[i+1]);
        
    }
    cout << Ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 3972