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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x)            \
	for (auto &youso_ : (x)) \
	cin >> youso_
#define mp make_pair
#define All(a) (a).begin(), (a).end()
template <typename T = long long>
inline T IN()
{
	T x;
	cin >> x;
	return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail)
{
	cin >> head;
	CIN(move(tail)...);
}
#define CINT(...)    \
	int __VA_ARGS__; \
	CIN(__VA_ARGS__)
#define LCIN(...)   \
	ll __VA_ARGS__; \
	CIN(__VA_ARGS__)
#define SCIN(...)       \
	string __VA_ARGS__; \
	CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int N;

int main()
{
	cin >> N;
	int h = 0, ans = 0;
	REP(i, N)
	{
		CINT(H);
		if (h <= H)
		{
			ans++;
			h = max(h, H);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template<class T>
inline void scan(T&a){
    static int c;
    a=getchar_unlocked()-'0';
    while((c=getchar_unlocked()-'0')>=0) a*=10,a+=c;
}

inline void PUTNO(){
    putchar_unlocked('N');
    putchar_unlocked('o');
    putchar_unlocked('\n');
}

int n{},SM{},mn{},sm{};
pair<int,int> a[1000000],b[1000000];
auto x=a,y=b,X=a,Y=b;
char c;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    scan(n);
    fr(i,n){
        mn=sm=0;
        while((c=getchar_unlocked())!='\n'){
            if(c=='(') ++sm;
            else --sm;
            chmin(mn,sm);
        }
        if(sm>=0) *x=make_pair(-mn,sm),++x;
        else *y=make_pair(sm-mn,-sm),++y;
        SM+=sm;
    }
    if(SM) return PUTNO(),0;
    sort(a,x);
    sort(b,y);
    int tmp{};
    while(X!=x){
        if(X->first>tmp) return PUTNO(),0;
        tmp+=X->second;
        ++X;
    }
    tmp=0;
    while(Y!=y){
        if(Y->first>tmp) return PUTNO(),0;
        tmp+=Y->second;
        ++Y;
    }
    putchar_unlocked('Y');
    putchar_unlocked('e');
    putchar_unlocked('s');
    putchar_unlocked('\n');
}


Measured memory_bytes: 11340
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << h2 * 60 + m2 - h1 * 60 - m1 - k << endl;
}

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

void solve(int N,vector<vector<int>> &x,vector<vector<int>> &y,vector<vector<int>> &hito,int &ans){
	for(int i=0;i<hito.size();i++){
		bool pro =true;
		for(int k=0;k<N;k++){
			if(hito.at(i).at(k)==1){
				for(int j=0;j<x.at(k).size();j++){
					// cout<<"hito;"<<hito.size()<<endl;
					if(hito.at(i).at(x.at(k).at(j))!=y.at(k).at(j)){
						pro =false;
						break;
					}
				}
			}
			if(!pro)break;
		}
		if(pro){
			int cu=0;
			for(int j=0;j<N;j++){
				if(hito.at(i).at(j)==1){
					cu++;
				}
			}
			ans=max(ans,cu);
		}
	}
}

int main(){
	int N;
	cin >> N;
	vector<vector<int>> x(N);
	vector<vector<int>> y(N);
	int a;
	int x1,y1;
	for(int i=0;i<N;i++){
		cin >> a;
		for(int j=0;j<a;j++){
			cin >> x1>> y1;
			x.at(i).push_back(x1-1);
			y.at(i).push_back(y1);
			
		}
	}
	int N2=N;
	// vector<vector<int>> ran;
	int p =(1<<16);
	vector <vector<int>> hito(p,vector<int>(16,0));
	
	for(int t=0;t<(1<<16);t++){
		bitset<16> s(t);
		for(int i=0;i<N;i++){
			if(s.test(i)){
				hito.at(t).at(i)=1;
			}
		}
	}
	
	
	int ans=0;
	solve(N,x,y,hito,ans);

	// cout<<ans.size()<<endl;
	cout<<ans<<endl;
	
}






Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

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

int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
vector<int> a(101);


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int D, G;
    cin >> D >> G;
    vector<int> p(D), c(D);
    for (int i = 0; i < D; ++i) {
        cin >> p[i] >> c[i];
    }
    int ans = 1e9;
    for (int mask = 0; mask < (1 << D); ++mask) {
        int s = 0, num = 0, rest_max = -1;
        for (int i = 0; i < D; ++i) {
            if (mask >> i & 1) {
                s += 100 * (i + 1)*p[i] + c[i];
                num += p[i];
            }
            else {
                rest_max = i;
            }
        }
        if (s < G) {
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if (need >= p[rest_max]) continue;
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  string s; cin >> s;
  REP(i, s.size()) {
    if (i==5 || i == 13) cout << ' ';
    else cout << s[i];
  }
  cout << endl;
  return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    int l=0, r=100000;
    rep(i, m){
        int tl, tr;
        cin >> tl >> tr;
        if(l < tl)l = tl;
        if(tr < r)r = tr;
    }
    int ans = r - l + 1;
    if(ans < 0)ans = 0;

    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver2.2.2
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){Vout(a[lY]);}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void uniq(Vi &v){sort(ALL(v)); v.erase(unique(ALL(v)),v.end());}  //  uniqのやつ

int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n,m;
  cin >> n >> m;
  Vi a(n);
  int qw,er;
  rep(i,0,m){
    cin >> qw >> er;
    qw--,er--;
    a[qw]++,a[er]++;
    
  }
  rep(i,0,n){
    if(a[i]%2==1){cNO;return 0;}
  }
  cYES;
  return 0;
}

Measured memory_bytes: 1024
n, m = gets.chomp.split(' ').map(&:to_i)
h = gets.chomp.split(' ').map(&:to_i)
map = {}
n.times { |i| map[i] = h[i] }
m.times do
  a, b = gets.chomp.split(' ').map { |i| i.to_i - 1 }
  map[a] = [map[a], map[a] == h[b] ? map[a] + 1 : h[b]].max
  map[b] = [map[b], map[b] == h[a] ? map[b] + 1 : h[a]].max
end
count = 0
n.times do |i|
  count += 1 if h[i] == map[i]
end
puts count

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> r(N + 1, 0), g(N + 1, 0), b(N + 1, 0);
    rep(i, N) {
        r[i + 1] = r[i];
        g[i + 1] = g[i];
        b[i + 1] = b[i];
        if (S[i] == 'R') r[i + 1]++;
        if (S[i] == 'G') g[i + 1]++;
        if (S[i] == 'B') b[i + 1]++;
    }
    ll ans = 0;
    rep(i, N - 2) {
        for (int j = i + 2; j < N; j++) {
            if (S[i] == S[j]) continue;
            if ((S[i] == 'R' && S[j] == 'G') || (S[i] == 'G' && S[j] == 'R')) {
                ans += b[j] - b[i];
                if ((i + j) % 2 == 0 && S[(i + j) / 2] == 'B') ans--;
            }
            if ((S[i] == 'R' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'R')) {
                ans += g[j] - g[i];
                if ((i + j) % 2 == 0 && S[(i + j) / 2] == 'G') ans--;
            }
            if ((S[i] == 'G' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'G')) {
                ans += r[j] - r[i];
                if ((i + j) % 2 == 0 && S[(i + j) / 2] == 'R') ans--;
            }
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3636
#include <cmath>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<ll,ll> pii;
typedef tuple<ll,ll,ll> t3;

using namespace std;


int main() {
    int a,b,c;
    map<int,int> m;
    cin >> a >> b >> c;
    m[a]++;
    m[b]++;
    m[c]++;
    for(auto e : m)
    {
        if(e.second == 1)
        {
            cout << e.first << endl;
            return 0;
        }
    }
    return 0;
}


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

using namespace std;

int main() {
    string str;
    cin >> str;
    set<char> st;
    for(int i=0; i<str.size(); i++) {
        st.insert(str[i]);
    }
    if(st.size()%2) {
        cout << "No" << endl;
    } else {
        if((st.find('S')!=st.end()&&st.find('N')!=st.end()) || (st.find('E')!=st.end()&&st.find('W')!=st.end())) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
    
}

Measured memory_bytes: 256
// #include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=998244353;
ll mod1=1e9+5;
 
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
	 
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution


int32_t main()
{
    IOS
   
	
	int n,s;
	cin>>n>>s;
	int a[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int ans=0;
	int dp[n+1][s+1];
	memset(dp,0,sizeof(dp));
	dp[0][0]++;
	for(int i=1;i<=n;i++)
	{
		int sum=0,in=-1;
		for(int j=0;j<=s;j++)
			dp[i][j]=dp[i-1][j];
		dp[i][0]++;
		for(int j=a[i];j<=s;j++)
		{
			dp[i][j]+=dp[i-1][j-a[i]];
			dp[i][j]%=mod;
		}
		ans+=dp[i][s];
		ans%=mod;
	}
	cout<<ans;
}       

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

int main(){
  int N;
  cin >> N;
  vector<long long> X(5);
  for(int i=0; i<N; i++){
    string S;
    cin >> S;
    if(S.at(0)=='M') X.at(0)++;
    if(S.at(0)=='A') X.at(1)++;
    if(S.at(0)=='R') X.at(2)++;
    if(S.at(0)=='C') X.at(3)++;
    if(S.at(0)=='H') X.at(4)++;
  }
  long long ans=0;
  for(int i=0; i<3; i++){
    for(int j=i+1; j<4; j++){
      for(int k=j+1; k<5; k++) ans+=X.at(i)*X.at(j)*X.at(k);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double PI=3.14159265358979323846;



int main(){
   ll n,cnt=0;
   string s;
ll ans[10101]= { };
cin>>n;
REP(i,1,101) {  
REP(j,1,101) {  
REP(k,1,101) {  
if(i*i+j*j+k*k+j*k+j*i+i*k>n)break;
ans[i*i+j*j+k*k+j*k+j*i+i*k]++;
}
} 
}

rep(i,n) {
cout<<ans[i+1]<<endl;
}

   
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;i++)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;i--)
#define x first
#define y second
#define I inline
#define OP operator
#define pb push_back
#define mp make_pair
#define RT return *this
#define dbg(x) cerr<<#x" = "<<x<<endl
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef long long ll;typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=((TT=but)+fread(but,1,1<<15,stdin)),TT==mo))?-1:*TT++)
I bool IS(char x){return x==10||x==13||x==' ';}
struct Cg{I char OP()(){return getchar();}};struct Cp{I void OP()(char x){putchar(x);}};
#define RX char c,f=1;while(!isdigit(c=P()))f=c!='-';x=c-'0';while(isdigit(c=P()))x=x*10+c-'0';x=f?x:-x
#define TR *this,x;return x
struct Fr{Cg P;I Fr&OP,(int&x){RX;RT;}I OP int(){int x;TR;}I Fr&OP,(ll &x){RX;RT;}I OP ll(){ll x;TR;}
I Fr&OP,(char&x){while(IS(x=P()));RT;}I OP char(){char x;TR;}
I Fr&OP,(char*x){char t=P();for(;IS(t);t=P());if(~t){for(;!IS(t)&&~t;t=P())*x++=t;}*x++=0;RT;}}in;
#define WI if(x){if(x<0)P('-'),x=-x;char s[22],c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0')
struct Fw{Cp P;I Fw&OP,(int x){WI;RT;}I Fw&OP,(ll x){WI;RT;}I Fw&OP,(char x){P(x);RT;}
I Fw&OP,(const char *x){while(*x)P(*x++);RT;}}out;
const int N=1e5+11;
int n,a[N],b[N],c[N];
int f[N];
ll ans,A;
int main(){
	in,n;
	rep(i,1,n)a[i]=in;
	rep(i,1,n)b[i]=in;
	rep(i,1,n)c[i]=in;
	sort(a+1,a+n+1),sort(b+1,b+n+1),sort(c+1,c+n+1);
	int tmp=n;
	per(i,1,n) {
		while(c[tmp]>b[i])tmp--;
		f[i]=n-tmp;
	}
	tmp=n;
	per(i,1,n){
		while(b[tmp]>a[i])ans+=f[tmp--];
		A+=ans;
	}
	cout<<A<<endl;
} 

Measured memory_bytes: 1920
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if (b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if (c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
    else if (c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
    else
        cout << b << " " << a << " " << c << endl;
}


Measured memory_bytes: 3100
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

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

ll N;
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
  cin>>N;
  ll coins500 , coins5 , ans = 0;

  coins500 = N/500;
  N %= 500;
  coins5 = N/5;
  N%=5;

  ans = 1000*coins500 + 5*coins5;
  cout<<ans<<'\n';



}



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

	return 0;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
long long positive_mod(long long a, long long b) {
  /*mod演算。return value range [0,b-1]*/
  if (b < 0) assert(false);
  if (a < 0) {
    a += (LL)(ceil(((double)-a / b))) * b;
  }
  return a % b;
}

int main() {
  int n;
  cin >> n;
  VEC<LL> a(n), b(n);
  REP(i, 0, n) { cin >> a[i] >> b[i]; }
  LL sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    LL surplus = (a[i] + sum) % b[i];
    sum += (surplus == 0 ? 0 : b[i] - surplus);
    // DUMP(sum);
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
typedef pair<int,int> P;

vector<int> G[100010];
int d[100010];

void bfs(int n) {
    queue<int> que;
    for (int i = 1; i <= n; i++) d[i] = -1;
    d[1] = 0;
    que.push(1);
    while(que.size()) {
        int p = que.front(); que.pop();
        for (int t : G[p]) {
            if (d[t] == -1) {
                que.push(t),d[t]=p;
            }
        }
    }
}

int main() {
    int n,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);
    }
    bfs(n);
    cout << "Yes\n";
    for (int i = 2; i <= n; i++) cout << d[i] << "\n";
}

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

int main(void) {
    int d, n;

    scanf("%d", &d);
    scanf("%d", &n);

    int base = 0;
    switch (d) {
        case 0: base = 1; break;
        case 1: base = 100; break;
        case 2: base = 10000; break;
    }

    int result = (n!=100) ? base*n : base*(n+1);
    printf("%d\n", result);

    return 0;
}


Measured memory_bytes: 128
# D - Lunlun Number

from collections import deque

k = int(input())

d = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for _ in range(k):
    ans = d.popleft()
    keta1 = ans%10
    for i in [-1, 0, 1]:
        if keta1+i>=0 and keta1+i<=9:
            d.append(ans*10+keta1+i)

print(ans)

Measured memory_bytes: 11932
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n=9999,m=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)if(s[i]=='C'){n=i;break;}
	for(int i=0;i<s.size();i++)if(s[i]=='F')m=i;
	if(n<m)cout<<"Yes"<<endl;else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
    #include <math.h>
    #include <vector>
    #include <string>
    using namespace std;
    int main() {
        int n;cin>>n;
        int sum=0;
        int max=0;
        for(int i=0;i<n;i++){
            int tlen; cin>>tlen;
            sum+=tlen;
            max = (tlen > max)? tlen : max;
        }
        string out =  (max < (sum-max)) ? "Yes":"No"; 
        cout << out << endl;
    }

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <cmath>
#include <iomanip>
 
using namespace std;
 
 
int main () {
 
    double N, K;
    cin>>N>>K;
    double prob_above = 0;
    double prob_below = 0;
    int max = N;
    if(N>=K){
        prob_above = ((N-K+1))/(N);
        max = K-1;
    }
 
    for(int i=1; i<=max; i++){
        prob_below+=(1.0f/N)*pow(1.0f/2.0f, ceil(log2(double(K)/i)));
    }
    cout<<std::setprecision(10)<<prob_above+prob_below<<endl;
 
    return 0;
 
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::min;
fn dfs(x:usize, y:usize, z:usize) -> usize{
    //println!("{} {} {}",x,y,z);
    if x == 0 {
        if y == 1{
            return 1;
        }
        else{
            return 0;
        }
    }
    if y == 0{
        return 0;
    }
    else {
        let bl = (z - 3)/2;
        if y <= bl + 1{
            return dfs(x - 1, y - 1 , bl);
                
        }
        else{
            let mut tmp = 0;
            if y == z {tmp = 1;}
            let mut full = 1;
            for _ in  0..x-1{
                full = full * 2 + 1;
            }
            return full + dfs(x - 1 , y - (bl + 2 + tmp), bl) + 1;

        }
    }
        

    
}
fn main() {
    input! {
        n: usize,
        x: usize
    }
    let mut leng :usize = 1 ;
    for i in 0..n{
        leng = leng * 2 + 3;
    }
    
    let ans = dfs(n,x,leng);
    println!("{}",ans);
}



Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <cmath>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <iomanip>

#define MOD (1000000007)
using namespace std;

typedef long long ll;

int main() {

    int A, B, H, M;

    cin >> A >> B >> H >> M;

    double rad = abs(6 * M - (30 * H + 30 * ((double)M/60)));

    rad = fmod(rad, 360);

    double a = sqrt(pow(A,2) + pow(B, 2) - 2 * A * B * cos((double)rad * acos(-1) / 180.0));

    cout << fixed << setprecision(9);
    cout << a << endl;



    return 0;
}


Measured memory_bytes: 4228
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,i,s=0,b;
    scanf("%d",&a);
    b=a;
    while(b)
    {
        s+=b%10;
        b=b/10;
    }
    //printf("%d\n",s);
    if(a%s==0)
        printf("Yes\n");
    else
        printf("No\n");

}


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

const int INF = 1e+9;

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

  int avg[2]={0};
  if (sum % N == 0) {
    avg[0] = sum / N;
  } else {
    avg[0] = sum / N;
    avg[1] = avg[0] + 1;
  }

  int ans=INF, tmp;
  for (int i=0; i<2; i++) {
    tmp = 0;
    for (int j=0; j<N; j++) {
      tmp += (a[j]-avg[i]) * (a[j]-avg[i]);
    }
    if (ans > tmp) ans = tmp;
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (ll) 1e9 + 7;

int count_bit(int n) {
    int num  = 0;
    int mask = 1;

    for ( ; mask != 0 ; mask = mask << 1 ){
        if (n & mask )
            num++;
    }

    return num;
}

int main(){
    ll n;
    cin >> n;
    vector<vector<pll>> v(n, vector<pll>());
    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        for (int j = 0; j < a; j++) {
            ll x, y;
            cin >> x >> y;
            v[i].emplace_back(x - 1, y);
        }
    }

    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++) {
        bool flag = true;
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) {
                for (auto&& x : v[i]) {
                    if (((bit & (1 << x.first)) > 0) != (x.second))
                        flag = false;
                }
            }
        }
        if (flag)
            ans = max(ans, count_bit(bit));
    }
    cout << ans << "\n";
}

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

using namespace std;
#define ll long long int
int const mod=1000000007;
int main()
{
    string s,t;
    cin>>s>>t;
    ll n=s.size();
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]!=t[i])
            ans++;
    }
    cout<<ans;
}


Measured memory_bytes: 3856
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n, k;
    cin >> n >> k;
    int arr[n + 1];
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
    }
    int dp[n + 1];
    memset(dp, 0, (n + 1) * sizeof(int));
    dp[1] = 0;
    for (int i = 2; i <= n; i++)
    {
        int mn=1000000000;
        for(int j=i-1;j>=i-k && j>0;j--)
        {
            int temp = dp[j]+abs(arr[i]-arr[j]);
            if(temp<=mn)
            {
                mn = temp;
            }
        }
        dp[i] = mn;
 
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
	
		string[] args = Console.ReadLine().Split(' ');
		int D = Int32.Parse(args[0]);
		int X = Int32.Parse(args[1]);

		int ans = X;
		for(int i = 0; i < N; i++)
		{
			int A = Int32.Parse(Console.ReadLine());
			ans += ((D - 1)/A + 1);
		}

		Console.WriteLine(ans);
	}
}





Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a == c)
    {
        cout << "No" << endl;
    }
    else if (a != b && a != c && b != c)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

template <class Integer>
Integer ceil(Integer x, Integer y)
{
    return (x + y - 1) / y;
}

void prog()
{
    input in;
    output out;

    int h, a;
    in >> h, a;
    out(ceil(h, a));
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define dump(x) cerr << #x << "=" << x <<endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);

void solve()
{
	/*--------------------------*/

	int K, X; cin >> K >> X;
	if (500 * K >= X) cout << "Yes" << endl;
	else cout << "No" << endl;

	/*--------------------------*/
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}

Measured memory_bytes: 256
using System;

class _0051
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        char[] bar;
        int max, min;
        for (int i = 0; i < n; i++)
        {
            bar = Console.ReadLine().ToCharArray();
            Array.Sort(bar);
            min = int.Parse(new string(bar));
            Array.Reverse(bar);
            max = int.Parse(new string(bar));
            Console.WriteLine(max - min);
        }
    }
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 51;
int layers[N];
int patties[N];

int solve(int n, int x) {
    if(n == 0) return x;
    if(x == 0) return 0;
    
    x--;
    int ret = 0;
    if(x >= layers[n-1]) {
        ret += patties[n-1];
        x -= layers[n-1];

        if(x > 0) {
            ret += 1;
            x--;
        }
    }
    ret += solve(n-1, min(x, layers[n-1]));
    return ret;
}

int32_t main() {

    int n, x; cin >> n >> x;

    layers[0] = 1;
    patties[0] = 1;
    for(int i = 1; i <= 50; ++i) {
        layers[i] = layers[i-1]*2 + 3;
        patties[i] = patties[i-1]*2 + 1;
    }
    
    int ans = solve(n, x);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += (lower_bound(A.begin(), A.end(), B[i]) - A.begin()) * (C.end() - upper_bound(C.begin(),C.end(), B[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public Main() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();

        HashMap<Integer, Integer> C = new HashMap<>();
        for (int x = 1; x*x < 2*N; x++) {
            for (int y = 1; (x+y)*(x+y) < 2*N; y++) {
                for (int z = 1; (x+y+z)*(x+y+z) < 5*N; z++) {
                    int key = x*x+y*y+z*z+x*y+y*z+z*x;
                    C.put(key, C.getOrDefault(key,0)+1);
                }
            }
        }

        for (int i = 1; i <= N; i++) {
            System.out.println(C.getOrDefault(i,0));
        }
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 57864
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int dp[MAXN], h[MAXN];
int main()
{
    int n, k; scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
    memset(dp, 0x3f3f3f3f, sizeof(dp));
    dp[1] = 0;
    for (int i = 2; i <= n; i++) 
        for (int j = 1; j <= k; j++)
            if (i - j >= 1) dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    printf("%d\n", dp[n]);
    return 0;
}

Measured memory_bytes: 1024
import sys

# 立方体で数字が自由なさいころ
class Dice:
    def __init__(self, top, bottom, front, rear, right, left):
        self.top = top
        self.front = front
        self.right = right
        self.bottom = bottom
        self.rear = rear
        self.left = left

    def rotate_front(self):
        t, b, f, r = self.top, self.bottom, self.front, self.rear
        self.top = r
        self.bottom = f
        self.front = t
        self.rear = b

    def rotate_rear(self):
        t, b, f, r = self.top, self.bottom, self.front, self.rear
        self.top = f
        self.bottom = r
        self.front = b
        self.rear = t

    def rotate_right(self):
        t, b, r, l = self.top, self.bottom, self.right, self.left
        self.top = l
        self.bottom = r
        self.right = t
        self.left = b

    def rotate_left(self):
        t, b, r, l = self.top, self.bottom, self.right, self.left
        self.top = r
        self.bottom = l
        self.right = b
        self.left = t

    def get_tfr(self):
        return [self.top, self.front, self.right]

    def get_all(self):
        return (self.top, self.bottom, self.front, self.rear, self.right, self.left)

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    top, front, right, left, rear, bottom = map(int, input().split())
    top2, front2, right2, left2, rear2, bottom2 = map(int, input().split())
    d = Dice(top, bottom, front, rear, right, left)
    states = set()

    states.add(d.get_all())
    for _ in range(3):
        d.rotate_right()
        states.add(d.get_all())
    d.rotate_front()
    d.rotate_front()
    states.add(d.get_all())
    for _ in range(3):
        d.rotate_right()
        states.add(d.get_all())

    d.rotate_front()
    states.add(d.get_all())
    for _ in range(3):
        d.rotate_right()
        states.add(d.get_all())
    d.rotate_front()
    d.rotate_front()
    states.add(d.get_all())
    for _ in range(3):
        d.rotate_right()
        states.add(d.get_all())

    d.rotate_right()
    d.rotate_front()
    states.add(d.get_all())
    for _ in range(3):
        d.rotate_right()
        states.add(d.get_all())
    d.rotate_front()
    d.rotate_front()
    states.add(d.get_all())
    for _ in range(3):
        d.rotate_right()
        states.add(d.get_all())
    # print(tftor)

    if (top2, bottom2, front2, rear2, right2, left2) in states:
        print("Yes")
    else:
        print("No")

main()



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

int countSequence(int sum) {
    ll dp[2001];
    dp[0]=1;
    dp[1]=0;
    dp[2]=0;
    dp[3]=1;
    for(int i=4;i<=sum;i++) {
        ll total=0;
        for(int j=3;j<=i;j++) {
            total=(total+dp[i-j])%mod;
        }
        dp[i]=total;
    }
    return dp[sum];
}
int main() {
    int s;
    cin>>s;
    int size=s-3+1;
    int arr[size];
    int start=3;
    for(int i=0;i<size;i++) {
        arr[i]=start;
        start++;
    }

    int ans = countSequence(s);
    cout<<ans;
}


Measured memory_bytes: 3648
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	firstB := -1
	for i, v := range s {
		if v == 'B' {
			firstB = i
			break
		}
	}
	if firstB == -1 {
		fmt.Println(0)
		return
	}
	sum := 0
	for i := firstB + 1; i < len(s); i++ {
		if s[i] == 'W' {
			sum += i - firstB
			firstB++
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    string s,t;cin>>s>>t;
    ll mn=INT_MAX;
    f(i,0,s.size()-t.size()+1){
        ll cnt=0;
        ll x=i;
        f(j,0,t.size()){
            cnt+=(s[x]!=t[j]);
            x++;
        }
        mn=min(mn,cnt);
    }
    cout<<mn;
    return 0;  
} 





Measured memory_bytes: 3652
def num(i)
  if i <= 1000
    return i + 1
  else
    return 1000 - i % 1001
  end
end

readlines.map(&:to_i).each{|n|
  cnt = 0
  0.upto(n+1){|i|
    if n - i <= 2000 && i <= 2000
      cnt += num(i) * num(n-i)
    end
  }
  puts cnt
}

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

 for (int i = 0; i < N; ++i){
   B[i] = 0;
 }

  for (int i = 0; i < N-1; ++i){
    cin >> A[i];
    B[A[i]-1] ++;
  }
 
 for (int i = 0; i < N; ++i){
   cout << B[i] << endl;
 }
 
}

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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> cnt(N);
	for (int i = 0, a, b; i < M; i++) {
		cin >> a >> b;
		cnt[a - 1]++;
		cnt[b - 1]++;
	}
	int res = 0;
	for (int i = 0; i < N; i++) {
		res |= cnt[i];
	}
	cout << ((res & 1) ? "NO" : "YES") << endl;
	return 0;
}


Measured memory_bytes: 640
n=gets.to_i
vs=n.times.map{[]}
$<.each.with_index{|s,i|
  a,b=s.split.map{|t| t.to_i-1 }
  vs[a].push([b,i])
  vs[b].push([a,i])
}
k=vs.map(&:size).max
es=[]
q=[[0,-1,-1]]
while t=q.shift
  cv,pv,pc=t
  c=1
  vs[cv].each{|v,e|
    next if v==pv
    c+=1 if c==pc
    es[e]=c
    q.push([v,cv,c])
    c+=1
  }
end
puts k,es

Measured memory_bytes: 28924
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    if len(L)==0:
        print(len(S))
    else:
        print(L[0])

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

int main(void) {
	int N;
	string A, B, C;
	cin >> N >> A >> B >> C;

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (A[i] == B[i] && B[i] == C[i])
			continue;
		else if (A[i] != B[i] && B[i] != C[i] && C[i] != A[i])
			ans += 2;
		else
			++ans;
	}

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


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

 for(int i=0;i<s.size();i++){
   if(i%2==0)
    cout<<s.at(i);
 }

 cout<<endl;

	return 0;
}

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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char a, b;
    cin >> a >> b;
    cout << (a == b ? "H" : "D") << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#define INF 100000000
using namespace std;
typedef long long ll;
ll n, m, r, R[9], a[20000], b[20000], c[20000], dst[201][201], dstr[9][9], dp[1<<8][8];

void warshall_floid(){
	for(ll k = 1; k <= n; k++)
		for(ll i = 1; i <= n; i++)
			for(ll j = 1; j <= n; j++)
				dst[i][j] = min(dst[i][k]+dst[k][j], dst[i][j]);
}

int main() {
	cin >> n >> m >> r;
	for(ll i = 0; i < r; i++)cin >> R[i];
	for(ll i = 1; i <= n; i++){for(ll j = 1; j <= n; j++){dst[i][j] = INF;} dst[i][i] = 0;}
	for(ll i = 0; i < m; i++){
		cin >> a[i] >> b[i] >> c[i];
		dst[a[i]][b[i]] = c[i];
		dst[b[i]][a[i]] = c[i];
	}
	
	warshall_floid();
	
	for(ll i = 0; i < r; i++){for(ll j = 0; j < r; j++){dstr[i][j] = dst[R[i]][R[j]];}}
	for(int bit = 0; bit < (1<<r); bit++){for(ll i = 0; i < r; i++){dp[bit][i] = INF;}}
	for(ll i = 0; i <= r; i++){dp[1<<i][i] = 0;}
	
	for(int bit = 0; bit < (1<<r); bit++){
		for(ll i = 0; i < r; i++){
			if(bit&(1<<i)){
				for(ll j = 0; j < r; j++){
					if(bit&(1<<j) && j != i){
						dp[bit][i] = min(dp[bit&~(1<<i)][j]+dstr[j][i], dp[bit][i]);
					}
				}	
			}
		}
	}
	//for(ll i = 1; i <= n; i++){for(ll j = 1; j <= n; j++){cout << dst[i][j];}cout << endl;}
	//for(ll i = 0; i < r; i++){for(ll j = 0; j < r; j++){cout << dstr[i][j];}cout << endl;}
	ll ans = INF;
	for(ll i = 0; i < r; i++){ans = min(dp[(1<<r)-1][i], ans);}
	cout << ans;
	//for(int bit = 0; bit < (1<<r); bit++){for(ll i = 0; i < r; i++){cout << dp[bit][i] << endl;}}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  long ans = 0;
  cin >> N;
  vector<long> B(N-1);
  for (int i; i < N-1; i++) {
    cin >> B.at(i);
  }
  for (int i; i < N-1; i++) {
    if (i == 0) {
      ans += B.at(i);
    }
    else {
      if (B.at(i) < B.at(i-1)) {
        ans += B.at(i);
      }
      else {
        ans += B.at(i-1);
      }
    }
  }
  cout << ans + B.at(N-2) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#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 rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int a, b;
	int sum = 0;

	cin >> a >> b;

	if (a > b) {
		sum += a;
		a--;
	}
	else {
		sum += b;
		b--;
	}

	if (a > b) {
		sum += a;
		a--;
	}
	else {
		sum += b;
		b--;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

const int MAXN = 100005;

int n;
string s[MAXN];

void pitaj (int x) {
	if (s[x]!="") return;
	cout << x << endl << flush;
	cin >> s[x];
}

int main () {
	cin >> n;
	pitaj(0);
	if (s[0]=="Vacant") return 0;
	int low=1, high=n-1, mid;
	while (low<high) {
		mid=(low+high)/2;
		pitaj(mid);
		if (s[mid]=="Vacant") return 0;
		if (mid%2==0 && s[0]==s[mid] || mid%2==1 && s[0]!=s[mid]) {
			low=mid+1;
		} else {
			high=mid-1;
		}
	}
	pitaj(low);
	return 0;
}

Measured memory_bytes: 1620