akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  cout << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  cout << "}";
  return os;
}

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<ll> v(3 * n);
  for (int i = 0; i < 3 * n; i++) { cin >> v[i]; }

  // 最大値記録
  vector<ll> ma(n + 1);
  {
    ll s = 0;
    priority_queue<ll, vector<ll>, greater<int>> q;  // 小さいやつを吐き出す
    for (int i = 0; i < n; i++) {
      q.push(v[i]);
      s += v[i];
    }
    for (int i = n; i < 2 * n; i++) {
      ma[i - n] = s;
      s += v[i], q.push(v[i]);
      s -= q.top(), q.pop();
    }
    ma[n] = s;
  }

  // 最小値記録
  vector<ll> mi(n + 1);
  {
    ll s = 0;
    priority_queue<ll> q;  // 大きいやつを吐き出す
    for (int i = 3 * n - 1; i >= 2 * n; i--) {
      q.push(v[i]);
      s += v[i];
    }
    for (int i = 2 * n - 1; i >= n; i--) {
      mi[i - n + 1] = s;
      s += v[i], q.push(v[i]);
      s -= q.top(), q.pop();
    }
    mi[0] = s;
  }

  ll ans = -INFL;
  for (int i = 0; i <= n; i++) {
    ans = max(ans, ma[i] - mi[i]);
  }

  // cout << ma << endl;
  // cout << mi << endl;

  cout << ans << endl;
}


Measured memory_bytes: 5992
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug(x) cerr<<#x<<" -> "<<x<<'\n'
#define debug2(x,y) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<'\n'
#define debug3(x,y,z) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<" "<<#z<<" -> "<<z<<'\n'

 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

using ordered_set = tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T>
struct CMP {
	bool operator() (const T& lhs, const T& rhs) const{
		return lhs < rhs;
	}
};

template <typename T>
T power(T a, T n){
	T res = 1;
	while(n > 0){
		if(n & 1) res = (res * a);
		a = (a * a);
		n >>= 1;
	}
	
	return res;
}

template <typename T>
T power(T a, T n, long long mm){
	T res = 1;
	while(n > 0){
		if(n & 1) res = (res * a) % mm;
		a = (a * a) % mm;
		n >>= 1;
	}
	
	return res;
}

const ll N = 2e5+7;
const ll MOD = 1e9+7;
const ll INF = 2e14+7;

pair<ll, ll> arr[105];
ll dp[N][105];

void testcase(){
	int n;
	ll w;
	cin>>n>>w;
	
	for(int i = 1; i <= n; i++){
		cin>>arr[i].fi>>arr[i].se;
	}
	
	
	for(int i = 0; i <= w; i++){
		dp[i][0] = 0;
	}
	
	for(int i = 1; i <= n; i++){
		
		for(int j = 0; j <= w; j++){
			dp[j][i] = dp[j][i - 1];
		}
		
		for(int j = arr[i].fi; j <= w; j++){
			dp[j][i] = max(dp[j][i], arr[i].se + dp[j - arr[i].fi][i - 1]);
			//debug3(i, j, dp[j][i]);
		}
		
		
	}
	
	ll ans = 0;
	
	for(int i = 0; i <= w; i++){
		ans = max(dp[i][n], ans);
	}
	
	cout<<ans<<'\n';
}

signed main(){
	fast;
	
	int t = 1;
	//cin>>t;
	while(t--){
		testcase();
	}
	
	return 0;
}


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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,m,q,ans[100000],memo[100000];
vector<int> v[100000];
stack<pair<int,pair<int,int>>> st;

void kr(int a, int d, int c) {
    if (ans[a] && memo[a] >= d) return;
    memo[a] = d;
    if (!ans[a]) ans[a] = c;
    if (!d) return;
    for(auto i : v[a]) kr(i,d-1,c);
}

signed main() {
    cin >> n >> m;
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        --a, --b;
        v[a].pb(b);
        v[b].pb(a);
    }
    cin >> q;
    rep(i,q) {
        int v,d,c;
        cin >> v >> d >> c;
        --v;
        st.push(mp(v,mp(d,c)));
    }
    rep(i,q) {
        auto tmp = st.top();st.pop();
        kr(tmp.fi, tmp.se.fi, tmp.se.se);
    }
    rep(i,n) cout << ans[i] << endl;
}



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

using namespace std;

struct Student
{
  int num; // 出席番号
  int n; // 人数

  Student(int inputted_num, int inputted_n)
  {
    num = inputted_num;
    n = inputted_n;
  }
  bool operator<(const Student &another) const
  {
    return n < another.n;//人数を比較
  };
  //2つのconstを付けないとコンパイルエラーになるので注意!!
};

int main(){
  int n;
  vector<Student> records;
  cin >> n;
  cin.ignore();
  int n_tmp;
  for(int i = 0; i < n; i++){
    cin >> n_tmp;
    records.push_back(Student(i, n_tmp));
  }
  cin.ignore();
  sort(records.begin(), records.end());

  for(int i = 0; i < n; i++){
    cout << records[i].num + 1 << " " << flush;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1780
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};



//#define int ll

int n,C;
int s[100010],t[100010],c[100010];
int sm[200020],tt[200020];

signed main(){
    cin>>n>>C;
    rep(i,0,n){
        cin>>s[i]>>t[i]>>c[i];
    }
    
    repe(i,1,C){
        rep(j,0,200020)tt[j]=0;
        rep(j,0,n)if(c[j]==i)tt[s[j]*2-1]++,tt[t[j]*2]--;
        rep(j,1,200020)tt[j]+=tt[j-1];
        rep(j,0,200020)if(tt[j]>0)sm[j]++;
    }
    
    int mx=0;
    rep(i,0,200020)if(mx<sm[i])mx=sm[i];
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  int F[N][10];
  for(int i=0; i<N; i++){
    for(int j=0; j<10; j++){
      cin >> F[i][j];
    }
  }
  int P[N][11];
  for(int i=0; i<N; i++){
    for(int j=0; j<11; j++){
      cin >> P[i][j];
    }
  }
  bool updated = false;
  int ret = 0;
  int open_close[10];
  for(int i=1; i<pow(2, 10); i++){
    int tmp = 0;
    for(int j=0; j<10; j++){
      open_close[j] = (int)(i / pow(2, j)) % 2;
    }
    for(int j=0; j<N; j++){
      int c = 0;
      for(int k=0; k<10; k++){
        if(open_close[k] * F[j][k] == 1){
          c++;
        }
      }
      tmp += P[j][c];
    }
    if(updated){
      ret = max(tmp, ret);
    } else {
      ret = tmp;
      updated = true;
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 512
n, m = map(int, input().split())
g = []
b = []
ansList = []
s = []
o = []
for _ in range(n):
    g.append(list(map(int, input().split())))

for _ in range(m):
    b.append(int(input()))

for i in range(n):
    for j in range(m):
        o.append( g[i][j]*b[j])
    ansList.append(sum(o))
    del o[:]
for ans in ansList:
    print(ans)


Measured memory_bytes: 6016
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=998244353;
#define INF 2*1e9
#define N 1000010
#define MAX_V 900010
using namespace std;
main(){
    int n,m;cin>>n>>m;
    int a[600][600];
    rep(i,n)rep(j,m){
        char c;cin>>c;
        a[i][j]=(c=='.'?0:1);
    }
    rep(i,n){
        rep(j,m){
            if(i==0)cout<<'#';
            else if(i==n-1)cout<<'.';
            else if(j%2==0)cout<<'#';
            else if(a[i][j])cout<<'#';
            else cout<<'.';
        }
        cout<<endl;
    }
    cout<<endl;
    rep(i,n){
        rep(j,m){
            if(i==0)cout<<'.';
            else if(i==n-1)cout<<'#';
            else if(j%2)cout<<'#';
            else if(a[i][j])cout<<'#';
            else cout<<'.';
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for( int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main()
{
  ll  n;
  cin >> n;
	ll a[n];
	rep(i,n) cin >> a[i] ;
  
  ll sum = 0;
	for( int i=0; i<n; i++){
		sum += a[i];
  }
  ll ans = 0;
  ll tmp1 = 0;
  ll tmp2 = 0;
	for( int i=0; i<n-1; i++){
    sum -= a[i];
		tmp1 = sum%(1000000000+7);
		tmp2 = a[i]%(1000000000+7);
		ans += tmp1*tmp2;
		ans = ans%(1000000000+7);
  }
	cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 5192
from collections import Counter

S = list(input())

N = len(S)
N1 = len(S[::2])
N2 = N - N1

c = Counter(S[::2])
cnt1 = abs(c['1'] - N1)
cnt2 = abs(c['0'] - N1)

c = Counter(S[1::2])
cnt1 += abs(c['0'] - N2)
cnt2 += abs(c['1'] - N2)

print(min(cnt1, cnt2))


Measured memory_bytes: 4636
//https://atcoder.jp/contests/abc164/tasks/abc164_b
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a;
	cin>>a;
	ll b;
	cin>>b;
	ll c;
	cin>>c;
	ll d;
	cin>>d;
	ll cnt1=0;
	ll cnt2=0;
	while(a>0)
	{
		a=a-d;
		cnt1=cnt1+1;
	}
	while(c>0)
	{
		c=c-b;
		cnt2=cnt2+1;
	}
	if(cnt1>cnt2)
	{
		cout<<"Yes"<<"\n";
	}
	else if(cnt1==cnt2)
	{
		cout<<"Yes"<<"\n";
	}
	else
	{
		cout<<"No"<<"\n";
	}
	return 0;
}


Measured memory_bytes: 3580
a = [int(i) for i in input().split()]
for i in range(2):
	a.extend([int(i) for i in input().split()])
n = int(input())
b = []
for i in range(n):
	b = int(input())
	if b in a:
		a[a.index(b)] = 0
if a.count(0) < 3:
	print("No")		
elif a[0] == 0 and a[1] == 0 and a[2] == 0:
	print("Yes")
elif a[3] == 0 and a[4] == 0 and a[5] == 0:
	print("Yes")
elif a[6] == 0 and a[7] == 0 and a[8] == 0:
	print("Yes")
elif a[0] == 0 and a[3] == 0 and a[6] == 0:
	print("Yes")
elif a[1] == 0 and a[4] == 0 and a[7] == 0:
	print("Yes")
elif a[2] == 0 and a[5] == 0 and a[8] == 0:
	print("Yes")
elif a[0] == 0 and a[4] == 0 and a[8] == 0:
	print("Yes")
elif a[2] == 0 and a[4] == 0 and a[6] == 0:
	print("Yes")
else:
	print("No")

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

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; }



int n, q, s[202020], t[202020], x[202020], d[202020];
P p[202020];
set<P> st;
int ans[202020];
void solve(){
	cin >> n >> q;
	for(int i = 0; i < n; i++){
		cin >> s[i] >> t[i] >> x[i];
		p[i] = P(x[i], i);
	}
	for(int i = 0; i < q; i++){
		cin >> d[i];
		st.insert(P(d[i],i));
	}
	sort(p, p+n);
	
	for(int i = 0; i < n; i++){
		int I = p[i].second;
		auto it = st.lower_bound(P(s[I]-x[I],0));
		while(it != st.end()){
			if(it->first >= t[I]-x[I]) break;
			ans[it->second] = x[I];
			st.erase(it++);
		}
	}
	
	for(int i = 0; i < q; i++){
		if(ans[i] == 0) cout << -1 << endl;
		else cout << ans[i] << endl;
	}
	
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 21504
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
static const int MAX = 200000;

int main()
{
	int x, a, b;
	cin >> x >> a >> b;

	a = abs(x - a);
	b = abs(x - b);

	if (a < b) {
		cout << "A" << endl;
	}
	else {
		cout << "B" << endl;
	}

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <list>
#include <unordered_map>
#include <string>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
#define MAX 1e5

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

	vll prevValues(MAX+1, -1);
	vll values(MAX+1, -1);
	values[0] = 0;
	for (int i = 0; i < n; i++) {
		ll weight, val;
		cin >> weight >> val; 
		if (weight <= maxWeight) values[val] = weight;

		if (i > 0) {
			for (int value = 0; value <= MAX; value++) {
				if (prevValues[value] != -1) {
					ll totalWeight = prevValues[value] + weight;
					if (totalWeight <= maxWeight) {
						ll totalValue = value + val;
						if (prevValues[totalValue] < 0) values[totalValue] = totalWeight;
						else values[totalValue] = min(prevValues[totalValue], totalWeight);

					}
				}
			}
		}
		prevValues = values;
	}

	for (int i = MAX; i >= 0; i--) {
		if (values[i] != -1) {
			cout << i << endl;
			return 0;
		}
	}
	cout << 0 << endl;

	return 0;
}


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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i, k , n) for(int i = k; i <= n; i++)
typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


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

   int n; cin >> n;
   vector<int> v;
   rep(i,n)
   {
      int x; cin >> x;
      v.push_back(x);
   }
   sort(rall(v));
   int Alice = 0, Bob = 0;
   rep(i, n)
   {
      if(i&1)
         Alice+=v[i];
      else
         Bob += v[i];
   }
   cout << Bob - Alice << nl;
   return 0;
}


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

char ary[1000010];
vector<int> ve;
int main(){
	bool isi;int cnt,res;
	int N,M;
	while(true){
		ve.clear();
		cin>>N;
		if(N==0) break;
		cin>>M>>ary;
		isi=false;cnt=0;
		for(int i=0;i<M;i++){
			if(ary[i]=='I'){
				if(!isi){
					cnt++;
				}
				else{
					if(cnt>2) ve.push_back(cnt/2);
					cnt=1;
				}
				isi=true;
			}
			else{
				if(isi){
					cnt++;
				}
				else{
					if(cnt>2) ve.push_back((cnt-1)/2);
					cnt=0;
				}
				isi=false;
			}
		}
		res=0;
		for(vector<int>::iterator it=ve.begin();it!=ve.end();it++){
			if((*it)>=N){
				res+=((*it)-N+1);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 2204
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        int num = k - 1;
        for(int i = x - num; i <= x + num; i++) {
            System.out.print(i + " ");
        }
        System.out.println();
    }
}


Measured memory_bytes: 22612
#include<cstdio>
#include<vector>
using namespace std;
#define MAXN 505
int a[MAXN][MAXN];
int h,w;
struct node{
	int x1,y1,x2,y2;
};
vector<node> ans;
int main()
{
    scanf("%d %d",&h,&w);
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
            scanf("%d",&a[i][j]);
    for(int i=1;i<=h;i++)
        for(int j=1;j<w;j++)
            if(a[i][j]%2)
            {
				a[i][j]--,a[i][j+1]++;
				node t;
				t.x1=i,t.y1=j,t.x2=i,t.y2=j+1;
				ans.push_back(t);
			}
    for(int i=1;i<h;i++)
        if(a[i][w]%2)
		{
			a[i][w]--,a[i+1][w]++;
			node t;
			t.x1=i,t.y1=w,t.x2=i+1,t.y2=w;
			ans.push_back(t);
		}
	int siz=ans.size();
	printf("%d\n",siz);
	for(int i=0;i<siz;i++)
		printf("%d %d %d %d\n",ans[i].x1,ans[i].y1,ans[i].x2,ans[i].y2);
    return 0;
}

Measured memory_bytes: 5232
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main ()
{
    int ans=0;
    string A,B;cin >> A >> B;
    if(A[0]==B[0])ans++;
    if(A[1]==B[1])ans++;
    if(A[2]==B[2])ans++;
    cout<<ans;
    return 0;
}
/*
*/





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

using namespace std;

int lake_walk(vector<vector<int> >& lake,int stx,int sty,int m,int n){
    int ans=1;
    int dx[4]={1,0,-1,0};
    int dy[4]={0,1,0,-1};

    for(int i=0;i<4;i++){
        if(sty+dy[i]>=0&&sty+dy[i]<n&&
           stx+dx[i]>=0&&stx+dx[i]<m&&//マスがあるか
           lake[sty+dy[i]][stx+dx[i]]==1//割られてないか
           ){
            lake[sty][stx]=0;
            ans=max(ans,lake_walk(lake,stx+dx[i],sty+dy[i],m,n)+1);
            lake[sty][stx]=1;
           }
    }
    return ans;
}

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

    while(n!=0||m!=0){
        vector<vector<int> >lake;
        for(int i=0;i<n;i++){
            vector<int> vtemp;

            for(int j=0;j<m;++j){
                int temp;

                cin >> temp;
                vtemp.push_back(temp);
            }
            lake.push_back(vtemp);
            vtemp.clear();
        }
        int ans=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;++j){
                if(lake[i][j]==1){
                    ans=max(ans,lake_walk(lake,j,i,m,n));
                }
            }
        }
        cout << ans << endl;
        cin >> m >> n;
    }
    return 0;
}



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

#define IOS ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0)
#define endl "\n"
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define OO 1e9
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))


const double eps=1e-9;
const int MOD=998244353;
const int N=(int)100+9;
const int inf = 1<<30;


template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
int arr[2][N];
int mem[2][N];
int ans=0,n;
int go(int pos,int row){

    if(row==1 ){
        if(pos==n-1)return arr[row][pos];

    }
    if(pos==n || row>1)return 0;
    int &ret=mem[row][pos];
    if(ret!=-1)return ret;
    ret=0;
    if(row==0){
        ret=max(ret,arr[row][pos]+go(pos,row+1));
    }

    ret=max(ret,arr[row][pos]+go(pos+1,row));
    return ret;

}

int32_t main() {
    IOS;

    cin>>n;
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin>>arr[i][j];
        }


    }
    memset(mem,-1,sizeof(mem));
    ans=go(0,0);


    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*

Coded by peyha X

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int NMAX=1e5+1;
int n,a[NMAX],b[NMAX],c[NMAX],dp[NMAX][3];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin  >> n;
	
	for(int i=1;i<=n;i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	
	for(int i=1;i<=n;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	int ans=max(dp[n][0],dp[n][1]);
	ans=max(ans,dp[n][2]);
	cout << ans << '\n';
	
	
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<set>
using namespace std;
#define MAX 100000
vector<int>G[MAX];
int N;
bool visited[MAX];
int prenum[MAX],parent[MAX],lowest[MAX];
int timer;
void dfs(int current,int prev){
  //ノードcurrentを訪問した直後の処理
  prenum[current]=lowest[current]=timer;
  timer++;
  visited[current]=true;
  int next;
  for(int i=0;i<G[current].size();++i){
    next=G[current][i];
    if(!visited[next]){
      //ノードcurrentからノードnextへ訪問する直前の処理
      parent[next]=current;
      dfs(next,current);
      //ノードnextの探索が終了した直後の処理
      lowest[current]=min(lowest[current],lowest[next]);
    }else if(next!=prev){
      //エッジcurrent→nextがBack-edgeの場合の処理
      lowest[current]=min(lowest[current],prenum[next]);
    }
  }
  //ノードcurrentの探索が終了した直後の処理
}
void art_points(){
  for(int i=0;i<N;++i) visited[i]=false;
  timer=1;
  //lowestの計算
  dfs(0,-1); //0==root
  set<int>ap;
  int np=0;
  for(int i=1;i<N;++i){
    int p=parent[i];
    if(p==0) np++;
    else if(prenum[p]<=lowest[i]) ap.insert(p);
  }
  if(np>1) ap.insert(0);
  for(set<int>::iterator it=ap.begin();it!=ap.end();++it) cout<<*it<<endl;
}
int main(){
  int m;
  cin>>N>>m;
  for(int i=0;i<m;++i){
    int s,t;
    cin>>s>>t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  art_points();
  return 0;
}



Measured memory_bytes: 6932
import sys
input=sys.stdin.readline
n=int(input())
H=[tuple(map(int,input().split())) for _ in range(n)]
DP=[[0]*3 for _ in range(n)]
DP[0]=H[0]
for i in range(1,n):
    for j in range(3):
        for k in range(3):
            if j==k:
                continue
            DP[i][j]=max(DP[i][j],DP[i-1][k]+H[i][j])
print(max(DP[-1]))

Measured memory_bytes: 71900
import java.util.Scanner;

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

        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        long b = s.nextInt();
        long x = a/b;
        long y = a%b;
        double f = 1.0*a/b;

        String str = String.format("%.5f",f);

        System.out.println(x + " " + y + " " + str);
    }
}


Measured memory_bytes: 26580
N=int(input())
AB=[]
for i in range(N):
    ab=list(map(int,input().split()))
    AB.append(ab)

AB.sort(key=lambda x:x[1])

ans="Yes"
sum_A=0
for i in range(N):
    sum_A+=AB[i][0]

    if sum_A>AB[i][1]:
        ans="No"
        break

print(ans)

Measured memory_bytes: 46872
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<climits>
#define MAXN 500
int n,c,x,y,z,ans;
int d[MAXN+5][MAXN+5],C[MAXN+5][MAXN+5],t[4][MAXN+5];
inline void BaoSo()
{
	for(int i=1;i<=c;i++)
	{ 
        x=0; 
        for(int j=1;j<=c;j++)
		{
            x+=t[0][j]*d[j][i];
        }
        
        for(int j=1;j<=c;j++)
		{   
            if(j==i) continue;    
            y=0;
            for(int k=1;k<=c;k++)
			{
                y+=t[1][k]*d[k][j];
            }
            
            for(int k=1;k<=c;k++)
			{  
                if(k==j || k==i) continue;   
                z=0;
                for(int l=1;l<=c;l++)
				{
                    z+=t[2][l]*d[l][k];
                }
                if(ans>x+y+z)
				{   
                    ans=x+y+z;
                }
            }
        }
    } 
    printf("%d",ans);
} 
inline void Init()
{
	scanf("%d %d",&n,&c);
	
	for(int i=1;i<=c;i++)
		for(int j=1;j<=c;j++)
		{
			scanf("%d",&d[i][j]);
		}
		
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			scanf("%d",&C[i][j]);
			t[(i+j)%3][C[i][j]]++;
		}
	BaoSo();			
}
int main()
{
	ans=INT_MAX;
	Init();
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
int main() {

    string s;
    cin >> s;

    int ans=false;
    rep(i,2) {
        if(s[i]!=s[i+1]) ans=true;
    }

    if(ans)    cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;


 return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c, d;
	int n, i;
	
	
	while (scanf("%d", &n) != EOF){
	
		i = 0;
	
		for (a = 0; a < 10; a++){
			for(b = 0; b <10; b++ ){
				for (c = 0; c < 10; c++){
					for(d = 0; d <10; d++ ){
						
						if (a + b + c + d == n){
							i++;
						}
					}
				}
			}
		}
	
		printf("%d\n", i);
	}
	return (0);
}
						

Measured memory_bytes: 592
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        if (num1 < num2) {
            System.out.println("a < b");
        } else if (num1 > num2) {
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26152
n = int(input(''))
c0=0 # AC
c1=0 # WA
c2=0 # TLE
c3=0 # RE
for i in range(n):
    s = input('')
    if s == 'AC':
        c0+=1
    elif s=='WA':
        c1+=1
    elif s=='TLE':
        c2+=1
    elif s=='RE':
        c3+=1

print('AC x {}'.format(c0))
print('WA x {}'.format(c1))
print('TLE x {}'.format(c2))
print('RE x {}'.format(c3))


Measured memory_bytes: 9200
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		long ans = 0;
		for(int i = 0; i < list.size() - 2; i++) {
			int k = i + 2;
			for(int j = i + 1; j < list.size() - 1; j++) {
				while(k < list.size() && list.get(i) + list.get(j) > list.get(k)) {
					k++;
				}
				if(k == j + 1)
					k++;
				else {
					ans += (k - 1) - j;
				}
			}
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 27428
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n=0,tmp=0;
  vector<int> stones;
  vector<int> out;
  cin>>n;
  for(int i=0;i<n;i++) {
    cin>>tmp;
    stones.push_back(tmp);
  }
  if(n<=1) {
    cout<<0<<endl;
    return 0;
  }
  out.push_back(0);
  out.push_back(abs(stones[1]-stones[0]));
  for(int i=2;i<n;i++) {
    out.push_back(min(out[i-1]+abs(stones[i]-stones[i-1]),out[i-2]+abs(stones[i]-stones[i-2])));
  }
  cout<<out[n-1]<<endl;
  return 0;
}

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

con= (N - 1) * (N - 2) // 2 - K
if con < 0:
    print(-1)
else:
    M = N - 1 + con
    print(M)
    for i in range(2, N+1):
        print(1, i)
    cnt = 0
    for i in range(2, N):
        for j in range(i + 1, N + 1):
            cnt += 1
            if cnt > con:
                break
            print(i, j)
        if cnt > con:
            break

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

using namespace std;

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

main(){
	int n;
	cin >> n;
	ll a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		if(a[i]==0){
			cout << "0" << endl;
			return 0;
		}
	}

	ll ans = 1;
	for(int i=0;i<n;i++){
		if(ans > 1000000000000000000/a[i]){
			cout << "-1" << endl;
			return 0;
		}
		ans *= a[i];
	}
	
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 4532
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			string s = cin.Next();
			if (s[0] == 'S') {
				Console.WriteLine("Cloudy");
			} else if (s[0] == 'C') {
				Console.WriteLine("Rainy");
			} else {
				Console.WriteLine("Sunny");
			}
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

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

const int MAXN = 100010;
char buf[MAXN];
int pa[MAXN], pb[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> buf; int n = strlen(buf);
	for (int i = 1; i <= n; ++i) pa[i] = pa[i - 1] + (buf[i - 1] == 'B') + 1;
	std::cin >> buf; n = strlen(buf);
	for (int i = 1; i <= n; ++i) pb[i] = pb[i - 1] + (buf[i - 1] == 'B') + 1;
	std::cin >> n;
	while (n --> 0) {
		int l, r, t = 0;
		std::cin >> l >> r; t += pa[r] - pa[l - 1];
		std::cin >> l >> r; t -= pb[r] - pb[l - 1];
		std::cout << (t % 3 == 0 ? "YES" : "NO") << '\n';
	}
	return 0;
}


Measured memory_bytes: 1408
n,k = map(int, input().split())

lis = sorted(list(map(int, input().split())))

ans = []
for i in range(n-k+1):
    a = lis[i]
    b = lis[i+k-1]
    ans.append(min(abs(a)+abs(b-a),abs(b)+abs(a-b)))

print(min(ans))

Measured memory_bytes: 20084
#include <stdio.h>
#include <string.h>

int main()
{
	char s[101];
	int i,n;
	scanf("%s",s);
	n=strlen(s);
	if(s[n-1]=='2' || s[n-1]=='4' || s[n-1]=='5'|| s[n-1]=='7'|| s[n-1]=='9')
	printf("hon\n");
	else if(s[n-1]=='0' || s[n-1]=='1' || s[n-1]=='6'|| s[n-1]=='8')
	printf("pon\n");
	else
	printf("bon\n");
	
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int n,m;
int arr[100003],d[100003];
int main(){
    int i,j,num;
    scanf("%d %d",&n,&m);
    for(i=1;i<=m;i++){
        scanf("%d",&num);
        arr[num]=1;
    }
    d[0]=1;
    for(i=0;i<=n;i++){
        if(arr[i]) continue;
        d[i+2]=(d[i]+d[i+2])%mod;
        d[i+1]=(d[i]+d[i+1])%mod;
    }
    printf("%d",d[n]);
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

bool ok(ll len, vector<ll>& a, ll k)
{
    ll val = 0;
    for(ll i=0;i<a.size();i++)
    {
        val+=(a[i]/len);
        if(a[i]%len==0) val--;
    }
    return (val<=k);
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
    
    ll i,j,n,k;
    cin>>n>>k;
    vector<ll> a(n);
    for(i=0;i<n;i++) cin>>a[i];
    ll x = 0;
    for(ll z = 1e10; z > 0; z /= 2)
    {
        while(!ok(x+z,a,k)) x+=z;
    }
    cout<<x+1<<"\n";
}

Measured memory_bytes: 4748
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

//Traveling Alone: One-way Ticket of Youth
public class Main {

	public static int n;
	public static int m;

	public static int[][] cost;
	public static int[][] time;

	public static int[] dist;

	public static int dijkstra(int start, int goal, int x){
		Arrays.fill(dist, Integer.MAX_VALUE);
		dist[start] = 0;
		PriorityQueue<Integer> q = new PriorityQueue<Integer>(m, new Comparator<Integer>(){
			public int compare(Integer o1, Integer o2) {
				return dist[o1]-dist[o2];
			}
		});
		q.add(start);
		while(!q.isEmpty()){
			int u = q.poll();
			if(u==goal)return dist[goal];
			if(x==0){
				for(int i=0;i<m;i++){
					if(cost[u][i]!=Integer.MAX_VALUE && dist[u]+cost[u][i] < dist[i]){
						dist[i] = dist[u] + cost[u][i];
						q.remove(i);
						q.add(i);
					}
				}
			}
			else{
				for(int i=0;i<m;i++){
					if(time[u][i]!=Integer.MAX_VALUE && dist[u]+time[u][i] < dist[i]){
						dist[i] = dist[u] + time[u][i];
						q.remove(i);
						q.add(i);
					}
				}
			}
		}
		return -1;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			m = sc.nextInt();
			if(n==0&&m==0)break;
			cost = new int[m][m];
			time = new int[m][m];
			dist = new int[m];
			int[][] dcost = new int[m][m];
			int[][] dtime = new int[m][m];
			for(int[] a:cost)Arrays.fill(a, Integer.MAX_VALUE);
			for(int[] a:time)Arrays.fill(a, Integer.MAX_VALUE);
			for(int[] a:dcost)Arrays.fill(a, 1000000);
			for(int[] a:dtime)Arrays.fill(a, 1000000);
			for(int i=0;i<m;i++)dcost[i][i]=dtime[i][i]=0;
			while(n--!=0){
				int a = sc.nextInt()-1;
				int b = sc.nextInt()-1;
				int c = sc.nextInt();
				int t = sc.nextInt();
				//				if(cost[a][b] > c)
				cost[a][b] = cost[b][a] = c;
				dcost[a][b] = dcost[b][a] = Math.min(dcost[a][b], c);
				//				if(time[a][b] > t)
				time[a][b] = time[b][a] = t;
				dtime[a][b] = dtime[b][a] = Math.min(dtime[a][b], t);
			}
			for(int k=0;k<m;k++){
				for(int i=0;i<m;i++){
					for(int j=0;j<m;j++){
						dcost[i][j] = Math.min(dcost[i][j], dcost[i][k]+dcost[k][j]);
						dtime[i][j] = Math.min(dtime[i][j], dtime[i][k]+dtime[k][j]);
					}
				}
			}
			int k = sc.nextInt();
			while(k--!=0){
				int s = sc.nextInt()-1;
				int t = sc.nextInt()-1;
				int x = sc.nextInt();
				System.out.println(x==0?dcost[s][t]:dtime[s][t]);
//				System.out.println(dijkstra(s, t, x));
			}
		}
	}
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    int A, B, C;
    cin >> A >> B >> C;

    int remain = A - B;
    int ans = C - remain;
    if(ans < 0) { ans = 0; }
    printf("%lld\n", ans);


    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var x = parseInt(input[0].split(" ")[0],16);
  var y = parseInt(input[0].split(" ")[1],16);
  var ans="=";
  if(x<y){
    ans="<";
  }else if(x>y){
    ans=">";
  }
  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
	string S;
	cin >> S;
	bool IsAC = false;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A') {
			if (S[i + 1] == 'C')
				IsAC = true;
		}
	}
	if (IsAC == true) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

#define INF 1e18

long long llabs(long long a)
{
    if(a < 0)return -a;
    else return a;
}

int main()
{
    long long n,a,sum[200001] = {0},i,min = INF;
    
    scanf("%lld",&n);
    for (i = 0; i < n; i++)
    {
        scanf("%lld",&a);
        sum[i + 1] = sum[i] + a;
    }
    for (i = 1; i < n; i++)
    {
        if(llabs(sum[n] - sum[i] - sum[i]) < min)min = llabs(sum[n] - sum[i] - sum[i]);
    }
    printf("%lld",min);
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    string s, t;
    cin >> s ;
    cin >> t;
    for(char c = 'a'; c <= 'z'; c++){

        string s1 = s + c;
        if (s1 == t){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n,ans = 0, cnt = 1000,cnt2 = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        ans += a[i];
        if(a[i] % 10 == 0)
        cnt2++;
        if(a[i] % 10 != 0)
        cnt = min(cnt,a[i]);
    }
    if(cnt2 == n){
        cout << 0 << endl;
        return 0;
    }
    if(ans % 10 != 0){
        cout << ans << endl;
        return 0;
    }else{
        ans -= cnt;
        cout << ans << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i,m,n) for(ll i=m ; i<n ; i++)
#define forr(i,m,n) for(ll i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N =1e5+5;
using namespace std;
int main()
{
    IO;
    ll n,a[105],sum=LLONG_MAX,mn=105,mx=0;
    cin>>n;
    rep(i,0,n) {
    cin>>a[i];
    mn=min(mn,a[i]); mx=max(mx,a[i]);
    }

    forr(i,1,mx){
        ll cur=0;
        rep(j,0,n){
        cur+=powl(a[j]-i,2);
        }
        sum=min(cur,sum);
    }

    cout<<sum;




}




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

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char cardtype[4] = { 'S','H','C','D' };				//
	char card[4][13] = {};								//絵柄*数字の2次配列
	char type;											//
	int num = 0, i = 0, j = 0, cardnum;
	scanf("%d", &num);
	getchar();											//改行コードの読み飛ばし
	do {
		scanf("%c", &type);								//絵柄の取得
		scanf("%d", &cardnum);							//数字の取得
		getchar();										//改行コードの読み飛ばし
		switch (type) {
		case 'S':
			card[0][cardnum - 1] = 1;
			i++;
			break;
		case 'H':
			card[1][cardnum - 1] = 1;
			i++;
			break;
		case 'C':
			card[2][cardnum - 1] = 1;
			i++;
			break;
		case 'D':
			card[3][cardnum - 1] = 1;
			i++;
			break;
		}
	} while (i != num);									//手持ち枚数分繰り返す
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 13; j++) {
			if (card[i][j] == 0) {
				printf("%c %d\n", cardtype[i], j + 1);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RREP(i,n) for (int i=n-1;i>=0;i--)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (ll)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=2e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

lf d[MAXn];
int main(){
    IOS();
    int n,k;
    cin >> n >> k;
    REP (i,n) {
        int x;
        cin >> x;
        d[i] = (lf)(x*(x+1)/2)/(lf)(x);
        debug(d[i]);
    }
    lf ans = 0.0;
    lf cur = 0.0;
    REP (i,k) {
        cur += d[i];
    }
    ans = cur;
    for (int i=k;i<n;i++) {
        cur -= d[i-k];
        cur += d[i];
        ans = max(ans,cur);
    }
    cout << fixed << setprecision(12) << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

long long f(long long N){
  if (N<=1ll) {
    return 1ll;
  }else{
    return 1ll + 2ll * f(N/2ll);
  }
  
}

int main(){
  long long H;
  cin >> H;

  printf("%llu\n", f(H));
}


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



int main(){
  int A, B, C, K;
  cin >> A >> B >> C>> K;
  int n = 0;
  while(A>=B){
    B*=2;
    n++;
  }
  while(B>=C){
    C*=2;
    n++;
  }
  if(n<=K) cout << "Yes" << endl;
  else cout << "No" << endl;

  
  
  
}
    



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

int main(){
    int i,N,M,nissu;
    cin >> N >> M;
    vector<int> A(M);
    for (i=0;i < M;i++){
        cin >> A.at(i);
    }

    for (i=0; i < M;i++){
        nissu = nissu + A[i];
    }
  
    if (nissu <= N){
        cout << N - nissu;
    }else{
        cout << -1;
    }
    return 0;
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    string s;
    cin >> s ;
    int n = s.size()+1;
    vi a(n);
    rep(i,n-1){
        if(s[i]=='<'){
            chmax(a[i+1],a[i]+1);
        }
    }
    for(int i=n-2;i>=0;i--){
        if(s[i]=='>'){
            chmax(a[i],a[i+1]+1);
        }
    }
    cout << accumulate(a.begin(),a.end(),0LL) << endl;
}

Measured memory_bytes: 2820
#include <iostream>
#include <string>
#include <stdio.h>
#include <queue>
#include <stack>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <vector>
#include <bits/stdc++.h>
#define debug(a) cout<<" ++ "<<a<<" ++ "<<endl;
using namespace std;
const int maxn = 1000005;

int main()
{
	int dp[3005];
	int r,g,b,n;
	cin>>r>>g>>b>>n;
	int ans = 0;
	for(int i=0;i<=(n/r);i++)
	{
		for(int j=0;j<=(n/g);j++)
		{
			int val = i * r + j * g;
			if( ( (n-val) % b == 0) && ( (n - val)>=0 ))
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}




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

using namespace std;
using ll = long long;

ll solve(int N, const vector<ll>& as)
{
    ll L = 0, R = 0;

    for (const auto a : as)
        R += a;

    ll ans = R;

    for (const auto a : as)
    {
        L += a;
        R -= a;

        ans = min(ans, llabs(L - R));
    }

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<ll> as(N);

    for (int i = 0; i < N; ++i)
        cin >> as[i];

    auto ans = solve(N, as);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define LL  long long
#define MOD  998244353
//#define mod  998244353

LL N, M, K;
//ll qpow(ll a,ll b) {return b?qpow(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

LL qpow(LL base, LL pow) {
    if(pow ==0) return 1;
    return ((pow&1?base:1)*qpow(base*base%MOD, pow/2))%MOD;
}
LL qpow2(LL base, LL pow) {
    LL res = 1;
    while(pow) {
        if(pow&1) {
            res = res*base%MOD;
        }
        base = base*base%MOD;
        pow /= 2;
    }
    return res%MOD;
}

int main() {
    cin >> N >> M >>K;
    LL ans = 0;
    LL temp = 1;
    for(int k=0; k<=K; k++) {
        ans += ((M * temp)%MOD * qpow(M-1, N-1-k))%MOD;
        ans %= MOD;
        temp = (temp * (N-k-1))%MOD * qpow(k+1, MOD-2);
        temp %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
// 4/26 リアルタイム参加

#include <iostream>
#include <vector>
#include <string>
using namespace std;

// int memo[200000][200000];

int main() {
    string S;
    cin >> S;
    int N = S.size();
    // cout << "S is " << S << endl;
    // cout << "N is " << N << endl;

    int ans = 0;

    // for (int i = 0; i < N ; i++) {
    //     string sub;
    //     int amari = 0;
    //     for (int j = i; j < N; j++) {
    //         // int s = atoi(S.substr(i, j - i + 1).c_str());
    //         // if (s % 2019 == 0) {
    //         //     ans++;
    //         //     // cout << "i, j = " << i << " " << j << endl;
    //         // }d

    //         // cout << atoi(S.substr(j, 1).c_str()) << endl;
    //         // amari = (amari * 10 + atoi(S.substr(j, 1).c_str())) % 2019;

    //         int s;
    //         s = S[j] - '0';
    //         // cout << s << endl;

    //         amari = (amari * 10 + s) % 2019;

    //         if (amari == 0) {
    //             ans++;
    //         }
    //     }
    // }

    int dp[2019] = {0};
    // cout << T[134] << endl;
    // int T[N + 1];

    int moddigit = 1;

    // T[N] = 0;
    // T[N - 1] = S[N - 1] - '0';
    dp[0] += 1;

    int val = 0;

    for (int i = 0; i < N; i++) {
        val = (val + 10 * (S[N - i - 1] - '0') * moddigit) % 2019;
        dp[val]++;
        moddigit = moddigit * 10 % 2019;
    }

    // for (int i = N - 2; i >= 0; i--) {
    //     int s = S[i] - '0';
    //     T[i] = (T[i + 1] + s * moddigit) % 2019;

    //     cout << "i, T[i] = " << i << ", " << T[i] << endl;
    //     dp[T[i]]++;

    //     moddigit = (moddigit * 10) % 2019;
    // }

    // cout << ans << endl;
    // int ans = 0;
    for (int i = 0; i < 2019; i++) {
        if (dp[i] > 1) {
            // cout << "i, dp[i] = " << i << ", " << dp[i] << endl;
            ans += (dp[i] * (dp[i] - 1)) / 2;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3744
l=[int(input()) for i in range(3)]
x=int(input())
ans=0
count=0
for i in range(1+l[0]):
    for j in range(1+l[1]):
        ans=x-500*i-100*j
        
        if ans>=0 and ans<=50*l[2]:
            count+=1
        
print(count)

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

int main() {
  int a,b,aa,bb,ans;
  ans=0;
  string x,y,xx,yy;
  cin>>a>>b;
  x=to_string(a);
  aa=(x.at(0)-'0')*10001+(x.at(1)-'0')*1010+(x.at(2)-'0')*100;
  if(aa<a)aa+=100;
  
  y=to_string(b);
  bb=(y.at(0)-'0')*10001+(y.at(1)-'0')*1010+(y.at(2)-'0')*100;
  if(bb>b)bb-=100;
  
  xx=to_string(aa);
  yy=to_string(bb);
  ans=((yy.at(0)-'0')*100+(yy.at(1)-'0')*10+(yy.at(2)-'0'))-((xx.at(0)-'0')*100+(xx.at(1)-'0')*10+(xx.at(2)-'0'))+1;
  cout<<ans<<endl;
}


Measured memory_bytes: 256