akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	unsigned long long X, Y;
	cin >> X >> Y;

	auto count = 0ull;
	for (auto i = X; i <= Y; i *= 2)
	{
		++count;
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(){

   int n, i, j, k, min, swap, r[101], m[100][100];

   scanf("%d", &n);

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

   for(i = 0; i < n; i++){
      m[i][i] = 0;
   }

   for(i = 1; i < n; i++){
      for(j = 0; j < n-i; j++){
         for(k = j; k < i+j; k++){
            swap = m[j][k] + m[k+1][i+j] + r[j]*r[k+1]*r[i+j+1];
            if(j == k || min > swap) {
               min = swap;
            }
            m[j][j+i] = min;
         }
      }
   }

   printf("%d\n", m[0][n-1]);

   return 0;
}

Measured memory_bytes: 1820
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef int SegT;
const int defvalue=2147483647;
class SegTree{
	private:
		vector<SegT>val;
		int n;
		SegT combine(SegT a,SegT b){return min(a,b);}
	public:
		SegTree(int size){
			n=1;
			while(n<size)n<<=1;
			val=vector<SegT>(2*n,defvalue);
		}
		SegTree(const vector<SegT> &in){
			n=1;
			while(n<in.size())n<<=1;
			val=vector<SegT>(2*n,defvalue);
			for(int i=n-1+in.size()-1;i>=0;i--){
				if(n-1<=i)val[i]=in[i-(n-1)];
				else val[i]=combine(val[i*2+1],val[i*2+2]);
			}
		}
		void update(int i,SegT a){
			i+=n-1;
			val[i]=a;
			while(i>0){
				i=(i-1)/2;
				val[i]=combine(val[i*2+1],val[i*2+2]);
			}
		}
		SegT query(int a,int b,int k=0,int l=0,int r=-1){//[a,b)
			if(r==-1)r=n;
			if(r<=a||b<=l)return defvalue;
			if(a<=l&&r<=b)return val[k];
			else return combine(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
		}
		void tmp(){
			rep(i,val.size())cout<<" "<<val[i];cout<<endl;
		}
};

int main(){
	int n,q;
	cin>>n>>q;
	SegTree in(n);
	while(q--){
		int a,b,c;
		cin>>a>>b>>c;
		if(a==0)in.update(b,c);
		else cout<<in.query(b,c+1)<<endl;;
	}
}

Measured memory_bytes: 3116
X = int(raw_input())

nmax = 100000

array = [0]*(nmax+1)
array[0] = 1

value_list = [100,101,102,103,104,105]

for i in range(nmax+1):
    for value in value_list:
        if i - value >= 0:
            if array[i-value] == 1:
                array[i] = 1

print array[X]



Measured memory_bytes: 8580
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

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

    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b>c+d){
        cout << "Left" << endl;

    }
    else if(a+b==c+d){
        cout << "Balanced" <<endl;
    }
    else{
        cout << "Right" << endl;
    }

    

    return 0;
}

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

int main(){
	long long int n,m,ans=1;
	cin>>n>>m;
	vector<long long int>a(1000000);
	vector<long long int>b(1000000);
	vector<long long int>c(1000000);
	for(long long int i=0;i<m;i++){
		cin>>a[i];
	}
	b[0]=1;
	b[1]=1;
	a[m]=n+1;
	for(long long int i=0;i<m;i++){
		c[i]=(a[i+1]-a[i]);
	}
	for(long long int i=2;i<1000000;i++){
		b[i]=(b[i-1]+b[i-2])%1000000007;
	}

	ans=b[a[0]-1];
	for(long long int i=0;i<m;i++){
		if(c[i]-2>-1){
				ans=(ans*b[c[i]-2])%1000000007;
			}
			else{
				ans=0;
			}
		}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 23680
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
static const int MAX=10000;
static const int INFTY=(1<<20);
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;

int n;
vector< pair<int,int> > adj[MAX];

void dijkstra(){
  priority_queue< pair <int,int> > PQ;
  int color[MAX];
  int d[MAX];
  for(int i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }
  d[0]=0;
  PQ.push(make_pair(0,0));
  color[0]=GRAY;

  while(!PQ.empty()){
    pair<int,int> f=PQ.top();PQ.pop();
    int u=f.second;
    color[u]=BLACK;

    if(d[u]<f.first*(-1))continue;

    for(int j=0;j<adj[u].size();j++){
      int v=adj[u][j].first;
      if(color[v]==BLACK)continue;
      if(d[v]>d[u]+adj[u][j].second){
        d[v]=d[u]+adj[u][j].second;
      PQ.push(make_pair(d[v]*(-1),v));
      color[v]=GRAY;
    }
  }
}

for(int i=0;i<n;i++){
  cout<<i<<" "<<(d[i]==INFTY ? -1:d[i] )<<endl;
}
}

int main(){
  int k,u,v,c;
  cin>>n;

  for(int i=0;i<n;i++){
    cin>>u>>k;
    for(int j=0;j<k;j++){
      cin>>v>>c;
      adj[u].push_back(make_pair(v,c));
    }
  }
  dijkstra();
  return 0;
}



Measured memory_bytes: 8084
#include<bits/stdc++.h>
#define ll long long
#define db double
#define lowbit(p) (p&(-p))
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define A first
#define B second
using namespace std;
void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}
/*
每次选择一段长度至少为k的
然后删掉里面最小的

要使的删掉的最大值减最小值最小
然后枚举最小值
然后就不能再碰比当前的最小值要小的数值了

那么就变成了
111111111011111111011111101111111
这样的形式了.
每次都要想个办法找最小的值?
*/
#define M 2005 
ll res;
vector<ll>q[M];
ll a[M],b[M];
int tot,cnt,tim,k,n;
void chk(int val){
	int i,j,sz;
	for (i=1;i<=tot;i++){
		q[i].clear();
	}
	tot=cnt=0;
	tot=1;
	for (i=1;i<=n;i++){
		if (a[i]<val){
			tot++;
		}
		else{
			q[tot].pb(a[i]);
		}
	}
	for (i=1;i<=tot;i++){
		sort(q[i].begin(),q[i].end());
		sz=q[i].size();
		for (j=0;j+k-1<sz;j++)b[++cnt]=q[i][j];
	}
	if (cnt<tim){
		return ;
	}
	sort(b+1,b+cnt+1);	
	Min(res,b[tim]-val);
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	freopen("1.in","r",stdin);
	int i;
	read(n); read(k); read(tim);
	for (i=1;i<=n;i++){
		read(a[i]);
	}
	res=1e9;
	for (i=1;i<=n;i++){
		chk(a[i]);
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 20352
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    bool yes = true;
    for (int i = 0, len = s.length(); i < len; ++i) {
        if ((i % 2 == 0 && s[i] == 'L') || (i % 2 == 1 && s[i] == 'R')) {
            yes = false;
            break;
        }
    }
    cout << (yes ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string today;
    cin >> today;
    if (today == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (today == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
    return 0;
}


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

struct point{
    int s;
    int t;
    int x;
};

int main(){
    int n, q;
    cin >> n >> q;
    point p[n];
    for(int i=0;i<n;i++) cin >> p[i].s >> p[i].t >> p[i].x;
    sort(p,p+n,[](const point& l, const point& r){
        return l.x < r.x;     
    });

    map<int, int> m;
    for(int i=0;i<q;i++) {
        int d;
        cin >> d;
        m[d] = i;
    }

    int ans[q];
    memset(ans, -1, sizeof(ans));
    for(int i=0;i<n;i++){
        auto itr = m.lower_bound(p[i].s-p[i].x);
        int end = p[i].t-p[i].x;
        while(itr != m.end() && itr->first < end) {
            ans[itr->second]=p[i].x;
            m.erase(itr++);
        }
    }

    for(int i=0;i<q;i++) cout << ans[i] << endl;
    return 0;
}


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


int main(){
  
  while(1){
    int a,b;
    cin>>a>>b;
    if(a==0 && b==0){break;}
    if(a%2==1 && b%2==1){cout<<"no"<<endl;}
    else{cout<<"yes"<<endl;}
  }
  
  return 0;
}



Measured memory_bytes: 3056
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	string S; cin >> S;
	int cnt[26] = {};
	rep(i, S.length()) {
		cnt[S[i] - 'a']++;
		if (cnt[S[i] - 'a'] > 1) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;


    return 0;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<LL> a;
  vector<int> op;
  vector<vector<LL>> dp;
  Solver(LL n) : n(n), a(n), op(n), dp(n, vector<LL>(2)){};

  void solve() {
    op[0] = 1;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      if (i < n - 1) {
        char c;
        cin >> c;
        op[i + 1] = (c == '+' ? 1 : -1);
      }
    }
    if (n == 1) {
      cout << a[0] << endl;
    } else if (n == 2) {
      cout << a[0] + a[1] * op[1] << endl;
    } else {
      LL sum = 0;
      for (int i = 0; i < n; ++i) {
        sum += a[i] * op[i];
      }
      LL ans = sum;
      int it = n - 1;
      LL absSumR = 0;
      while (1) {
        sum -= a[it] * op[it];
        absSumR += a[it--];
        if (it < 0 || op[it] == -1) break;
      }
      DBG(sum, absSumR, it)
      LL prev = absSumR;
      for (; it >= 0; --it) {
        sum -= a[it] * op[it];
        absSumR += a[it];
        if (op[it] == -1) {
          ans = max(ans, sum - absSumR + 2 * prev);
          prev = absSumR;
        }
      }
      cout << ans << endl;
    }
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


Measured memory_bytes: 6912
#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define ll long long
#define ld long double
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define f first
#define s second

inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a; a%=b;return gcd(b,a);}
ll power(ll x, ll y){if(y == 0) return 1; ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {if (ex & 1ll) ans = (ans * x) % md; ex >>= 1ll;x = (x * x) % md;}return ans;}

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 1e6 + 1;

void solve(){
    ll c;
    cin >> c;
    string r1;
    while(c > 0){
        if(c%26 == 0){
            r1.pb('z');
            c = c/26;
            c--;
        }
        else{
            r1.pb((char)('a' + (c%26) - 1));
            c = c/26;
        }
    }
    ll len = r1.size();
    for(ll i = len - 1; i >= 0; i--) cout << r1[i];
}
int main(){
    IOS;
    cout << fixed << setprecision(20);
    ll NTC=1;
    // cin>>NTC;
    ll PTC=0;
    while(PTC++<NTC){
        // cout<<"Case #"<<PTC<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define prime 1000000007
#define INF 2147483647
int dx8[8]={-1,0,1,1,1,0,-1,-1};
int dy8[8]={1,1,1,0,-1,-1,-1,0};
int dx4[4]={-1,0,1,0};
int dy4[4]={0,-1,0,1};

const int MAX_N=1<<17;
int n,dat[2*MAX_N-1];
void init(int n_){
    n=1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;i++)dat[i]=INF;
}
void update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
}
int query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l)return INF;
    if(a<=l&&r<=b)return dat[k];
    else{
        int vl=query(a,b,k*2+1,l,(l+r)/2);
        int vr=query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }
}
signed main(void){
    int q;cin>>n>>q;
    init(n);
    rep(i,q){
        int judge;cin>>judge;
        if(judge==0){
            int k,a;cin>>k>>a;
            update(k,a);
            //cout<<dat[k+n-1]<<endl;
        }else{
            int a,b;cin>>a>>b;
            cout<<query(a,b+1,0,0,n)<<endl;
        }
    }
    
}
        



Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;

int main() {
   int n, k;
   cin >> n >> k;
   vector<int> h(n);
   rep(i, n) { cin >> h[i]; }
   sort(h.begin(), h.end(), greater<int>());
   k = min(n, k);
   rep(i, k) { h[i] = 0; }
   llong atk = 0;
   rep(i, n) { atk += h[i]; }
   cout << atk << endl;
   return 0;
}

Measured memory_bytes: 1024
a, b, c = map(int, raw_input().split())

def any_odd(x, y, z):
    if x % 2 or y % 2 or z % 2:
        return True
    else:
        return False

def exchange(a, b, c):
    new_a = b // 2 + c // 2
    new_b = a // 2 + c // 2
    new_c = a // 2 + b // 2
    return new_a, new_b, new_c


if a == b == c and (a + b + c) % 3 == 0 and not any_odd(a, b, c):
    print -1
else:
    k = 0
    while not any_odd(a, b, c):
        a, b, c = exchange(a, b, c)
        k += 1
    print k



Measured memory_bytes: 2568
#include <stdio.h>
int main(){
    char A[10],B[10],C[10],a='A',b='B';
    int n;
    scanf("%s%s%s",A,B,C);
    for(n=0;A[n]!='\0';n++){
    if(A[n]!='\0'&&A[n+1]=='\0'){
            a=A[n];
        }}
    for(n=0;B[n]!='\0';n++){
    if(B[n]!='\0'&&B[n+1]=='\0'){
            b=B[n];
        }}
    if(a==B[0]&&b==C[0]){
        printf("YES");
    }
    else{
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define vv(type)		vector<vector<type>>
#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--)
#define db(x) 			cout<<x<<" "
#define db1(x) 			cout<<x<<'\n'
#define db2(x,y) 		cout<<x<<" "<<y<<'\n'
#define db3(x,y,z) 		cout<<x<<" "<<y<<" "<<z<<'\n'
#define rep(i,n) 		for(int i=0;i<(n);++i)
#define repA(i,a,n) 	for(int i=a;i<=(n);++i)
#define repD(i,a,n) 	for(int i=a;i>=(n);--i)
#define so(a) 			sort(a.begin(),a.end())
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
// to find all local maximaa and minima in O(n)
//	 for (int i=1;i<=n;i++)
//        {
//            if (i==1 || i==n || (p[i-1]<p[i])!=(p[i]<p[i+1]))
//           ans.push_back(p[i]);
//        }
int dx[] = { -1, 1, -1, 0, 0, -1, 1, 1 };
int dy[] = { -1, -1, 1, -1, 1, 0, 0, 1 };
int gcd(int a, int b)
{
	if (!b)
		return a;
	return gcd(b, a % b);
}
int modular_expo(int x, int y, int m)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans % m * x % m) % m;
		x = (x % m * x % m) % m;
		y /= 2;
	}
	return ans % m ;
}
int power(int x, int y)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans * x);
		x *= x;
		y /= 2;
	}
	return ans;
}

vector<vi> multiply(vector<vi> a, vector<vi> b)
{
	int n = a.size();
	vector<vi> res(n, vi(n, 0));
	rep(i, n)
	rep(j, n)
	rep(x, n)
	res[i][j] = (res[i][j] + a[i][x] * b[x][j]) % mod;
	return res;
}

vector<vi> power(vector<vi>mat, int y)
{
	if (y == 1	) return mat;
	vector<vi> res = power(mat, y / 2);
	if (y & 1)
		return multiply(multiply(mat, res), res);
	return multiply(res, res) ;
}
void solve()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, k;
	cin >> n >> k;
	vector<vi>adj(n, vi(n));
	rep(i, n )
	rep(j, n)
	cin >> adj[i][j];
	vector<vi>ak = power(adj, k);
	int ans = 0;
	rep(i, n)
	rep(j, n)
	ans = (ans + ak[i][j]) % mod;
	db1(ans);
}
int32_t main()
{
	solve();
	return 0;
}


Measured memory_bytes: 4920
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define maxn 100005
#define ll long long

void DBG() {
    cerr << "]\n";
}
template <class H, class... T> void DBG(H h, T... t) {
    cerr << h;
    if (sizeof...(t)) {
        cerr << ", ";
    }
    DBG(t...);
}
#define _DEBUG
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

int tt, n, m, k;
int mp[10][10];

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

    cin >> n >> m >> k;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            char x;
            cin>>x;
            mp[i][j] = x=='#';
        }
    }
    int ans = 0;
    for(int a = 0;a<1<<n;a++){
        for(int b = 0;b<1<<m;b++){
            int cnt = 0;
            for(int i = 0;i<n;i++){
                if((a>>i)&1)continue;
                for(int j = 0;j<m;j++){
                    if((b>>j)&1)continue;
                    cnt+=mp[i][j];

                }
            }
            ans+=cnt==k;
        }
    }
    cout<<ans;
    return 0;
}

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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(const auto &buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

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

int main() {
	int x, y; cin >> x >> y;
	int ans = 0;
	if (x == 1 && y == 1) {
		ans += 4;
	}
	if (x <= 3) {
		ans += 4 - x;
	}
	if (y <= 3) {
		ans += 4 - y;
	}
	ans *= 100000;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <list>
#include <cmath>
#include <string>
#include <iterator>
#include <vector>
 
using namespace std;

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 2 * 1e5 + 5;

int largest(int a, int b){
	return (a<b)?b:a;
}

int main() {
	int k = 1, n = 0;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(a[i] != k){
			++ans;
		}
		else{
			++k;
		}
	}
	if(k == 1){
		cout << -1 << endl;
	}
	else{
		cout << ans << endl;
	}

    return 0;
}

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

int max(int a, int b)
{
  if(a>b) return a;
  else return b;
}

int main(void)
{
  char input[160];
  int table[100][60];
  int path[100][60];
  char *token;
  int size, width;
  int i, j;

  i=0; j=0;
  while(scanf("%s", input)!=EOF){
    token=strtok(input, ",");
    while(token!=NULL){
      table[i][j++]=atoi(token);
      token=strtok(NULL, ",");
    }
    i++; j=0;
  }
  size=i;

  path[0][0]=table[0][0];
  for(i=1; i<size; i++){
    if(i<=(size-1)/2){
      width=i+1;
      path[i][0]=path[i-1][0]+table[i][0];
      path[i][width-1]=path[i-1][width-2]+table[i][width-1];
      for(j=1; j<width-1; j++){
	path[i][j]=max(path[i-1][j-1], path[i-1][j])+table[i][j];
      }
    } else {
      width=size-i;
      for(j=0; j<width; j++){
	path[i][j]=max(path[i-1][j],path[i-1][j+1])+table[i][j];
      }
    }
  }
  printf("%d\n", path[size-1][0]);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,c;
  cin>>a;
  c=0;
  for(int i=0;i<a;i++){
    int b;
    cin>>b;
    while(b%2==0){
      b/=2;
      c++;
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = int(sys.stdin.buffer.readline())
AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]

cnt = 0
for a, b in reversed(AB):
    add = (a + cnt) % b
    cnt += (b - add) % b
print(cnt)


Measured memory_bytes: 37292
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int n, m;
  cin >> n >> m;
  if (n >= m) {
    cout << 0 << endl;
    return 0;
  }
  vi32 x(m);
  rep(i, m) cin >> x[i];
  sort(all(x));
  i64 length = x[m - 1] - x[0];
  vi32 d(m - 1, 0);
  rep(i, m - 1) d[i] = x[i + 1] - x[i];
  sort(all(d), greater<i32>());
  rep(i, n - 1) length -= d[i];
  cout << length << endl;
  return 0;
}


Measured memory_bytes: 1792
/**
 *    DP
 *    26.04.2020 14:25
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  double h;
  cin >> N;
  vector<double> dp (N + 1, 0.0);
  /*
    dp[i] = probability of having i heads (so far)
    dp[5] at 8 coins = dp[4] at 7 coins * 8th head + 
                       dp[5] at 7 coins * 8th tail
  */
  
  dp[0] = 1; // p(0 heads) always 1 at 0 coins
  for (int i = 1; i <= N; i++) {
    cin >> h;
    for (int j = i; j >= 0; j--) {
      if (j == 0) dp[j] = dp[j] * (1 - h);
      else dp[j] = dp[j - 1] * h + dp[j] * (1 - h);
    }
  }
  double ans = 0;
  for (int i = N/2 + 1; i <= N; i++) {
    ans += dp[i];
  }
  cout.precision(12);
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

long long x;

int get (int n) {
    int res = 1;
    int tot = 0;

    while (tot + res <= n) {
        tot += res;
        ++ res;
    }

    return res - 1;
}

int main () {

    cin >> x;

    int ans = 0;

    for (long long i = 2 ; i * i <= x ; ++ i) {
        if (x % i == 0) {
            int c = 0;

            do {
                x /= i;
                ++ c;
            } while (x % i == 0);

            ans += get(c);
        }
    }

    if (x > 1) ++ ans;

    cout << ans << endl;
}
/*
    Good Luck
        -Lucina
*/


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

using namespace std;

#define ll long long
#define endl '\n'
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; i++)

int main ()
{
    int n; cin >> n;
    string s, t = ""; cin >> s;

    for (int i = 0; i < s.size()/2; i++)
        t += s[i];

    cout << (s == (t + t) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin>>s;
    if(s[5]=='0'&&s[6]=='1')
      cout<<"Heisei";
    else if(s[5]=='0'&&s[6]=='2')
      cout<<"Heisei";
    else if(s[5]=='0'&&s[6]=='3')
      cout<<"Heisei";
    else if(s[5]=='0'&&s[6]=='4')
      cout<<"Heisei";
    else 
      cout<<"TBD";
      
  cout<<endl;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define brep(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<n;i++)
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
#define ll long long

int main(void){
    int a,b;
    cin >> a >> b;
    cout << a+b/2 <<endl;
    return 0;
}

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

int main() {
	char c;
	cin >> c;
	if (c == 'A') cout << "T" << endl;
	if (c == 'C') cout << "G" << endl;
	if (c == 'G') cout << "C" << endl;
	if (c == 'T') cout << "A" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, (n))

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
input:
    ll n, m;
    cin >> n >> m;

    ll s[n];
    ll t[m];
    rep(i, n) { cin >> s[i]; }
    rep(i, m) { cin >> t[i]; }

calculate:
    ll dp[n + 1][m + 1] = {};
    rep(i, m + 1) { dp[0][i] = 1; }
    rep(i, n + 1) { dp[i][0] = 1; }

    for (ll i = 1; i < n + 1; i++) {
        for (ll j = 1; j < m + 1; j++) {
            if (s[i - 1] != t[j - 1]) {
                dp[i][j] =
                    (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1] + mod) %
                    mod;
            } else {
                dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
            }
        }
    }

    dp[n][m] %= mod;
    cout << dp[n][m] << endl;
    return 0;
}



Measured memory_bytes: 31616
N,D = map(int,input().split())
X = [input().split() for x in range(N)]
ans = 0
d = 0
distance = []
for i in range(N):
  for j in range(i,N):
    if d != 0:
      distance.append(d ** (1/2))
    d = 0
    for k in range(D):
      d += (int(X[i][k]) - int(X[j][k])) ** 2
for i in range(len(distance)):
  if distance[i] - int(distance[i]) == 0:
    ans += 1
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string s;
    cin >> s;
    map<int, int> mp;
    int sum = 0;
    char curr = 'R';
    rep(i, 0, s.size())
    {
        if (curr == 'R' && s[i] == 'R')
            sum++;
        if (curr == 'L' && s[i] == 'L')
            sum++;
        if (curr == 'R' && s[i] == 'L')
        {
            mp[i-1] = sum;
            sum = 1;
            curr = 'L';
        }
        if (curr == 'L' && s[i] == 'R')
        {
            mp[i-1] = sum;
            sum = 1;
            curr = 'R';
        }
        if (i == s.size() - 1)
            mp[i] = sum;
    }
    vector<int> v(s.size(), 0);
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        int r = it->second;
        int i = it->first;
        it++;
        int l = it->second;
        int tot = r + l;
        if (tot % 2 == 0)
        {
            v[i] = tot / 2;
            v[i+1] = tot / 2;
        }
        else if (r % 2 == 0)
        {
            v[i] = tot / 2;
            v[i+1] = tot / 2 + 1;
        }
        else if (r % 2 == 1)
        {
            v[i] = tot / 2 + 1;
            v[i+1] = tot / 2;
        }
    }
    for (auto x:v)
        cout << x << " ";
    return 0;
}

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

int main() {
    string S, T;
    cin >> S >> T;

    int N = S.length(), M = T.length();
    vector<int> cnts(N + 1, 0), cntt(M + 1, 0);
    for (int i = 0; i < N; i++) {
        if (S[i] == 'A') {
            cnts[i + 1] += cnts[i] + 1;
        } else {
            cnts[i + 1] += cnts[i] + 2;
        }
    }
    for (int i = 0; i < M; i++) {
        if (T[i] == 'A') {
            cntt[i + 1] += cntt[i] + 1;
        } else {
            cntt[i + 1] += cntt[i] + 2;
        }
    }

    int Q;
    cin >> Q;
    while (Q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if ((cnts[b] - cnts[a - 1]) % 3 == (cntt[d] - cntt[c - 1]) % 3) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}


Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

//lli gcd(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    if(x%y==0){
//        return y;
//    }
//    else{
//        return gcd(y,x%y);
//    }
//}
//
//lli lcm(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    return x*y/gcd(x,y);
//}

int main(){
    lli n,a,b,c,d;
    string s,ans="Yes",t;
    lli i,j;
    cin>>n>>a>>b>>c>>d>>s;
    if(s.find("##")!=string::npos){
        if(((s.find("##")>a-1)&&(s.find("##")<c-1))||((s.find("##")>b-1)&&(s.find("##")<d-1))){
            ans="No";
        }
    }
    else{
        if(((b-a)*(d-c))<0){
            if(s.find("...")==string::npos){
                ans="No";
            }
            else{
                t=s.substr(b-2,d-b+3);
                if(t.find("...")==string::npos){
                    ans="No";
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll s;
    cin>>s;
    ll x=1000000000;
    ll a=s/x;
    if(a!=x)
    a++;
    ll b=a*x-s;
    cout<<"0 0 1000000000 1 "<<b<<" "<<a<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 256
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	
	#ifndef ONLINE_JUDGE
	freopen("C:/Users/DELL/Desktop/input.txt", "r", stdin);
	#endif

	fast;
	char ch;
	cin>>ch;
	if(ch>='A' && ch<='Z')
		ch = 'A';
	else if(ch>='a' && ch<='z')
		ch='a';
	cout<<ch;
	return 0;
}


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

using namespace std;

typedef long long int ll;

#define FOR(i,l,r) for(i=l;i<r;i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(x) x.begin(),x.end()

#define P pair<ll,ll>

#define F first

#define S second

signed main(){

  ll N,i,ans;cin>>N;

  REP(i,N)cout<<"ACL";cout<<endl;

  return 0;

}

Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main() {
	int n, arr[2000000] = {},x, c = 0, k = 1;
	cin >> n;
	for (int i = 0; i < n-1 ; i++) {
		cin >> x;
		arr[x]++;
	}
	for (int i = 1; i < n+1; i++) {
		cout << arr[i] << endl;
	}
}

Measured memory_bytes: 11448
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<string>
#define ll long long
#define INF 0x3f3f3f3f
#define N 100005
using namespace std;

int a[N],d=0;

int main()
{
	for(ll i=1;i*i<=(ll)1e9;i++)
	{
		a[d++]=i*i;
	}
	int n;
	scanf("%d",&n);
	int ans;
	for(int i=0;i<d;i++)
	{
		if(a[i]<=n)
		{
			ans=a[i];
		}else break;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.math.BigDecimal;
import java.util.*;


// 2011/10/22

//0217 à¢½£
public class Main {

	// C return falseÅ¨µÜ¢
	boolean main() throws IOException {

		int n = 1;
		int[] ir = null;
		//try {

			
			ir = readIntArray();
			
			
			//} catch(Exception e) {
				// ±±ÅáOª­¶
			//return false;
		//}
			if (ir == null || ir.length == 0)
				return false;
			n = ir[0];
			if ( n == 0)
				return false;

		int maxNo = 0;
		int max = 0;
		for(int i = 0; i < n; i++) {
			ir = readIntArray();
			int no = 0;
			int kyori = 0;
				no = ir[0];
				kyori = ir[1] + ir[2];
			if (kyori > max) {
				maxNo = no;
				max = kyori;
			}
		}

		// ðÌ\¦
		System.out.printf("%d %d\n", maxNo, max);
		
		return true; // ³íI¹ Ö
	}
	

//	private final static boolean DEBUG = true;  // debug
	private final static boolean DEBUG = false; // release

	public static void main(String[] args) throws IOException {

		if (DEBUG) {
			log = System.out;
			
			String inputStr = "29:0:";

			inputStr = inputStr.replace(":", "\n");

			reader = new BufferedReader(new StringReader(inputStr)); 

		}
		else {
			log = new PrintStream(new OutputStream() { public void write(int b) {} } ); // «ÌÄ
			reader = new BufferedReader(new InputStreamReader(System.in)); // R\[©ç
		}
		
		//int N = readIntArray()[0];

		for(int i = 0; /*i < N*/; i++) {
			boolean b = new Main().main();
			if (!b)
				break;
		}		
		
		reader.close();
	}

	
	static PrintStream log;
	static BufferedReader reader;
	

	// WüÍæè1sªÌXy[XæØèÌ®lðÇÞ
	// EOFÌêÍnullðÔ·
	private static int[] readIntArray() throws IOException {
		
		String s = reader.readLine();
		if (s.length() == 0)
			s = reader.readLine();
		
		if (s == null /*|| s.length() == 0*/)
			return null;
		s = s.trim();
		String[] sp = s.split(" ");
		int[] a = new int[sp.length];
		for(int i = 0; i < sp.length; i++) {
			a[i] = Integer.parseInt(sp[i]);
		}
		return a;
	}
		
}

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

typedef long long ll;

int W,H;
ll L;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};

char DtoS[] = {'N', 'E', 'S', 'W'};
bool visited[100][100][4];
string field[100];
int table[40005];

pair<int, int> bfs(int sx, int sy, int sd)
{
    memset(visited, 0, sizeof(visited));
    for(int i=0; i<40000; i++) table[i] = -1;
    
    int x = sx, y = sy, d = sd;
    int cost = 0;
    
    while(1) {

	if(visited[x][y][d]) break;
	visited[x][y][d] = true;

	int h = d*10000 + y*100 + x;
	
	table[h] = cost;
	cost++;
	
	for(int i=0; i<4; i++) {
	    int td = (d + i)%4;
	    int tx = x + dx[td];
	    int ty = y + dy[td];

	    if(tx < 0 || ty < 0 || tx >= W || ty >= H) continue;
	    if(field[ty][tx] == '#') continue;
	    
	    d = td;
	    
	    break;
	}
	
	x += dx[d];
	y += dy[d];	
    }

    
    int ret = table[d*10000 + y*100 + x];

    return make_pair(cost, ret);
}

int solve() 
{
    pair<int, int> bfsres;
	
    for(int i=0; i<H; i++)
	for(int j=0; j<W; j++)
	    for(int k=0; k<4; k++) {
		if(DtoS[k] == field[i][j])
		    bfsres = bfs(j, i, k);
	    }

    ll length = bfsres.first;
    ll bias = bfsres.second;
    ll loopL = length - bias;
    ll pos = L;
    
    if ( L >= bias)
	pos = (L-bias)%loopL + bias;    

    int res = 0;
    for(int i=0; i<40000; i++)
	if(table[i]==pos) res = i;

    return res;
}

int main() 
{
    while(cin >> H >> W >> L, (W||H||L)) {
	for(int i=0; i<H; i++)
	    cin >> field[i];

	int res = solve();
	cout << ((res/100)%100 + 1) << " " << (res%100) + 1 << " " << DtoS[res/10000] << endl;
    
    }
}


	
	

    
    

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

int main() {
  int N, M;
  cin >> N;
  vector<string> blue(N);
   for (int i = 0; i < N; i++) {
    cin >> blue.at(i);
   }
  cin >> M;
  vector<string> red(M);
   for (int i = 0; i < M; i++) {
    cin >> red.at(i);
   }
  
  int yen = 0;
  for (int i = 0; i < N; i++) {
   int newyen = 0;
   for (int j = 0; j < N; j++) {
    if (blue.at(i) == blue.at(j)) {
      newyen++;
    }
   }
   for (int j = 0; j < M; j++) {
    if (blue.at(i) == red.at(j)) {
      newyen--;
    }
   }
   yen = max (newyen, yen);
  }
   cout << yen << endl;
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
#include<stdio.h>
#include<math.h>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
typedef pair<Q,ll> R;
ll longinf=1ll<<60;
int inf=1<<29;
//mleしなければぜんぶllでかく。
//↑はあんまり気にしなくていい。



int main(){
      ll n,m;
      cin>>n>>m;
      ll a[n];
      rep0(i,n) cin>>a[i];
      P p[m];
      rep0(j,m){
            ll b,c;
            cin>>b>>c;
            p[j]={c,b};
      }
      sort(a,a+n);
      sort(p,p+m);
      reverse(p,p+m);
      ll pos=0;
      ll ans=0;
      rep0(i,n){
            ans+=a[i];
      }
      for(auto q:p){
            ll b=q.second;
            ll c=q.first;
            ll hoge=min((ll)b+pos,(ll)n);
            REP(i,pos,hoge){
                  if(a[i]<c){
                  ans+=(c-a[i]);
                  a[i]=c;
                  }
            }
            pos=hoge;
      }
      //rep0(i,n) cout<<a[i]<<" ";
      cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] S=sc.nextLine().split("");
		String ans="WA";
		if(S[0].equals("A")) {
			int cnt=0;
			for(int i=2;i<S.length-1;i++) {
				if(S[i].equals("C"))cnt=cnt+1;
			}
			if(cnt==1){
				int upcnt=0;
				for(int i=0;i<S.length;i++) {
					if(Character.isUpperCase( S[i].charAt( 0 ) ) ) {
						upcnt=upcnt+1;
					}
				}
				if(upcnt>2) {
				}else {
					ans="AC";
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21204
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

main = do
  [n] <- readInt
  l <- sort <$> readInt
  print $ solve l n

solve l n = ans
  where
    ls = V.fromList l
    ans =
      sum $
      map
        (\(a, _, _, _) -> a)
        [ (V.length ls' - fst (upperBound ls' (-1) (V.length ls') a), i, j, ls')
        | i <- [n - 1,n - 2 .. 0]
        , j <- [i - 1,i - 2 .. 0]
        , let a = ls V.! i - ls V.! j
        , let ls' = V.take j ls
        ]

upperBound xs s e key
  | e - s == 1 = (e, xs V.!? e)
  | xs V.! mid <= key = upperBound xs mid e key
  | otherwise = upperBound xs s mid key
  where
    mid = (s + e) `div` 2


Measured memory_bytes: 314876
LINE=input()
n=LINE
ans=0
b=1
for i in range(0,int(n)):
  a=input()
  ans=int(a)+ans
  if int(a)>b:
    b=int(a)
print(int(ans-int(b)/2))

# input() -> read a line as a string
# s.split() -> split s by whitespace
# a, b = [3, 4] -> a = 3, b = 4


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

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

    int ans = n * a;
    if (ans <= b){
        cout << ans;
        return 0;
    }

    else{
        cout << b;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 1 * 1e6 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
int main(){/*
    freopen("in","r",stdin);
    freopen("out","w",stdout);*/
    fast;
    int n,cnt = 0;
    string s;
    cin >> n >> s;
    int ans = cnt;
    fore(i,0,sz(s)){
        if(s[i] == 'I')
            cnt++;
        else
            cnt--;
        ans = max(cnt,ans);
    }
    cout << ans << '\n';
    return 0;   
}

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

int main(void) {
    int a,b;
    vector<int> A(101,0);
    while(cin >> a >> b){
        ++A[a];
        ++A[b];
        if(a==0){
            bool isPossible = true;
            for(int i=1; i<=100; ++i) {
                if(i<=2){
                    if(A[i]%2 != 1){
                        isPossible = false;
                        break;
                    }
                } else {
                    if(A[i]%2 != 0){
                        isPossible = false;
                        break;
                    }
                }
            }
            if(isPossible){
                cout << "OK" << endl;
            } else {
                cout << "NG" << endl;
            }
            for(int i=0; i<101; ++i){A[i] = 0;}
        }
    }
}


Measured memory_bytes: 3080