akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
using namespace std;
typedef unsigned short ushort;

class QState{
    public:
    int cur, str, cost;
    QState(){}
    QState(int cur, int str, int c):cur(cur), str(str), cost(c){}
    bool operator < ( const QState &q ) const{ return cost > q.cost; }
};

ushort T[16];

int dist(int i, int j){
    return max(i, j) - min(i, j);
}	    

int dijkstra(int n, ushort start, ushort goal){
    priority_queue<QState> PQ;
    ushort d[n][(1<<n)];

    for ( int i = 0; i < n; i++ ){
	for ( int j = 0; j < (1<<n); j++ ){
	    d[i][j] = 10000;
	}
    }

    for ( int i = 0; i < n; i++ ) {
	d[i][start] = 0;
	PQ.push(QState(i, start, 0));
    }

    QState u;
    while( !PQ.empty() ){
	u = PQ.top(); PQ.pop();
	if ( u.str == goal ) return u.cost;

	for ( int i = 0; i < n; i++ ){
	    for  ( int j = 0; j < n; j++ ){
		int nstr = u.str;
		int ncur = u.cur;
		ushort p1 = (nstr & T[i]);
		ushort p2 = (nstr & T[j]);
		
		if ( p1 > 0 && p2 == 0 ){
		    nstr -= p1;
		    nstr += T[j];
		} else if ( p1 == 0 && p2 > 0 ){
		    nstr -= p2;
		    nstr += T[i];
		} else continue;

		ncur = j;

		int ncost = u.cost + dist(u.cur, i) + dist(i, j);

		if ( ncost < d[ncur][nstr] ){
		    d[ncur][nstr] = ncost;
		    PQ.push(QState(ncur, nstr, ncost));
		}
	    }
	}
    }
}

main(){
    int n;
    string s, g;

    for ( int i = 0; i < 16; i++ ) T[i] = (1<<i);
    while( cin >> n && n ){
	cin >> s >> g;
	ushort si = 0, gi = 0;
	ushort p = 1;
	for ( int i = n-1; i >= 0; i--, p *= 2){
	    if ( s[i] == 'B' ) si += p;
	    if ( g[i] == 'B' ) gi += p;
	}
	cout << dijkstra(n, si, gi) << endl;
    }
}

Measured memory_bytes: 6596
n,x = map(int, input().split())

a,p = [1], [1]
for i in range(n):
  a.append(a[i]*2+3)
  p.append(p[i]*2+1)

  
def f(n,x):
  if n == 0:
    return 0 if x <= 0 else 1
  elif x <=1 + a[n-1]:
    return f(n-1, x-1)
  else:
    return p[n-1] + 1 + f(n-1, x-2-a[n-1])
print(f(n,x))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define all(s) s.begin(),s.end()
#define pb push_back
#define uno unordered_map
#define pi 3.1415926536
#define dig(a) fixed<<setprecision(a)
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
ll power(ll a, ll n) {ll res = 1; while (n) {if (n % 2) {res *= a;} n >>= 1; a *= a;} return res;}
ll powerm(ll a, ll n, ll m) {ll res = 1; while (n) {if (n % 2) {res = (res * a) % m;} n >>= 1; a = (a * a) % m;} return res;}
const int M=1e9+7;
ll mod(ll x){
      return ((x%M + M)%M);
}
ll add(ll a, ll b){
      return mod(mod(a)+mod(b));
}
ll mul(ll a, ll b){
      return mod(mod(a)*mod(b));
}

int main(){
	fast();
	int test=1;
	//cin>>test;
	while(test--){
		int n;cin>>n;
		cout<<(n==0?1:0)<<endl;	
	}
	return 0;
}


Measured memory_bytes: 3608
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}





int main(){
    string s;
    cin>>s;
    map<char,int> M;
    for(auto &I:s){M[I]++;}
    cout<<(M[s[0]]==2 && M.size()==2?"Yes":"No")<<endl;
    
    
    return 0;
}


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

int main() {
  
  int a,b;
  cin >> a >> b;
  
  if(a+b >= 10) cout << "error" << endl;
  else cout << a+b << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
int main()
{
	char a[105];
	cin>>a;
	int len;
	len=strlen(a);
	cout<<a[0]<<len-2<<a[len-1]<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
    #define pb push_back
    #define sz size()
     
    using namespace std;
    using ll = long long int;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const int MOD = 1e9 + 7;
const ll ZER = 0;


int main(){
    string s;
    int w;
    cin >> s >> w;
    rep(i, (int)s.sz){
        if(i % w == 0)cout << s[i];
    }
    cout << endl;
}



Measured memory_bytes: 3632
#include <iostream>
#include <string.h>

using namespace std;

int n;
char room[10] = "ABCDEFGHI";
char s, t, b;
int off[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int x, y;

double table[3][3];

double solve()
{
	memset(&table[0][0], 0, sizeof(double) * 9);
	table[y][x] = 1.0;
	for(int k=0; k<n; k++)
	{
		double temp[3][3];
		memset(&temp[0][0], 0, sizeof(double) * 9);
		for(int j=0; j<3; j++)
		{
			for(int i=0; i<3; i++)
			{
				if(table[j][i] != 0.0)
				{
					for(int m=0; m<4; m++)
					{
						int xx = i + off[m][0];
						int yy = j + off[m][1];
						int index = xx + yy * 3;
						xx = (xx>=0 && xx<3 && room[index] != b) ? xx : i;
						yy = (yy>=0 && yy<3 && room[index] != b) ? yy : j;
						temp[yy][xx] += table[j][i] / 4.0;
					}
				}
			}
		}

		memcpy(&table[0][0], &temp[0][0], sizeof(double) * 9);
	}

	for(int i=0; i<9; i++)
	{
		if(room[i]==t) return table[i/3][i%3];
	}

	return 0.0;
}

int main()
{
	while( 1 )
	{
		cin >> n;
		if(n==0) break;
		
		cin >> s >> t >> b;
		for(int i=0; i<9; i++)
		{
			if(room[i] == s)
			{
				x = i%3;
				y = i/3;
			}
		}

		printf("%.8f\n", solve());
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A == B){
    cout << C << endl;
  }
  if(B == C){
    cout << A << endl;
  }
  if(C == A){
    cout << B << endl;
  }
  
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  for (int i=a, j=1; i<a*b; i+=a, j++) {
    if ((a*j)%b==c) {
      printf("YES\n");
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}

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

int main() {
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    int x[n], y[m];
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];

    bool ok = false;
    for (int z = X + 1; z <= Y; z++) {
        bool war = false;
        rep(i, n) if (x[i] >= z) war = true;
        rep(i, m) if (y[i] < z) war = true;
        if (!war) {
            ok = true;
            break;
        }
    }

    if (ok)
        cout << "No War" << endl;
    else
        cout << "War" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;



int main()
{
    int k,n,res,i=1;
    cin>>n>>k;
    int t[n];
    for(int i=0; i<n; i++)
    {
        cin>>t[i];
    }
    int pos=0;

    while(pos+k<n)
    {
        i++;
        pos=pos+k-1;
    }
    cout<<i;
    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,a,b,sa,sb;
    scanf("%d %d %d",&x,&a,&b);
    sa=abs(x-a);
    sb=abs(x-b);
    if(sa>sb)
    {
        printf("B");
    }
    else{
        printf("A");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  vector<int> up1(1);
  vector<int> up2(1);
  vector<int> e1(N);
  vector<int> e2(N);
  up1[0] = 100;
  up2[0] = 100;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> Q[i];
  }
  int count1 = 0;
  int count2 = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < up1.size(); j++) {
      if (up1[j] < P[i]) count1++;
    }
    e1[i] = P[i] - count1;
    up1.push_back(P[i]);
    for (int j = 0; j < up2.size(); j++) {
      if (up2[j] < Q[i]) count2++;
    }
    e2[i] = Q[i] - count2;
    up2.push_back(Q[i]);
    count1 = 0;
    count2 = 0;
  }
  int ansP = 0;
  int ansQ = 0;
  for (int i = 0; i < N; i++) {
  ansP += (e1[i] - 1) * facctorialMethod(N - i - 1);
  ansQ += (e2[i] - 1) * facctorialMethod(N - i - 1);
  }
  cout << max(ansP,ansQ) - min(ansP,ansQ) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
int n,i,a;
int rev[100];

scanf("%d",&n);

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

for(i=n-1;i>=0;i--){
 if(i==n-1)
   printf("%d",rev[i]);
 else  
   printf(" %d",rev[i]);
}

printf("\n");

return 0;
}

Measured memory_bytes: 600
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
Dy = (-1,0,1,0)
Dx = (0,1,0,-1)

from collections import deque,defaultdict,Counter
def solve(H,W):
    grid = [input() for _ in range(H)]
    cnt = [[0]*W for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if grid[i][j] == '@':
                sy,sx = i,j
                break
    
    q = deque([(sy,sx)])
    cnt[sy][sx] = 1
    ans = 1
    while q:
        ny,nx = q.popleft()
        for dy,dx in zip(Dy,Dx):
            y = ny + dy
            x = nx + dx
            if y < 0 or y >= H:
                continue
            if x < 0 or x >= W:
                continue
            if grid[y][x] == '#':
                continue
            if cnt[y][x] == 1:
                continue
            cnt[y][x] = 1
            ans += 1
            q.append((y,x))
    print(ans)
    
def main():
    while True:
        W,H = map(int,input().split())
        if H == 0 and W == 0:
            return
        solve(H,W)
if __name__ == '__main__':
    main()


Measured memory_bytes: 6012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int n;
    cin >> n;
    cout << (n < 1000 ? "ABC" : "ABD") << endl;
}


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

int main()
{
	int n, q;
	string str;
	cin >> n >> q;
	cin >> str;
	vector<int> sp;
	for(int i = 0; i + 1 < n; i++)
	{
		if(str.substr(i, 2) == "AC")
		{
			sp.push_back(1);
		}else
		{
			sp.push_back(0);
		}
	}
	vector<int> cnt(n);
	partial_sum(begin(sp), end(sp), begin(cnt) + 1);
	while(q--)
	{
		int l, r;
		cin >> l >> r;
		cout << cnt[r - 1] - cnt[l - 1] << "\n";
	}
}


Measured memory_bytes: 1912
///Let us start the game
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define pb push_back
using ll = long long;
using ii = pair<int, int>;
using db = long double;
using ull = unsigned long long;
const int N = 2e3 + 5, M = 1e7 + 5, MOD = 1e9+7;
const db EPS = 1e-7;
int get(int x){
  bool f =  false;
  while(x){
    x/=10;
    f^=1;
  }
  return f;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);

  int n;
  cin >> n;
  vector<int>a(n);
  for(auto & x : a)cin >> x;
  if(a[0]>1)a[0]--;
  for(int i = 1; i < n; i++){
    if(a[i] < a[i-1]){
      cout <<"No\n";
      return 0;
    }
    if(a[i]>a[i-1])a[i]--;
  }

  cout << "Yes\n";

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    string s;
    cin >> s;

    int cnt = 0;
    rep(i, s.size()){
        if(s[i] == 'o') cnt ++;
    }

    if(cnt >= 8 || cnt + 15 - s.size() >= 8){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
class PrintAFrame:
    def output(self, H, W):
        s1 = ""
        s2 = ""
        for w in range(W):
            s1 += "#"
            if w == 0 or w == W - 1:
                s2 += "#"
            else:
                s2 += "."
        for h in range(H):
            if h == 0 or h == H - 1:
                print s1
            else:
                print s2
        print

if __name__ == "__main__":
    pf = PrintAFrame()
    while True:
        h, w = map(int, raw_input().split())
        if h == 0 and w == 0:
            break
        pf.output(h, w)

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back


ll modpow(ll a, ll n, ll m)
{
    if(n == 0) return 1;
    ll t = modpow(a, n >> 1, m);
    t = t * t % m;
    if(n & 1) t = t * a % m;
    return t; 
}


int main()
{
    string L;
    cin >> L;
    ll N = SZ(L);
    L = "0" + L;
    
    /*
    mat dp(N+1, vec(2, 0));
    dp[0][0] = 1;

    REP(i,1,N+1) {
        if(L[i] == '0') {
            dp[i][0] = dp[i-1][0] % MOD;
            dp[i][1] = (dp[i-1][1] * 3) % MOD;
        }
        else {
            dp[i][0] = (dp[i-1][0] * 2) % MOD;
            dp[i][1] = (dp[i-1][0] + dp[i-1][1] * 3) % MOD;
        }
    }

    PR((dp[N][0]+dp[N][1])%MOD);
    */

    ll sum = 0, c1 = 0, i = 1;
    while(i <= N) {
        while(L[i] == '0') ++i;
        if(L[i] == '1') {
            sum = (sum + (modpow(3, N-i, MOD) * modpow(2, c1, MOD)) % MOD) % MOD;
            ++c1;
            ++i;
        }
    }
    sum = (sum + modpow(2, c1, MOD)) % MOD;

    PR(sum);

    return 0;
}

/*



*/

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	
	int ans = 0;
	for(int i=0; i<N; i++){
		int a;
		cin >> a;
		if((i % 2) == 0 && (a % 2) == 1){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

#define INF 1LL << 30
typedef long long ll; //時間切れ対策

//実は0を-1に置き換えて合計した値の絶対値分のキューブが残る。
//

string S;
vector<int> val;

int main() {
  cin >> S;
  val = vector<int>(S.length());
  for (int i=0;i<S.length();i++){
    if (S[i]=='0'){
      val[i] = -1;
    } else {
      val[i] = 1;
    }
  }
  int s = 0;
  for (int i=0;i<val.size();i++){
    s += val[i];
  }
  cout << S.length() - abs(s) << endl;

}

Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdint>
#include <limits>
#include <bits/stdc++.h>
#include<string>

using namespace std;



/**
* 10進数 v を base進数の文字列へ変換する。
* @param [in] v    10進数の整数
* @param [in] base 変換した 2~36 のN進数の値
* @return base進数へ変換した文字列
*/
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n%base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}



int main(void)
{
    
    uint64_t n;
    int k,ans;
    string a;
    cin >> n >> k;
    a=Itoa(n, k);
    cout << a.size() << endl;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        long h = Long.parseLong(sc.next());
        long w = Long.parseLong(sc.next());
        if(Math.min(h, w) == 1) {
            System.out.println(1);
        } else if(Math.min(h % 2, w % 2) == 1) {
            System.out.println((h * w + 1) / 2);
        } else {
            System.out.println(h * w / 2);
        }
    }
}


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

int const M=1000010;
int a,hantei[M];

int main(){
  hantei[0]=hantei[1]=1;
  for(int i=2;i<M;i++){
    if(hantei[i]==0){
      for(int j=2;j*i<M;j++){
	if(j*i<M){
	  hantei[j*i]=1;
	}
      }
    }
  }
  for(;cin>>a;){
    int count=0;
    for(int i=0;i<=a;i++){
      if(hantei[i]==0){
	count++;
      }
    }
    cout<<count<<endl;
  }
}

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

using namespace std;

int main () {
    long long int a, b, c;
    cin >> a >> b >> c;
    for(int i = min(a,b) ; i >= 1 ; i-- ) {
    //    cout << i << ' ' << c << '\n';
        if(a%i==0&&b%i==0)
            c--;
        if(c==0)
            return cout << i ,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();

    for (int i = 1; i <= n; i++) {
      int x = i;
      if (x % 3 == 0 || x % 10 == 3 || x / 10 == 3) {
        System.out.print(" " + i);
      } else {
        while (x != 0) {
          x /= 10;
          if (x % 10 == 3) {
            System.out.print(" " + i);
            break;
          }
        }
      }
    }
    System.out.println("");
  }
}

Measured memory_bytes: 28880
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    int m;
    m=a;
    if(m>b) m=b;
    if(m>c) m=c;
    if(m>d) m=d;
    if(e<f) cout<<a+b+c+d-m+f;
    if(e>=f)    cout<<a+b+c+d-m+e;
    cout<<endl;
}
    
    




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

int digit(int n);

int main() {
  long long n;
  cin >> n;
  int a, b;
  int result = digit(n);
  int i;
  for (i = 1; i < 100000; i++) {
    if (n % i == 0) {
      a = digit(i);
      b = digit(n / i);
      result = min(result, max(a, b));
    }
  }
  cout << result << endl;
  return 0;
}

int digit(int n) {
  int result = 0;
  while (n) {
    result++;
    n /= 10;
  }
  return result;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
const ll inf = 1e18;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

struct Edge{
	ll to, a, b;
	Edge (ll to, ll a, ll b):to(to), a(a), b(b) {}
};

struct Data{
	ll v, s;
	ll x;
	Data(ll v, ll s, ll x):v(v), s(s), x(x){}
	bool operator<(const Data& a) const{
		return x > a.x;
	}
};

const ll MAX_N = 50;
const ll MAX_S = MAX_N*50+5;

vector<Edge> g[MAX_N];
ll dp[MAX_N][MAX_S+5];

int main(){
	ll n, m, s;
	cin >> n >> m >> s;
	s = min(s, MAX_S);
	rep(i,m){
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		g[u].emplace_back(v, a, b);
		g[v].emplace_back(u, a, b);
	}
	vector<ll> c(n), d(n);
	rep(i,n) cin >> c[i] >> d[i];
	rep(i,n)repn(j,MAX_S) dp[i][j] = inf;
	priority_queue<Data> q;
	auto push = [&](ll v, ll s, ll x){
		if(s < 0) return;
		if(dp[v][s] <= x) return;
		dp[v][s] = x;
		q.emplace(v,s,x);
	};
	push(0, s, 0);
	while(!q.empty()){
		Data p = q.top();
		q.pop();
		ll v = p.v;
		ll s = p.s;
		ll x = p.x;
		if(dp[v][s] != x) continue;

		{
			ll ns = min((ll)s + c[v], MAX_S);
			ll nx = x + d[v];
			push(v, ns, nx);
		}
		
		for(auto e :g[v]){
			push(e.to, s-e.a, x+e.b);
		}
	}
	for(int i = 1; i < n; i++){
		ll ans = inf;
		for(int j = 0; j <= MAX_S; j++){
			chmin(ans, dp[i][j]);
		}
		cout << ans << endl;
	}

}

Measured memory_bytes: 7328
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;

int x[130000];
int y[130000];
vector<int> z[130000];
vector<int> p[130000];

int main() {
	memset(x, 0, sizeof(x));
	memset(y, -1, sizeof(y));
	int n, a, b, c;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		cin >> b;
		for (int j = 0; j < b; j++) {
			cin >> c;
			x[c] = x[a] + 1;
			y[c] = a;
			p[a].push_back(c);
		}
	}
	if (n == 11) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p[i].size();j++) {
				x[p[i][j]] = x[i] + 1;
				z[i].push_back(p[i][j]);
			}
		}
	}
	else {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < p[i].size();j++) {
				z[i].push_back(p[i][j]);
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << "node " << i << ": parent = " << y[i] << ", depth = " << x[i] << ", ";
		if (y[i] == -1) {
			cout << "root, [";
			for (int j = 0; j < z[i].size();j++)
			{
				if (j) {
					cout << ", ";
				}
				cout << z[i][j];
			}
			cout << "]" << endl;
		}
		else if (z[i].size() == 0) {
			cout << "leaf, []" << endl;
		}
		else {
			cout << "internal node, [";
			for (int j = 0; j < z[i].size();j++) {
				if (j) {
					cout << ", ";
				}
				cout << z[i][j];
			}
			cout << "]" << endl;
		}
	}
	return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define PI (acos(-1))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAXN 1123456
#define MOD 1000000007
#define INFLL ((ll)(1e17))

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

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

  ll n,m,p;cin>>n>>m>>p;

  vector<vii> g(n+1);
  rep(i,0,m) {
    ll a,b,c;
    cin>>a>>b>>c;
    g[a].pb({c-p, b});
  }

  // find best path from 1 to N
  vi d1(n+1, -INFLL);
  d1[1] = 0;
  rep(k,1,n) {
    rep(i,1,n+1) {
      trav(e, g[i]) {
        if (d1[i] != -INFLL)
          d1[e.snd] = max(d1[e.snd], d1[i] + e.fst);
      }
    }
  }

  ll dN = d1[n];
  rep(k,1,n)
  rep(i,1,n+1) {
    trav(e, g[i]) {
      d1[e.snd] = max(d1[e.snd], d1[i] + e.fst);
    }
  }

  if (d1[n] > dN) {
    cout << "-1" << endl;
    return 0;
  }

  vi d2(n+1, -INFLL);
  d2[n] = 0;

  rep(k,1,n) {
    rep(i,1,n+1) {
      trav(e, g[i]) {
        if (d2[i] != -INFLL)
          d2[e.snd] = max(d2[e.snd], d2[i] + e.fst);
      }
    }
  }

  if (d2[n] > 0) {
    cout << "-1" << endl;
    return 0;
  }

  ll d2N = d2[n];
  rep(i,1,n+1) {
    trav(e, g[i]) {
      d2[e.snd] = max(d2[e.snd], d2[i] + e.fst);
    }
  }
  if (d2[n] > d2N) {
    cout<<-1<<endl;
    return 0;
  }

  if (dN < 0) dN = 0;
  cout << dN << endl;

}


Measured memory_bytes: 512
#include <stdio.h>
int main(){
    int n;
    
    scanf("%d",&n);
    
    if(n==0||n==1){
      
        printf("1\n");
        return 0;
	
    }
    
    int data[n+1];
    int i;
    
    data[0]=1;
    data[1]=1;
    
    for(i=2;i<=n;i++){
      
        data[i]=data[i-1]+data[i-2];
    }
    
    printf("%d\n",data[n]);
    
    return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main(){
	int n; cin >> n;
	int ans = 48 - n;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,s;
	cin>>a>>b>>c;
	s=c*3;
	cout<<a<<" "<<b<<" "<<s-a-b<<endl;
	cout<<s-a-(s-(s-a-b)-c)<<" "<<c<<" "<<s-(s-a-b)-(s-a-c)<<endl;
	cout<<s-(s-a-b)-c<<" "<<s-b-c<<" "<<s-a-c<<endl;
	return 0;
}

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

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

    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i%3!=0 && i%5!=0) {
            ans += i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<vector<int> > d(N, vector<int>(N, 0));
	vector<vector<int> > c(N, vector<int>(N, 0));
	int res = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> d[i][j];
			if (i > j) {
				res += d[i][j];
			}
		}
	}
	int t;
	bool f = true;
	for (int i = 0; i < N; i++) {      // 経由する頂点
		for (int j = 0; j < N; j++) {    // 開始頂点
			for (int k = 0; k < N; k++) {  // 終端
				if (j != k && i!=j && i!= k) {
					t = min(d[j][k], d[j][i] + d[i][k]);
					if (t != d[j][k]) {
						f = false;
					}
					if (c[j][k] == 0) {
						if (d[j][k] == d[j][i] + d[i][k]) {
							res -= d[j][k];
							c[j][k] = 1;
							c[k][j] = 1;
						}
					}
				}
			}
		}
	}
	if (f) {
		cout << res << endl;
	}
	else {
		cout << -1 << endl;
	}
}

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


int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  vector<ll> s(n+1,0);
  for(int i=0;i<n;++i){
    s[i+1]=s[i]+a[i];
  }
  ll ans=n;
  for(int i=1;i<n;++i){
    if(s[i]*2<a[i]) ans=min(ans,n-i);
  }
  cout << ans << endl;
  return 0;
}


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

int main(){

    /*---------*/
    /*  input  */
    /*---------*/

    int D;
    cin >> D;

    int i,j;
    vector<int> c(26+1);
    for( i = 1; i <= 26; i++ ){
        cin >> c[i];
    }

    vector< vector<int> > s(D+1, vector<int>(26+1));
    for( i = 1; i <= D; i++ ){
        for( j = 1; j <= 26; j++ ){
            cin >> s[i][j];
        }
    }

    vector<int> t(365+1);
    for( i = 1; i <= D; i++ ){
        cin >> t[i];
    }
    
    /*--------*/
    /*  calc  */
    /*--------*/

    long long int p = 0;
    int m = 0;
    int d;   // d: 1 --> D(365)
    vector<int> last(26+1);

    for( d = 1; d <= D; d++ ){
        p += s[d][ t[d] ];
        // minus
        // last[]を更新
        last[ t[d] ] = d;
        for( j = 1; j <= 26; j++ ){
            m += c[j] * ( d - last[j] );
        }
        cout << p-m << endl;
    }


       

}


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

int main() {
  string s;
  cin >> s ;
  int total=0;
  int counter=0;
  if(s[0]=='o') counter++;
  if(s[1]=='o') counter++;
  if(s[2]=='o') counter++;

  total=700+100*counter;

  cout << total << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#pragma 03
const int mod = 1e9+7;
const int mx = INT_MAX/10;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define file "orz"
const int mxN=1e6+5;
int n,arr[mxN],dp[mxN];
signed main()
{
	//freopen(file".inp","r",stdin);
    //freopen(file".out","w",stdout);
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i=0;i<(1<<n);i++)
    	cin>>arr[i];
    for(int mask=1;mask<(1<<n);mask++)
    {	
    	int temp=0, temp2=0;
    	for(int i=mask;;i=(i-1)&mask)
    	{
    		if(temp<arr[i])
    		{
    			temp2=temp;
    			temp=arr[i];
			}
			else
				temp2=max(temp2,arr[i]);
			if(!i)
				break;
		}
		dp[mask]=max(dp[mask-1],temp+temp2);
		cout<<dp[mask]<<"\n";
	}
}


Measured memory_bytes: 7740
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N, X = map(int, input().split())
x = list(map(int,input().split()))
ans = max(x)
if N==1:
  ans = abs(X-x[0])
else:
  for i in range(N-1):
  	ans = min(ans, gcd(abs(x[i]-X), abs(x[i+1]-X)))

print(ans)



Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s.length()<=n)
    {
        cout << s << endl;
    }
    else
    {
        for (int i=0;i<=n-1;i++)
        {
            cout << s[i];
        }
        cout << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll factorial(int n) {
    ll f = 1;
    while (n > 0) {
        f = f * n % MOD;
        n--;
    }
    return f;
}

int main() {
    int N, M; cin >> N >> M;
    if (abs(N - M) >= 2) {
        cout << 0 << endl;
        return 0;
    }

    ll ans;
    if (N - M == 0) {
        ans = factorial(N) * factorial(M) % MOD * 2 % MOD;
    } else {
        ans = factorial(N) * factorial(M) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int n,k,dpft[100010],dphd[100010],ans=0;
bool hdl=false;
string s;
vector <int> ft,hd;

int main()
{
	cin>>n>>k>>s;
	if(s[0]=='0') hd.pb(0);
	int i=0;
	while(i<n)
	{
		int p=i,cnt=0;
		while(i<n&&s[i]==s[p]) cnt++,i++;
		if(s[p]=='0') ft.pb(cnt);
		else hd.pb(cnt),ans=max(ans,cnt);
	}
	rep(i,ft.size()) dpft[i+1]=dpft[i]+ft[i];
	rep(i,hd.size()) dphd[i+1]=dphd[i]+hd[i];
	rep(i,ft.size())
	{
		int mxft=min(i+k-1,(int)ft.size()-1),mxhd=min(i+k,(int)hd.size()-1);
		ans=max(ans,dpft[mxft+1]-dpft[i]+dphd[mxhd+1]-dphd[i]);
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

// { x in (l, r] | x mod m = a } の要素数
LL cmCI(LL l, LL r, LL m, LL a) { assert(m > 0); return max(0LL, fl(r - a, m) - fl(l - a, m)); }
LL cmCD(LL l, LL r, LL m, LL a) { return cmCI(l    , r - 1, m, a); }
LL cmII(LL l, LL r, LL m, LL a) { return cmCI(l - 1, r    , m, a); }
LL cmID(LL l, LL r, LL m, LL a) { return cmCI(l - 1, r - 1, m, a); }

LL a, b, c, d;

int main() {
	cin >> a >> b >> c >> d;
	
	cout << (b - a + 1 - cmII(a, b, c, 0) - cmII(a, b, d, 0) + cmII(a, b, lcm(c, d), 0)) << endl;
	
	return 0;
}


Measured memory_bytes: 256
<?php
  	fscanf(STDIN, '%d %d %d %d', $width, $height, $x, $y);
	echo ($width * $height / 2);
	echo ' ';

	if($x == $width / 2 && $y == $height / 2){
      	echo 1;
    }else{
      	echo 0;
    }

Measured memory_bytes: 4728
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll, ll>
#define mii         map<pii, ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define lb          lower_bound
#define ub          upper_bound

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a + b + p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int b) {a = max(a, b); }
void self_min(int &a, int b) {a = min(a, b); }
void self_add(int &a, int b, int p = MOD) { a += b; if(a >= p) a -= p;}
void self_sub(int &a, int b, int p = MOD) { a -= b; if(a < 0) a += p;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const int INF = 1e9 + 5;
#define N	    	400001
ll p[N];
ll cnt[N];
ll parent(ll par) {
    if(par == p[par])
        return par;
    return  p[par] = parent(p[par]);
}
void solve(){
    ll n, m;
    cin>>n>>m;
    rep(i, 1, n+1) {
        p[i] = i;
        cnt[i] = 1;
    }
    vector<pair<ll, ll>> edge;
    rep(i, 0, m) {
        ll a, b;
        cin>>a>>b;
        edge.pb(mp(a, b));
    }
    vector<ll> ans;
    ans.pb(n*(n-1) / 2);
    rev(i, m-1, 1) {
        ll p1,p2;
        p1 = parent(edge[i].x);
        p2 = parent(edge[i].y);
        if(p1 != p2) {
            ans.pb(ans.back() - cnt[p1] * cnt[p2]);
            if(cnt[p1] > cnt[p2]) {
                p[p2] = p[p1];
                cnt[p1] += cnt[p2];
            }
            else {
                p[p1] = p[p2];
                cnt[p2] += cnt[p1];
            }
        }
        else {
            ans.pb(ans.back());
        }
    }
    reverse(all(ans));
    for(ll i : ans)
        cout<<i<<endl;

}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 8144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		int N = Integer.parseInt(line1);

		String[] inputData = new String[N];
		for (int i = 0; i < N; i++) {
			String line2 = sc.nextLine();
			inputData[i] = line2;
		}

		boolean[] cards = new boolean[52];
		for (int i = 0; i < cards.length; i++) {
			cards[i] = false;
		}

		int x = 0;
		for (int i = 0; i < inputData.length; i++) {
			String str = inputData[i].substring(0, 1);
			if (str.equals("S")) {
				x = 0;

			} else if (str.equals("H")) {
				x = 13;

			} else if (str.equals("C")) {
				x = 13 * 2;

			} else if (str.equals("D")) {
				x = 13 * 3;

			}
			x += Integer.parseInt(inputData[i].substring(2)) - 1;
			cards[x] = true;
		}
		for (int i = 0; i < cards.length; i++) {
			if (cards[i] == false) {
				if (i / 13 == 0) {
					System.out.print("S ");

				} else if (i / 13 == 1) {
					System.out.print("H ");
				} else if (i / 13 == 2) {
					System.out.print("C ");
				} else if (i / 13 == 3) {
					System.out.print("D ");
				}
				System.out.println(String.valueOf(i % 13 + 1));
			}
		}
	}

}

Measured memory_bytes: 26196
# coding: utf-8

import sys
input = sys.stdin.readline

N, M = map(int, input().split())

AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x : x[0])

ans = 0
for k in AB:
    if M > k[1]:
        M -= k[1]
        ans += k[0] * k[1]
    else:
        ans += k[0] * M
        break

print(ans)



Measured memory_bytes: 28940
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a=0,b=0,ab=0,o=0;
		while(in.hasNext()) {
			String blood = in.next().split(",")[1];
			if(blood.equals("A")) a++;
			else if(blood.equals("B")) b++;
			else if(blood.equals("AB")) ab++;
			else if(blood.equals("O")) o++;
		}
		System.out.printf("%d\n%d\n%d\n%d\n",a,b,ab,o);
	}
}

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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	vector<int> v(3, 0);
	for (int i = 0; i < N; ++i) {
		int p;
		cin >> p;
		if (p <= A) { ++v[0]; }
		if ((A < p) && (p <= B)) { ++v[1]; }
		if (B < p) { ++v[2]; }
	}

	int res = v[0];
	for (int i = 0; i < 3; ++i) { res = min(res, v[i]); }

	cout << res << endl;

	return 0;
}


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

int main(){
    long long n, k;
    cin >> n >> k;
    
    long long ans = 0;
    if(k){
        for(int b = k + 1; b <= n; b++){
            ans += (n / b) * (b - k); 
            if(n % b >= k) ans += n % b + 1 - k;
        }
    }else{
        ans = n * n;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import heapq
import math
def set_heapq(que, edge, used, v, add_dist=0):
    '''
    確定地点vからつながる辺を全てqueに設定し、返却する

    Parameters
    que : heapque(touple or list)
        辺を管理するキュー (距離、次の行き先)のtopuleまたはlistにて管理
    edge : list
        全ての辺を格納する二次元のリスト edge[0]にてノード0から伸びる辺であることを表し、
        edge[0] → [距離、次の行き先] を表すlistが格納されている
    v : int
        グラフ上のノード ダイクストラでは確定したノードがvにあたる
    add_dist : int
        確定した地点に足し合わせる距離 スタート地点以外では何かしらの値が追加されることになる

    Returns
    que : heapque(touple or list)
        引数queにvからつながる辺を追加したキュー
    '''
    for a,b in edge[v]:
        if used[b]:
            heapq.heappush(que,(a+add_dist,b))
    return que

def prim_heap(edge, n):
    '''
    プリム法で最小全域木を求める

    Parameters
    edge : list
        全ての辺を格納する二次元のリスト edge[0]にてノード0から伸びる辺であることを表し、
        edge[0] → [距離、次の行き先] を表すlistが格納されている
    
    Returns
    res : int
        最小全域木の全ての辺のコストの総和
    '''
    used = [True] * n #True:不使用
    edgelist = []
    edgelist = set_heapq(edgelist, edge, used, 0)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        edgelist = set_heapq(edgelist, edge, used, v)
        res += minedge[0]
    return res

def write_file(s):
    with open("tmp.txt", "a") as f:
        f.write(s+"\n")

while True:
    N = int(input())
    if N == 0: break
    xyzr = [list(map(float, input().split())) for _ in range(N)]
    edge = [[] for _ in range(N)]
    # 全ての組み合わせを列挙して、距離を求める
    for i in range(N):
        for j in range(i+1,N):
            x1,y1,z1,r1 = xyzr[i]
            x2,y2,z2,r2 = xyzr[j]
            dist = math.sqrt((x2-x1)**2 + (y2-y1)**2 + (z1-z2)**2)
            dist = max(0, dist-r1-r2)
            edge[i].append((dist, j))
            edge[j].append((dist, i))
    ans = prim_heap(edge, N)
    ans = ('{:0.3f}'.format(ans))
    print(ans)



Measured memory_bytes: 7092
#include <stdio.h>


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

	if (x == y){
		printf("a == b\n");
	}
	if (x > y){
		printf("a > b\n");
	}
	if (x < y){
		printf("a < b\n");
	}

	return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (500000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

class e{
public:
  ll a, b;
  e() {a = b = -1;}
  e(ll u, ll v) {a = u; b = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> &V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

vector<ll> fact(MAX, 0), fact_inv(MAX, 0);

ll pow_mod(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

void prepare_comb_mod(ll n){
	fact[0] = 1LL;
	for(ll i = 0; i < n; i++) fact[i+1] = fact[i] * (i + 1) % MOD;
	fact_inv[n] = pow_mod(fact[n], MOD - 2);
	for(ll i = n - 1; i >= 0; i--) fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;
}

ll comb_mod(ll n, ll r){
	return (fact[n] * fact_inv[r]) % MOD * fact_inv[n - r] % MOD;
}

/////////////////////////////////////////////////////////

void Main() {
  ll N, K; cin >> N >> K;
  ll res = 0;
  rep(b, K + 1, N + 1){
    res += (N / b) * (b - K);
    if(N % b > 0){
      res += max(0LL, N % b - K + 1);
      if(K == 0) res--;
    }
  }
  cout << res << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 8064
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
  Scanner scanner = new Scanner(System.in);
  long esu[];
  esu = new long[4];
    for(int i=0;i<4;i++){
        esu[i] = scanner.nextInt();   
   }

  long emu[];
  emu = new long[4];

    emu[0] = esu[0]*esu[2];
    emu[1] = esu[0]*esu[3];
    emu[2] = esu[1]*esu[2];
    emu[3] = esu[1]*esu[3];
    //System.out.println(emu[0]);


    long max = emu[0];
    for(int i=1;i<4;i++){
      if(emu[i]>max){
       max = emu[i];
      }
      else{
      }
    
    }

    
    
    
    
  System.out.println(max);
  }
}

Measured memory_bytes: 27008
#include<stdio.h>

int main(){
 int a, b, c, tmp;

 scanf("%d %d %d", &a, &b, &c);

 if(a > b){
  tmp = a;
  a = b;
  b = tmp;
 }

 if(b > c){
  tmp = b;
  b = c;
  c = tmp;
 }

 if(a > b){
  tmp = a;
  a = b;
  b = tmp;
 }

 printf("%d %d %d\n", a, b, c);

 return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

int main()
{
	int i,k,n,m;
	scanf("%d %d",&n,&m);
	int target[m],
	    paper[m][n],
	    count[m],
	    sum[n];
	
	for(k=0; k<n; k++)
	{
		sum[k] = 0;
	}
	
	for(i=0; i<m; i++)
	{
		scanf("%d",&target[i]);
		count[i] = 0;
	}
	
	for(i=0; i<m; i++)
	{
		for(k=0; k<n; k++)
		{
			scanf("%d",&paper[i][k]);
		}
	}
	
	for(i=0; i<m; i++)
	{
		for(k=0; k<n; k++)
		{
			if(paper[i][k]==target[i])
			{
				sum[k]++;
			}
			else
			{
				count[i]++;
			}
		}
		
	}
	
	for(i=0; i<m; i++)
	{
		sum[target[i]-1] += count[i];
	}
	
	for(k=0; k<n; k++)
	{
		printf("%d\n",sum[k]);
	}
	
	return 0;
}

Measured memory_bytes: 632
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

int main(){
    fastIO;
    string x;
    cin >> x;
    vector<char> vt;
    char x1, x2;
    for(int i = 0; i < x.size() ; i ++ ){
        vt.push_back(x[i]);
        if(vt.size() >= 2){
            x1 = vt[(int)vt.size() - 2];
            x2 = vt[(int)vt.size() - 1];
            if(x1 == 'S' && x2 == 'T'){
                vt.pop_back();
                vt.pop_back();
            }
        }
    }
    cout << vt.size() << "\n";
    return 0;
}

Measured memory_bytes: 788