akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define MOD (1000000007)
#define f first
#define s second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
typedef long long int ll;
#define ld long double
const int N = 2e5+30;
//https://codeforces.com/problemset/page/2?tags=1700-1700
 
 
void solve(){
   int N,W;
   cin>>N>>W;
   int w[N+3];
   int v[N+3];
   for(int i=1;i<=N;i++) cin>>w[i]>>v[i];
   const int mv= 1e5+500;
   ll dp[N+3][mv];
   memset(dp,0,sizeof(dp));
   int ans=-1e9;
   for(int i=0;i<=N;i++){
     for(int j=0;j<=mv;j++){
       dp[i][j] = 1e16;
     }
   }
   for(int i=0;i<=N;i++){
     dp[i][0]=0;
   }
   for(int i=1;i<=N;i++){
     for(int j=1;j<=1e5+40;j++){
       if(j-v[i]>=0 && dp[i-1][j-v[i]]+w[i]<=W){
         //cout<<"bro"<<'\n';
         //cout<<i<<" "<<j<<'\n';
         //cout<<dp[i-1][j-v[i]]+w[i]<<" "<<W<<'\n';
         dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
       }
       else dp[i][j] = dp[i-1][j];
     }
   }
   for(int i=1;i<=1e5+40;i++){
     //cout<<dp[N][i]<<" ";
     if(dp[N][i]<=W && dp[N][i]){
       ans = max(ans,i);
     }
   }
   cout<<ans<<'\n';
}
 
 
int main(){
 	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	int T;
  //cin >> T;
  //cout<<prs.size()<<'\n';
	 T = 1;
  //visited[1]=1;
	while(T--){
		solve();
	}
}

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

int main() {
    int64_t N,A,B;
    cin >> N >> A >> B;
//    scanf("%ld %ld %ld", &N, &A, &B);
    if(A > N%(A+B)){
        cout << N/(A+B)*A + N%(A+B) << endl;
//        int64_t o = (N*A)/(A+B) + N%(A+B);
//        printf("%ld\n", o);
    }
    if(A <= N%(A+B)){
        cout << N/(A+B)*A + A << endl;
//        int64_t o = (N*A)/(A+B) + A;
//        printf("%ld\n", o);
    }

//    cout << N*A <<endl;
//    cout << N/A << endl;
//    cout << N/(A+B) << endl;

}

Measured memory_bytes: 256
N,X,Y=list(map(int,input().split()))
A=[0 for i in range(N)]
for i in range(1,N):
    for j in range(i+1,N+1):
        A[int(min(j-i,abs(X-i)+abs(Y-j)+1))]+=1  
del A[0]
print(*A,sep=('\n'))

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N;
    cin >> N;

    for(ll i = 0; i < N - 1; i++){
        ll a; cin >> a;
        vec.push_back(a);
    }

    ll ans = vec[0];
    for(ll i = 0; i < N - 2; i++){
        if(vec[i] > vec[i + 1]){
            ans += vec[i + 1];
        }else{
            ans += vec[i];
        }
    }
    ans += vec[N-2];

    cout << ans << endl;

}

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

#define INF (int64)1e9
#define INF_LL (int64)1e18
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for (int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

int64 n, m;
vector<int64> G[11234], ord, low;
vector<set<PLL>> st; // (0 or 1 {is up or down}, id)
map<PLL, int> mp;
int cnt;
bool ok = 1;

void dfs(int64 v, int64 p) {
  ord[v] = cnt++;
  for (auto &to : G[v]) {
    if (to == p) continue;
    if (ord[to] != -1) {
//      cout << "visited " << v << " " << to << ": " << low[v] << " " << ord[to] << endl;
      low[v] = min(low[v], ord[to]);
      if (mp.count(PLL(v, to)) || mp.count(PLL(to, v))) continue;
      mp[PLL(v, to)] = 1;
      continue;
    } else {
      dfs(to, v);
      low[v] = min(low[v], low[to]);
//      cout << v << " " << to << ": " << low[to] << " " << ord[v] << endl;
      if (low[to] > ord[v]) {
        if (st[to].size()) {
          if (st[to].size() && st[to].begin()->first != prev(st[to].end())->first) {
            ok = 0;
          }
          if (st[to].begin()->first == 0) mp[PLL(to, v)] = 1;
          else mp[PLL(v, to)] = 1;
        } else {
          mp[PLL(v, to)] = 1;
        }
      } else {
        mp[PLL(v, to)] = 1;
      }
      if (st[v].size() < st[to].size()) swap(st[v], st[to]);
      for (auto& x : st[to]) {
        if (st[v].find(PLL(1-x.first, x.second)) != st[v].end()) {
          st[v].erase(PLL(1-x.first, x.second));
        } else {
          st[v].insert(x);
        }
      }
    }
  }
}

int main(void) {
  cin >> n >> m;
  st.resize(n);
  REP(i, m) {
    int64 a, b;
    cin >> a >> b; a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  cnt = 0;
  int64 k;
  cin >> k;
  REP(i, k) {
    int64 a, b;
    cin >> a >> b; a--; b--;
    st[a].emplace(0, i);
    st[b].emplace(1, i);
  }
  low.resize(n, INF);
  ord.resize(n, -1);
  dfs(0, -1);

  if (!ok) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for (auto &x : mp) {
    cout << x.first.first+1 << " " << x.first.second+1 << endl;
  }
}


Measured memory_bytes: 60004
/*      ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     */

// Author : Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;


#define       TESTCASES()  cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define       _input(V3C)  for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define mems(A77AY, V4LU)  memset((A77AY), (V4LU), sizeof((A77AY)))
#define  CH3K(I7, E4, S7)  (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define for4(I7,S4,E4,S7)  for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))




void solveEachTest(lld T35TC453N = 1) {

	lld n; cin >> n;
	lld temp = n;
	lld suum = 0ll;
	while (temp) {
		suum += temp % 10;
		temp /= 10;
	}
	puts( (n % suum == 0) ? "Yes" : "No" );

	return;
}


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

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  null

Measured memory_bytes: 3616
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
signed main(){
  int a,b;
  cin>>a>>b;
  cout<<a-b+1<<endl;
}


Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/abc118/tasks/abc118_b

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int N,M;
vector<int> fav;

int main() {
    cin >> N >> M;
    int k;
    cin >> k;
    REP(j, k) {
        int a;
        cin >> a;
        fav.push_back(a);
    }

    REP(i, (N-1)) {
        cin >> k;
        vector<int> temp;
        temp = fav;
        fav.clear();
        REP(j, k) {
            int a;
            cin >> a;
            for(auto it = temp.begin(); it < temp.end(); it++) {
                if(a==*it) {
                    fav.push_back(a);
                    break;
                }
            }
        }
    }

    print(fav.size());
    return 0;
}


Measured memory_bytes: 256
/*
DISCLAIMER: I don't expect this to AC first submit, but it'd be pretty great if it did...
 -> I'm rusty af
*/
 
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //gp_hash_table
 
#define all(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define sz(a) (int) a.size()
#define bitcount(a) __builtin_popcount(a)
#define bitcountll(a) __builtin_popcountll(a)
 
using namespace std;
// using namespace __gnu_pbds;
 
 
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
void solve() {
    const ll oo = 1e18;
    int n; cin >> n;
    vector<pii> a(n);
    for(auto& p : a) cin >> p.first >> p.second;
    sort(all(a), [](const pii& x, const pii& y) {
        int l = x.first - y.second;
        int r = y.first - x.second;
        return l < r;
    });
    a.insert(a.begin(), {-1, -1});
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, oo));
    int ans = 0;
    dp[0][0] = 0;
    for(int i = 1; i <= n; ++i) {
        dp[i][0] = 0;
        for(int x = 1; x <= i; ++x) {
            dp[i][x] = dp[i - 1][x];
            if(dp[i - 1][x - 1] <= a[i].first) {
                dp[i][x] = min(dp[i][x], dp[i - 1][x - 1] + a[i].second);
            }
            if(dp[i][x] < oo) {
                ans = max(ans, x);
            }
        }
    }
    cout << ans << endl;
}
 
int main() {
    // freopen("input.in", "r", stdin);
    // freopen("input.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    // int t; cin >> t; while(t--)
    solve();
    cout.flush();
    return 0;
}


Measured memory_bytes: 198816
def main():
    while True:
        n = int(input())
        if n == 0:
            return
        kk = list(map(int,input().split()))
        S = input()
        ans = ""
        for i,s in enumerate(S):
            if s.islower():
                k = (ord(s)-ord('a')-kk[i%len(kk)])
                if k < -26:
                    ans += chr(ord('a')+k%26)
                elif k < 0:
                    ans += chr(ord('A')+k%26)
                else:
                    ans += chr(ord('a')+k)
            if s.isupper():
                k = (ord(s)-ord('A')-kk[i%len(kk)])
                if k < -26:
                    ans += chr(ord('A')+k%26)
                elif k < 0:
                    ans += chr(ord('a')+k%26)
                else:
                    ans += chr(ord('A')+k)
        print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5616
#include <iostream>
#include <string>
using namespace	std;
int main(){

  string s,r;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]!='B') r.push_back(s[i]);
    else {
      if(r.empty()) continue;
      r.erase(r.size()-1);
    }
  }
  cout<<r<<endl;
  return 0;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i, n)         for(int i=0; i<n; i++)
#define fo(i, k, n)     for(int i=k; i<n; i++)
#define forr(i, a, b)   for(int i=a; i<=b; i++)
#define rf(i,n)         for(int i=n;i>=0;i--)
typedef unsigned long long ull;
typedef pair<int ,int> pr;
#define MAX 100005
#define INF 1000000009
#define   sq(n)         (n*n)
#define p(n) cout<<n<<endl
#define pb push_back
#define py cout<<"YES"<<endl;
#define pn cout<<"NO"<<endl;
ll mod =1e9+7;
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
ll lcm ( ll a, ll b )
{
    return ( a / __gcd ( a, b ) ) * b;
}


ll modpow(ll a,ll n, ll mod)
{
    ll res = 1;
    while(n>0)
    {
        if (n%2==1)
        {
            res = res * a % mod;
        }
        a = a * a % mod;
        n/=2;
    }
    return res;
}

int bin_ser(int *a,int n,int x)
{
    int l=0;
    int h=n-1;
    while(l<=h)
    {
        int mid=l+((h-l)/2);
        if(a[mid]==x)
        {
          return mid;
        }
        else if(a[mid]<x)
        {
            l=mid+1;
        }
        else
        {
            h=mid-1;
        }
    }
}

int main()
{
    __FastIO;

        int n,x,t;
        cin>>n>>x>>t;
        float p=n/(float)x;
        int q=ceil(p);
        p(q*t);

    return 0;
}




Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

    long long n, w; // the number of temperatures to analyse
    long long weight[101], value[101];
    long long dp[101][1000100];
    long long ans=0;

int main() {
    


    cin >> n >>w; cin.ignore();
    for (int i = 0; i < n; i++) {
        cin >> weight[i]>> value[i]; cin.ignore();
    }

    //init
    for (int i = 0; i < w; ++i)
    {
      dp[0][i] = 0; 
    }

    for (int i = 0; i < n; ++i)
    {//till dp[n] 
    	for( int j = 0; j<=w; ++j)
    	{
	    	if (j >= weight[i])
	    	{
	    		dp[i+1][j] = max(dp[i][j], dp[i][j-weight[i]]+value[i]); 
	    	} 
	    	else
	    	{
	    		dp[i+1][j] = dp[i][j];
	    	}
	    	//cout<<"i="<<i<<" j="<<j<<" "<< dp[i+1][j]<< endl;
		}
    }

    for (int i = 0; i <= w; ++i)
    {
    	if (ans<dp[n][i])
    	{
    		ans = dp[n][i];
    	}
    	//cout<<dp[n][i]<<endl; 
    }

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

Measured memory_bytes: 285696
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define int long long
    #define lb long double
    #define f(i,a,b) for(int i=a;i<=b;i++)
    #define fd(i,a,b) for(int i=a;i>=b;i--)
    #define vi vector<int>
    #define mii map<int,int>
    #define pii pair<int,int>
    #define si set<int>
    #define pb push_back
    #define mk make_pair
    #define fi first
    #define se second
    #define fv(i,v) for(auto i=v.begin();i!=v.end();++i)
    #define fdv(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
    #define print(a,n) f(i,1,n) cout<<a[i]<<" "; cout<<endl;
    #define printv(v) for(auto iv: v) cout<<iv<<" "; cout<<endl;
    #define all(v) v.begin(),v.end()
    #define r(a,n) ll a[n+1]; f(i,1,n) cin>>a[i];
    #define pi 3.141592653589793238
    const int mod=998244353;
    const int inf=1e18;
    //bool vis[1000+1]={};
    const int MAXN=1e5+1;
    int spf[MAXN];
    map<pii,int> m1,m2;

    ll power(ll x, unsigned ll y)
    {
        ll res = 1;
        while (y > 0)
        {
            if (y & 1)
                res = res*x;
            y = y>>1;
            x = x*x;
        }
        return res;
    }

    bool isPrime(int n)
    {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;

        if (n % 2 == 0 || n % 3 == 0)
            return false;

        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;

        return true;
    }
        void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;
        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

    int lcm(int a, int b)
    {
        return (a*b)/__gcd(a,b);
    }
    signed main()
    {
        int t=1;
        //cin>>t;
        while(t--)
        {
            int x,y;
            cin>>x>>y;
            if(y<2*x||y>4*x||y%2!=0)cout<<"No"<<endl;
            else cout<<"Yes"<<endl;
        }
    }


Measured memory_bytes: 3608
n,m = map(int,input().split())
a = ["" for _ in range(n)]
b = ["" for _ in range(m)]
for i in range(n):
  ai = str(input())
  a[i] = ai
for i in range(m):
  bi = str(input())
  b[i] = bi
for i in range(n-m+1):
  for j in range(n-m+1):
    flag = False
    for k in range(m):
      for l in range(m):
        if a[i+k][j+l] != b[k][l]:
          flag = True
          break
      if flag:
        break
    if not flag:
      print("Yes")
      exit()
print("No")

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

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

  ll a, b, v, w, t;
  cin >> a >> v >> b >> w >> t;

  if (abs(a - b) <= t * (v - w)) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int main() {
  int N;
  cin >> N;
  
  char color;
  string number = "Three";
  
  for (int i = 0; i < N; i++) {
   cin >> color;
   if (color == 'Y') {
     number = "Four";
   }
   
  }  
   cout << number << endl;
}  
     


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
	long sum=0;
	int a,n;
	scanf("%d",&n);
	n+=1;
	for(a=1;a<n;a++)
		if(a%3!=0&&a%5!=0)
			sum+=a;
	printf("%lld",sum);
  return 0;
}

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

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

    vector<int> a(N);
    for (int& x : a) cin >> x;

    int ans = 1 << 29;
    for (int i = 0; i <= N - K; i++) {
        int t = a[i + K - 1] - a[i] + min(abs(a[i]), abs(a[i + K - 1]));
        ans = min(ans, t);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class E { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long K = GetLong();
		var A = GetDoubles(N);

		double ng = 0.0;
		double ok = A.Max();
		while(Abs(ng - ok) > 1e-6)
		{
			double mid = (ng + ok) / 2.0;
			long cnt = A.Sum(x => (long)Ceiling(x / mid) - 1);
			if(cnt <= K)
				ok = mid;
			else
				ng = mid;
		}
		WriteLine((long)Ceiling(ok));
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 45968
a,b,k=[int(i) for i in input().split()]
ans=[]
if k<b-a:
    for i in range(a,a+k):
        if (i in ans)==False:
            ans.append(i)
    for i in range(b-k+1,b+1):
        if (i in ans)==False:
            ans.append(i)
    result=sorted(ans)
else:
    result=[i for i in range(a,b+1)]
for i in range(len(result)):
    print(result[i])

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

int main(){
   int N,K;cin>>N>>K;
   long long ans=0;
   vector<int> H(N);
   for(int i=0;i<N;i++){
       cin>>H[i];
   }
   sort(H.begin(),H.end());
   for(int i=0;i<N-K;i++){
       ans+=H[i];
   }
   cout<<ans<<endl;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {std::cout << x;}
void __print(unsigned x) {std::cout << x;}
void __print(unsigned long x) {std::cout << x;}
void __print(unsigned long long x) {std::cout << x;}
void __print(float x) {std::cout << x;}
void __print(double x) {std::cout << x;}
void __print(long double x) {std::cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) cout << #mat << "::" << endl; printmat(mat,row,col); printpartition;
#define debugv(v,n) cout << #v << ":" << endl; printv(v,0,n-1); printpartition;
#else
#define debug(x...)
#define matdeb(mat,row,col)
#define debugv(v,n)
#endif

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll n;
	cin>>n;

	ll dp[100];

	dp[0] = 2;
	dp[1] = 1;

	for(int i=2; i<=n; i++)
	{
		dp[i] = dp[i-1]+dp[i-2];
	}

	cout<<dp[n]<<endl;

}


Measured memory_bytes: 3616
#include <cstdio>
#include <vector>

using namespace std;

int a[1000];
int b[1000];
int dp[1000][2][5001];
vector <int> v[1000];

int dfs(int x) {
    int ans = 1e9, i, j;
    
    for (i = 0; i <= a[x]; i++) dp[x][0][i] = dp[x][1][i] = 1e9;
    
    dp[x][0][0] = 0;
    
    for (i = 0; i < v[x].size(); i++) {
        int y = dfs(v[x][i]);
        int z = a[v[x][i]];
        
        if (y == -1) return -1;
        
        for (j = a[x]; j >= 0; j--) {
            if (dp[x][0][j] == 1e9) continue;
            
            if (j + y <= a[x]) dp[x][1][j + y] = min(dp[x][1][j + y], dp[x][0][j] + z);
            if (j + z <= a[x]) dp[x][1][j + z] = min(dp[x][1][j + z], dp[x][0][j] + y);
        }
        
        for (j = 0; j <= a[x]; j++) {
            dp[x][0][j] = dp[x][1][j];
            dp[x][1][j] = 1e9;
        }
    }
    
    for (i = 0; i <= a[x]; i++) ans = min(ans, dp[x][0][i]);
    
    if (ans == 1e9) ans = -1;
    
    return ans;
}

int main() {
    int n, i, j;
    
    scanf("%d", &n);
    
    for (i = 1; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        v[x - 1].push_back(i);
    }
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    if (dfs(0) >= 0) {
        puts("POSSIBLE");
    } else {
        puts("IMPOSSIBLE");
    }
    
    return 0;
}


Measured memory_bytes: 38272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int w,a,b;
  cin>>w>>a>>b;
  if((b<=a+w && a<=b) || (a<=b+w && b+w<=a+w)){
    cout<<0<<endl;
    return 0;
  }
  int x=min(abs(b-a-w),abs(b+w-a));
  cout<<x<<endl;
}

Measured memory_bytes: 256
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n,q = readline() |> split |> parseMap
	s = chomp(readline())
	k = Array{Int}(n+1)
	k[1] = 0
	k[2] = 0
	for i in 2:n
		k[i+1] = k[i]
		if s[i-1] == 'A' && s[i] == 'C'
			k[i+1] += 1
		end
	end
	for i in 1:q
		l,r = readline() |> split |> parseMap
		x = k[r+1]-k[l]
		if l>1 && s[l-1] == 'A' && s[l] == 'C'
			x-=1
		end
		println(x)
	end
end
main()

Measured memory_bytes: 153576
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

int main()
{
	char input[10 + 1] = "";
	char threeStr[3 + 1] = "";
	char *curr;
	int converted;
	int minAbs = 1000;
	int curAbs;
	int i;

	if (scanf("%s", input) == EOF)
	{
		return 0;
	}
	curr = input;

	for (i = 0; i < strlen(input) - 2; i++)
	{
		memcpy(threeStr, curr, 3);
		converted = atoi(threeStr);
		curAbs = abs(753 - converted);
		if (curAbs < minAbs)
		{
			minAbs = curAbs;
		}
		curr++;
	}

	printf("%d\n", minAbs);

	return 0;
}

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


string a,b;
string result;
int dp[3005][3005];
int N,M;

int solve(int i,int j)
{
    int &ret=dp[i][j];
    if(ret!=-1)return ret;
    if(i==N || j==M)return 0;
    if(a[i]==b[j])ret=solve(i+1,j+1)+1;
    ret=max(ret,solve(i+1,j));
    ret=max(ret,solve(i,j+1));
    return ret;
}

void reconstruct(int pos1,int pos2)
{
    if(pos1==N || pos2==M)return;
    if(a[pos1]==b[pos2]){
        result+=a[pos1];
        reconstruct(pos1+1,pos2+1);
    }
    else if(dp[pos1+1][pos2]>=dp[pos1][pos2]){
        reconstruct(pos1+1,pos2);
    }
    else
        reconstruct(pos1,pos2+1);
}

int main()
{
    cin>>a>>b;
    memset(dp,-1,sizeof(dp));
    N=a.length();
    M=b.length();
    int ans=solve(0,0);
    reconstruct(0,0);
    cout<<result;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
    int a; cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){
	int n;

	stack<int> S;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		while(n > 0){
			S.push(n%8);
			n /= 8;
		}

		while(!S.empty()){
			switch(S.top()){
			case 0:
				printf("0");
				break;
			case 1:
				printf("1");
				break;
			case 2:
				printf("2");
				break;
			case 3:
				printf("3");
				break;
			case 4:
				printf("5");
				break;
			case 5:
				printf("7");
				break;
			case 6:
				printf("8");
				break;
			case 7:
				printf("9");
				break;
			}
			S.pop();
		}
		printf("\n");
	}

    return 0;
}

Measured memory_bytes: 2584
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ull>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long ll;
typedef long double ld;
using namespace std;

long long N, L;
ll get_g(ll x){
  if(x==0) return 0;
  ll ret = 1;
  while(x%2==0) x/=2, ret*=2;
  return ret;
}

struct node{
  map<char, node*> nx;
};

ll dfs(node* now, ll d){
  ll ret = 0;
  if(now->nx.size()==0) return 0;
  if(now->nx.size()==1) ret ^= get_g(d);
  for(auto itr=now->nx.begin();itr!=now->nx.end();itr++) {
    ret ^= dfs((*itr).second, d-1);
  }
  return ret;
}

int main(int argc, char const *argv[]) {
  std::cin >> N >> L;
  node st;
  string s;
  vector<node> l(100000);
  ll cnt = 0;

  for(int i=0;i<N;i++){
    std::cin >> s;
    node* now = &st;
    for(int j=0;j<s.size();j++){
      if(now->nx.find(s[j])==now->nx.end()) {
        cnt++;
        now->nx.emplace(s[j], &l[cnt]);
        now = &l[cnt];
      }else{
        now = now->nx.at(s[j]);
      }
    }
  }
  std::cout << (dfs(&st, L)?"Alice":"Bob") << '\n';
  return 0;
}


Measured memory_bytes: 13632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
/*#include <boost/multiprecision/cpp_int.hpp> 
using boost::multiprecision::cpp_int;*/
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int              long long int
#define pb              push_back
#define mp12            make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pq1             priority_queue<int>
#define pqr1            priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void fast()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

}
void file(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int modInv(int a,int b,int m)
{
    int res=1;
    a=a%m;
    while(b>0){
        if(b&1){
            res=(res*a)%m;
        }
        a=(a*a)%m;
        b=b>>1;
    }
    return res;
}


int p[1000006];
vi prime;
//int mrp[1000000];
void seive(){
    for(int i=2;i<1000006;i++) {
        if(p[i]){
            prime.pb(i);
            for(int j=i*i;j<=1000006;j=j+i){
                p[j]=0;
            }
        }
    }

}
// int c;
int dp[101][100001];


int32_t main()
{
    // memset(prime,0,sizeof(prime));
    //memset(p,1,sizeof(p));   
    //seive();
 //   file();
    fast();
    //int mo=1000000007;
   int n,k;
   cin>>n>>k;
   int a[n+1];
   for(int i=1;i<=n;i++) {
        cin>>a[i];
   }
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<=k;i++){
        dp[1][i]=(i>a[1])? 0:1;
    }
    for(int i=2;i<=n;i++){
        for(int j=0;j<=k;j++){
            if(j==0) dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=(mod + dp[i][j-1] + dp[i-1][j] - ((j-1-a[i]>=0)? dp[i-1][j-1-a[i]]:0))%mod;
        }
    }
    cout<<dp[n][k];



    return 0;
    
    
}



Measured memory_bytes: 82524
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

vector< int64 > result;
vector< vector< pair<int32, int32> > > point;
uint32 N;

void searchRoot(uint32 here, int64 weight)
{
    if(result[here] != -1){
        return;
    }else{
        result[here] = weight;
    }
    for(uint32 i=0; i<point[here].size(); i++){
        searchRoot(point[here][i].first, weight + point[here][i].second);
    }
    return;
}

void func(void)
{
//DEBUG_OUT("----\n");
    cin >> N;

    point.resize(N+1);
    for(uint32 i=0; i<N-1; i++){
        int32 a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        point[a].push_back(make_pair(b, c));
        point[b].push_back(make_pair(a, c));
    }

    uint32 Q, K;
    cin >> Q >> K;
    K--;
    result.resize(N+1, -1);
    searchRoot(K, 0);
    vector< int64 > ans(Q);
    for(uint32 i=0; i<Q; i++){
        uint32 x, y;
        cin >> x >> y;
        x--; y--;
        ans[i] = result[x] + result[y];
    }

DEBUG_OUT("---\n");
    for(uint32 i=0; i<Q; i++){
        cout << ans[i] << endl;
    }
    
    return;
}



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

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> a(h);

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


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

  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      
      if (a[i][j] == '.') {
          
        int cnt = 0;
        for (int d = 0 ; d < 8; d++) {
          int ni = i + dx[d];
          int nj = j + dy[d];

          if (ni < 0 or h <= ni) continue; 
          if (nj < 0 or w <= nj) continue;
          if(a[ni][nj] == '#') cnt++;
        }
        a[i][j] = cnt + '0';
      }
    }
  }

  for(string x : a) {
    cout << x << endl;
  }

}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
#define INFTY 1<<29
using namespace std;
typedef long long ll;
typedef long long int lli;
// static const int MOD = 10000007;
// static const int MAX = 100005;
static const int NMAX = 1005;
static const int KEY = 4096;


// typedef priority_queue<int, greater<int>> RevQ;
int N, M;
int m[NMAX][NMAX];


// lli gcd(lli a, lli b) {
//   return b ? gcd(b, a%b) : a;
// }

int main(){
  cin >> N;
  int m[N][N];
  vector<int> l(N);
  rep(i, N) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());
  rep(i, N) rep(j, N) m[i][j] = l[i] + l[j];
  int cnt = 0;
  REP(J, 2, N) {
    rep(i, J) {
      rep(j, i) {
        if (m[i][j] > l[J]) cnt += 1;
      }
    }
  }
  cout << cnt << endl;
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a<=b)
    {
        for(int i=0;i<b;i++)
            cout<<a;
    }
    else
    {
        for(int i=0;i<a;i++)
            cout<<b;
    }

}


Measured memory_bytes: 256
s=input()
a=0
b=0
c=0
for i in range(3):
    if s[i]=="a":
        a+=1
    elif s[i]=="b":
        b+=1
    elif s[i]=="c":
        c+=1
if a==1 and b==1 and c==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = (a > b ? b : a)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n, tmp = 0;
    double a[1111], res = -INF;
    cin>>n;
    rep(i, n){
        cin>>a[i];
    }
    sort(a, a + n);
    rep(i, n){
        rep(j, i + 1, n){
            if(i == n - 2){
                chmax(res, (a[n - 3] + a[n - 4]) / (a[j] - a[i]));
            }else if(i == n - 3){
                if(j == n - 2){
                    chmax(res, (a[n - 1] + a[n - 4]) / (a[j] - a[i]));
                }else{
                    chmax(res, (a[n - 2] + a[n - 4]) / (a[j] - a[i]));
                }
            }else{
                chmax(res, (a[n - 1] + a[n - 2]) / (a[j] - a[i]));
            }
        }
    }
    cout<<res<<endl;
}



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


int main(){
	
	int n;
	cin >> n;
	int S[14],H[14],C[14],D[14];
	for(int i = 0;i < 14;i++)S[i]=H[i]=C[i]=D[i]=0;
	for(int i = 1;i <= n;i++){
		char mark;
		cin >> mark;
		int num;
		cin >> num;
		if(mark == 'S') S[num] = 1;
		else if(mark == 'H') H[num] = 1;
		else if(mark == 'C') C[num] = 1;
		else if(mark == 'D') D[num] = 1;
	}
	for(int j = 1;j <= 13;j++){
		if(!S[j])cout << "S " << j << endl;;
	}
	for(int j = 1;j <= 13;j++){
		if(!H[j])cout << "H " << j << endl;;
	}
	for(int j = 1;j <= 13;j++){
		if(!C[j])cout << "C " << j << endl;;
	}
	for(int j = 1;j <= 13;j++){
		if(!D[j])cout << "D " << j << endl;;
	}
	
	return 0;
}

Measured memory_bytes: 3060
#include <stdio.h>
#define MAX 100005
#define NIL -1

typedef struct Node {
  int p;
  int l;
  int r;
}N;

N T[MAX];
int D[MAX];



int setDepth(int u,int p){
  D[u]=p;
  if(T[u].r!=NIL)
    setDepth(T[u].r,p);
  if(T[u].l!=NIL)
    setDepth(T[u].l,p+1);
}


int main(){
  int i,j,n,v,d,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
    T[i].l=NIL;
    T[i].r=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;

    }
  }
  for(i=0;i<n;i++)
    if(T[i].p==NIL)r=i;

  setDepth(r,0);

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,T[i].p,D[i]);
    if(T[i].p==NIL)printf("root,");
    else if(T[i].l==NIL)printf("leaf,");
    else printf("internal node,");

    printf(" [");

    for(j=0,c=T[i].l;c!=NIL;j++,c=T[c].r){
      if(j)printf(", ");
      printf("%d",c);

    }
    printf("]\n");

  }



    
  return 0;
}
  



Measured memory_bytes: 6376
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N, A, b;
    N = sc.nextInt();
    A = sc.nextInt();
    
    b = N % 500;
    
    if (b <= A){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }  
  }
}


Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

int main(){
    ll N, sub;
    cin >> N;
    vector<ll> v;
    for(int i = 0; i < 5; i++){
        cin >> sub;
        v.push_back(sub);
    }
    ll ans;
    
    ll min_v = *min_element(v.begin(), v.end());
    
    if(N <= min_v){
        ans = 5;
        cout << ans << endl;
        return 0;
    }
    
    if((N % min_v) == 0){
        ans = 5 + (N / min_v) - 1;
    }
    else{
        ans = 5 + (N / min_v);
    }
    
    cout << ans << endl;
}

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

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

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    int A[2][N];
    REP(i, 2)
    {
        REP(j, N)
        {
            cin >> A[i][j];
        }
    }
    int ans = 0;
    REP(i, N)
    {
        int sum = A[0][0];
        REP(j, N)
        {
            if (i <= j)
            {
                sum += A[1][j];
            }
            else
            {
                sum += A[0][j + 1];
            }
            
        }
        ans = max(ans, sum);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		long a = Long.parseLong(tokens[0]);
		long b = Long.parseLong(tokens[1]);
		long c = Long.parseLong(tokens[2]);
		long d = Long.parseLong(tokens[3]);
		long max = Long.MIN_VALUE / 2;
		max = Math.max(max, a * c);
		max = Math.max(max, a * d);
		max = Math.max(max, b * c);
		max = Math.max(max, b * d);
		System.out.println(max);
	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 25404
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main()
{
    int N; cin >> N;
    vector<long long> A(N); for (auto& a : A) cin >> a;
    vector<long long> B(N);
    B[0] = A[0];
    for (int i = 1; i < N; i++) B[i] = B[i-1] + A[i];
    vector<vector<long long>> C(N+1, vector<long long>(N+1)); // dp[i][j] : cost A[i..j)
    for (int n = 2; n <= N; n++) {
        for (int i = 0; i + n <= N; i++) {
            C[i][i+n] = 1LL << 60;
            long long s = B[i+n-1] - B[i] + A[i];
            for (int j = 1; j < n; j++) {
                C[i][i+n] = min(C[i][i+n], C[i][i+j] + C[i+j][i+n] + s);
            }
        }
    }
    cout << C[0][N] << endl;
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int seconds_day = 24 * 60 * 60;
  int sendoss_hour = 60 * 60;
  int M; 	// 大晦日の時間
  cin >> M;
  
  // 大晦日の残り時間()
  cout << 24 + (24-M) << endl;
}

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

int main()
{
  //vector<bool> close(1<<(5*5), false);
  vector<int> close((1<<(5*5))/32, 0);
  vector<int> cls(1000000);
  int cls_cnt=0;

  for (int n; cin>>n, !(n==0); ){

    vector<vector<int> > pats(33);
    vector<vector<int> > tmp(n, vector<int>(n, 0));

    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	for (int k=i; k<n; k++){
	  for (int l=j; l<n; l++){
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=1;
	    int bd=0;
	    for (int a=0; a<n; a++){
	      for (int b=0; b<n; b++){
		bd=(bd<<1)|tmp[a][b];
	      }
	    }
	    pats[__builtin_clz(bd)].push_back(bd);
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=0;
	  }
	}
      }
    }

    int bd=0;
    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	int t; cin>>t;
	bd=(bd<<1)|t;
      }
    }

    int cls_cur=0;
    close[bd>>5]|=(1<<(bd&31));
    cls[cls_cnt++]=bd;
    for (;;){
      int dep=cls[cls_cur]>>25;
      int cbd=cls[cls_cur]&0x1ffffff;
      cls_cur++;
      const vector<int> &ps=pats[__builtin_clz(cbd)];
      int sz=ps.size();
      for (int i=0; i<sz; i++){
	int nbd=cbd^ps[i];
	if (nbd==0){
	  for (int i=0; i<=dep; i++)
	    cout<<"myon";
	  cout<<endl;
	  goto _exit;
	}
	if (close[nbd>>5]&(1<<(nbd&31))) continue;
	close[nbd>>5]|=(1<<(nbd&31));
	cls[cls_cnt++]=((dep+1)<<25)|nbd;
      }
    }
  _exit:;
    for (int i=0; i<cls_cnt; i++)
      close[(cls[i]&0x1ffffff)>>5]=0;
    cls_cnt=0;
  }
  return 0;
}

Measured memory_bytes: 8908
k,i,j,b[999];
main(n)
{
  for(;scanf("%d%d",&n,&k),n;puts(b[i]<0?"No":"Yes"))
    {
      for(i=0;i<k;i++)
	scanf("%d",&b[i]);
      for(;n--;)
	for(j=0;j<k;j++)
	  scanf("%d",&i),b[j]-=i;
      for(i=0;i<k-1;i++)
	if(b[i]<0)break;
    }
  exit(0);      
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>

double borgomool(double x)
{
    int n = 64;
    double l = 0, r = x, m;
    while(n--){
        m = (l + r)/2;
        if(m*m < x){
            l = m;
        }
        else{
            r = m;
        }
    }

    return m;
}
int ar[15200];

int main() {
    ios_base::sync_with_stdio(false);
    int n, i, j, k, m, l;
    cin >> n;
    string a[n];
    for(i=0;i<n;i++){
        cin >> a[i];
    }

    cin >> m;
    string b[m];
    for(i=0;i<m;i++){
        cin >> b[i];
    }
    int cnt1 = 0, cnt2 = 0, v = 0;
    for(i=0;i<n-1;i++){
        cnt1 = 0;
        cnt2 = 0;
        for(j=i;j<n;j++){
            if(a[j] == a[i]){
                cnt1++;
            }
        }

        for(j=0;j<m;j++){
            if(b[j] == a[i]){
                cnt2++;
            }
        }

        ar[v++] = cnt1 - cnt2;

    }

    int mx = 0;
    for(i=0;i<v;i++){
        mx = max(mx, ar[i]);
    }


    cout << mx << "\n";


    return 0;

}

Measured memory_bytes: 384