akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int H, W, D;
	cin >> H >> W >> D;

	Int a;
	vector<vector<Int>> num(H * W+1, vector<Int>(2));

	for (Int i = 1; i <= H; i++) {
		for (Int j = 1; j <= W; j++) {
			cin >> a;
			//a--;
			num[a][0] = i;
			num[a][1] = j;
		}
	}

	//vector<vector<Int>> s(D, vector<Int>(H * W+1));
	vector<vector<Int>> s(D);
	Int temp1;
	Int temp2;
	Int res;
	for (Int i = 0; i < D; i++) {//Dで割ったあまりがiスタート
		temp1 = i;
		res = 0;
		while (temp1 <= H * W) {
			//s[i][temp1] = res;
			s[i].push_back(res);
			temp2 = temp1 + D;
			if (temp2 <= H * W) {
				res += abs(num[temp1][0] - num[temp2][0]) + abs(num[temp1][1] - num[temp2][1]);
			}
			temp1 += D;
		}
	}

	Int Q;
	cin >> Q;

	Int L, R;
	for (Int i = 0; i < Q; i++) {
		cin >> L >> R;
		//L--;
		//R--;

		temp1 = L % D;
		cout << s[temp1][R/D] - s[temp1][L/D] << "\n";

	}

}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
int main(){
    int h,w;cin >> h >> w;
    vector<vector<int>> grid(h+1,vector<int>(w+1));//1-indexed
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> grid[i][j];
        }
    }
    vector<int> operate[h*w-1];
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(j==w&&i!=h){
                if(grid[i][j]%2==1){
                    operate[(i-1)*w+j-1].push_back(i);
                    operate[(i-1)*w+j-1].push_back(j);
                    operate[(i-1)*w+j-1].push_back(i+1);
                    operate[(i-1)*w+j-1].push_back(j);
                    grid[i][j]--;
                    grid[i+1][j]++;
                }
            }
            else if(i<=h&&j<w){
                if(grid[i][j]%2==1){
                    operate[(i-1)*w+j-1].push_back(i);
                    operate[(i-1)*w+j-1].push_back(j);
                    operate[(i-1)*w+j-1].push_back(i);
                    operate[(i-1)*w+j-1].push_back(j+1);
                    grid[i][j]--;
                    grid[i][j+1]++;
                }
            }
        }
    }
    int cnt=0;
    for(int i=0;i<h*w-1;i++){
        if(operate[i].size()==0) continue;
        cnt++;
    }
    cout << cnt << endl;
    for(int i=0;i<h*w-1;i++){
        if(operate[i].size()==0) continue;
        cout << operate[i][0] << " " << operate[i][1] << " " << operate[i][2] << " " << operate[i][3] << endl;
    }
    return 0;
}

Measured memory_bytes: 12928
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int H,W,K;
vector<string> S;

int sum[11][1010];

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

  cin>>H>>W>>K;
  S.resize(H);
  rep(i,H) cin>>S[i];

  /*for(int i=0;i<H;i++) rep(j,W) sum[i][j]=S[i][j]-'0';

  for(int i=0;i<H;i++){
    for(int j=1;j<W;j++) sum[i][j]+=sum[i][j-1];
  }
  for(int j=0;j<W;j++){
    for(int i=1;i<H;i++) sum[i][j]+=sum[i-1][j];
  }

  rep(i,H){
    rep(j,W) cout<<sum[i][j]<<" ";
    cout<<endl;
  }*/

  int ans=MOD;
  for(int bit=0;bit<(1<<(H-1));bit++){
    int P=__builtin_popcount(bit);
    vector<int> line;
    line.push_back(0);
    for(int i=0;i<H-1;i++){
      if(bit&(1<<i)) line.push_back(i+1);
    }

    vector<int> num(P+1,0);
    vector<int> trans(H,0);
    int now=0;
    for(int i=0;i<H;i++){
      if(now+1<line.size()&&line[now+1]==i) now++;
      trans[i]=now;
    }

    int res=0;
    bool dame=false;
    for(int j=0;j<W;j++){
      vector<int> nxt(P+1,0);
      for(int i=0;i<H;i++){
        if(S[i][j]=='1') nxt[trans[i]]++;
      }

      for(int i=0;i<num.size();i++) if(nxt[i]>K) dame=true;
      if(dame) break;
      
      bool ng=false;
      rep(i,num.size()) if(num[i]+nxt[i]>K) ng=true;
      if(ng){
        res++;
        rep(i,num.size()) num[i]=nxt[i];
      }else rep(i,num.size()) num[i]+=nxt[i];
    }
    if(dame) continue;
    chmin(ans,res+P);
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
s=str(input())

l=[]
for i in range(len(s)):
        if s[i] == 'A':
                continue
        elif s[i] =='T':
                continue
        elif s[i] =='C':
                continue
        elif s[i] =='G':
                continue
        else:
                l.append(i)


if l==[]:
        print(len(s))
else:
        ans=l[0]
        l.append(len(s))
        for j in range(len(l)-1):
                if l[j+1]-l[j]-1>=ans:
                        ans=l[j+1]-l[j]-1
        print(ans)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;

ll N;

std::vector<ll> divisors( ll x )
{
  std::vector<ll> ret;

  for( ll i = 1; i*i <= x; ++i ) if( x % i == 0 )
  {
    if( i != 1 )
      ret.emplace_back( i );
    
    if( x/i != 1 && i != x/i )
      ret.emplace_back( x/i );
  }

  return ret;
}

ll ans;

int main()
{
  std::cin >> N;

  auto cs = divisors( N-1 );

  ans += cs.size();

  auto ds = divisors( N );

  for( auto d : ds )
  {
    ll y = N/d;

    while( y % d == 0 )
      y /= d;

    if( y%d == 1 )
      ++ans;
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int W, H, aw, ah;
    int min_d = 100000;
    int min_h = 100000;

    while (cin>>H>>W, H||W) {
        // init
        aw = 0;
        ah = 0;
        min_d = 100000;
        min_h = 100000;
        // solve
        int D = W * W + H * H;
        for (int h = 1; h < 151; ++h) {
            for (int w = 1; w < 151; ++w) {
                if (w <= h) continue;
                int d = h * h + w * w;
                // equal
                if (D == d && H < h) {
                    if (h < min_h) {
                        min_d = d;
                        min_h = h;
                        ah = h;
                        aw = w;
                    }
                }
                // diff
                else {
                    if (D < d) {
                        if (d < min_d) {
                            min_d = d;
                            ah = h;
                            aw = w;
                        }
                    }
                }
            }
        }
        cout<<ah<<" "<<aw<<endl;
    }

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    // int min_c = 1e6;
    // rep(i, n) {
    //     int count = 0;
    //     rep(j, n) {
    //         if (j < i) {
    //             if (s[j] == 'W') {
    //                 count++;
    //             }
    //         } else if (i < j) {
    //             if (s[j] == 'E') {
    //                 count++;
    //             }
    //         }
    //     }
    //     min_c = min(min_c, count);
    // }
    // cout << min_c << endl;
    vector<int> west(n);
    vector<int> east(n);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'W') {
            if (i == 0) {
                west[i] = 1;
            } else {
                west[i] = west[i-1] + 1;
            }
        } else {
            west[i] = west[i-1];
        }
        if (s[n-1-i] == 'E') {
            if (i == 0) {
                east[n-1-i] = 1;
            } else {
                east[n-1-i] = east[n-i] + 1;
            }
        } else {
            east[n-1-i] = east[n-i];
        }
    }
    int min_c = 1e9;
    rep(i, n) {
        // if (i == 0) {
        //     min_c = min(min_c, east[i+1]);
        // } else if (i == n-1) {
        //     min_c = min(min_c, west[i-1]);
        // } else {
        //     min_c = min(min_c, west[i-1] + east[i+1]);
        // }
        min_c = min(min_c, west[i]+east[i]-1);
    }
    cout << min_c << endl;
}

Measured memory_bytes: 6124
#include <stdio.h>

int m,n;
int max;

void search(int data[][n+2],int count,int j,int i){
	data[j][i]=0;//薄氷を割る
	int flag=0;
	if(data[j][i-1]==1&&i-1>0){
		search(data,count+1,j,i-1);
		flag=1;
	}
	if(data[j-1][i]==1&&j-1>0){
		search(data,count+1,j-1,i);
		flag=1;
	}
	if(data[j][i+1]==1&&i+1<=n){
		search(data,count+1,j,i+1);
		flag=1;
	}
	if(data[j+1][i]==1&&j+1<=m){
		search(data,count+1,j+1,i);
		flag=1;
	}
	if(flag==0){
		if(max<count){
			max=count;
		}
	}
	data[j][i]=1;//影響を与えるので戻す
	return ;
}

int main(){
	int i,j;
	roop:
	scanf("%d",&m);//横(m)*縦(n)
	scanf("%d",&n);
	if(m==0&&n==0){
		return 0;
	}
	max=0;
	int data[m+2][n+2];//周りを割れた氷で覆う
	for(i=0;i<n+2;i++){
		data[i][0]=0;
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			scanf("%d",&data[j][i]);
		}
		data[0][i]=0;
		data[n+1][i]=0;
	}
	for(i=0;i<n+2;i++){
		data[i][n+1]=0;
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			if(data[j][i]==1){
				search(data,1,j,i);
			}
		}
	}
	printf("%d\n",max);
	goto roop;
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
#define _Sync ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
#define _End return cout << '\n' , 0 ;
#define fo(i,x,y) for (int i = x; i < y; i++)
#define fd(i,x,y) for(int i = x; i>= y; i--)
#define ll long long
#define clr(A,x) memset(A, x, sizeof A)
#define pb push_back
#define mod 1000000007
#define debug(x) cout <<#x << " = " << x << endl
#define PI 3.14159265
#define MAXN 100001

using namespace std;


int main ()
{
    _Sync
    //freopen("D:/input.txt","r",stdin);
    int a,b;
    cin>>a>>b;
    int ans = max(a+b,a+a-1);
    ans= max(ans,b+b-1);
    cout<<ans<<endl;
}


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

int main(){
  int n,W;
  cin>>n>>W;
  int w[n],v[n];
  int DP[n+1][W+1];
  for(int i=0;i<n;i++){
    cin>>v[i]>>w[i];
  }
  for(int j=0;j<=W;j++){
    DP[0][j]=0;
  }
  for(int i=1;i<=n;i++){
    for(int j=0;j<=W;j++){
      if(j<w[i-1]){
        DP[i][j]=DP[i-1][j];
      }else{
        if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1]){
          DP[i][j]=DP[i-1][j];
        }else{
          DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
        }
      }
    }
  }
  cout<<DP[n][W]<<endl;
  return 0;
}



Measured memory_bytes: 7072
h, w, d = map(int, input().split())

a = [list(map(int, input().split())) for i in range(h)]

dic = [0] * (h * w)

for i in range(h):
    for j in range(w):
        dic[a[i][j] - 1] = i, j

s = [0] * (h * w)
        
for i in range(d, h * w):
    j = i - d
        
    y, x = dic[j]
    ny, nx = dic[i]
    s[i] = s[i - d] + abs(ny - y) + abs(nx - x)

q = int(input())

for i in range(q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    print(s[r] - s[l])

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  ll N; cin>>N;
  ll res = 0;
  vector<ll> A(N+1); rep1(i,N)cin>>A.at(i);
  map<ll,set<ll>> L;
  map<ll,vector<ll>> R;
  rep1(i,N){
    L[i-A.at(i)].insert(i);
    R[i+A.at(i)].push_back(i);
  }
  for(auto p:R){
    sort(begin(p.second),end(p.second));
  }
  
  for(auto p:L){
    if(!R.count(p.first))continue;
    else{
    
      for(auto i_l: p.second){
        auto iter = lower_bound(begin(R[p.first]),end(R[p.first]),i_l);
        res += (ll)distance(begin(R[p.first]),iter);
      }
    }
  }
  cout<<res<<endl;
}


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

using namespace std;

#define int long long
//#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

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

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  bitset<64> mask[n];
  rep(i, n) {
    int k, b;
    cin >> k;
    rep(j, k) {
      cin >> b;
      mask[i].set(b);
    }
  }

  int q;
  cin >> q;
  bitset<64> bit;
  while(q--) {
    int k, i;
    cin >> k >> i;
    switch(k) {
    case 0: cout << bit.test(i) << endl; break;
    case 1: bit |= mask[i]; break;
    case 2: bit &= ~mask[i]; break;
    case 3: cout << ((bit&mask[i]) == mask[i]) << endl; break;
    case 4: cout << (bit&mask[i]).any() << endl; break;
    case 5: cout << !(bit&mask[i]).any() << endl; break;
    case 6: cout << (bit&mask[i]).count() << endl; break;
    case 7: cout << (bit&mask[i]).to_ullong() << endl; break;
    }
  }

  return 0;
}



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

vector<pair<ll, ll> > ans;

ll sum(ll n) {
    return (n*(n+1))/2;
}

int main() {
    ll n, k;
    cin >> n >> k;

    for(int i = 1; i < n; ++i)
        ans.push_back({1, i+1});

    ll tot = sum(n-2);

    if(tot < k) {
        cout << -1 << endl;
        return 0;
    }

    //cout << tot << endl;
    for(int i = 2;  i <= n and tot > k; ++i) {
        for(int j = i+1; j <= n and tot > k; ++j) {
            ans.push_back({i, j}), --tot;
            //cout << i << ", " << j << " : " << tot << endl;
        }
    }

    if(tot != k) {
        cout << -1 << endl;
        return 0;
    }

    cout << ans.size() << endl;
    for(auto it : ans)
        cout << it.first << " " << it.second << endl;

    return 0;
}

Measured memory_bytes: 512
//In the name of "ALLAH"
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    char c;
    cin>>a>>c>>b;
    if(c=='+')
    {
        cout<<a+b;
    }
    else
    {
        cout<<a-b;
    }
    cout<<endl;
}


Measured memory_bytes: 3584
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;
using namespace std;

int main(){
    for (int i=0; i<5; ++i){
        int x;
        cin >> x;
        if (x==0) cout << i+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3160
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  int n,y;
  cin>>n>>y;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      if((y-10000*i-5000*j)==(n-i-j)*1000){
        cout<<i<<' '<<j<<' '<<(y-10000*i-5000*j)/1000<<endl;
        return 0;
      }
    }
  }
  
  cout<<-1<<' '<<-1<<' '<<-1<<endl;
  
}




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

using namespace std;

int main() {
  string s;
  cin >> s;
  int counter = 0;
  if ( s[0] == 'o' ) ++counter;
  if ( s[1] == 'o' ) ++counter;
  if ( s[2] == 'o' ) ++counter;
  cout << 700 + counter * 100 << endl;
  return 0;
}


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

int main(){
	
	int n,m; cin>>n>>m;
	int l0{1},r0{n};
	for(int i=0; i<m; i++){
		int l,r; cin>>l>>r;
		l0 = max(l0,l);
		r0 = min(r0,r);
	}
	cout << (r0-l0>=0?r0-l0+1:0) << endl;
	
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())
length = b+1 -a
num = []

for i in range(a, min(b, a+k-1)+1):
    print(i)
    num.append(i)
for i in range(max(a, b - (k-1)), b+1):
    if i not in num:
        num.append(i)
        print(i)

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>

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

int main() {
  int N,M,C,a;
  cin >> N >> M >> C;
  vector<int> b(M);
  int cnt = 0;

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

  for(int i=0; i<N; i++){
      int sum = 0;
    for(int i=0; i<M; i++){
      cin >> a;
      sum += a * b[i];
    }
    sum += C;
    if(sum >0) cnt++;
  }
  
  cout << cnt << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define per(i,n) for(long long i = (long long)(n-1);i >= 0;--i)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define PER(i,s,t) for(long long i=s;i>t;--i)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
int main(){
  ll n,k,s;
  cin>>n>>k>>s;
  vector<ll> a(n,s+1);
  if(s<1000000000){
    rep(i,k){
    a[i]=s;
  }
  rep(i,n){
    cout<<a[i]<<" ";
  }
  cout<<endl;
  }
  if(s==1000000000){
    rep(i,n){
      a[i]=1;
    }
    rep(i,k){
      a[i]=s;
    }
    rep(i,n){
    cout<<a[i]<<" ";
  }
  cout<<endl;
  }
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  string s; cin >> s;
  int x, y; cin >> x >> y;

  Graph move(2);  // (horizontal, vertical)
  int dist = 0;
  int direction = 0;

  for (auto c : s) {
    if (c == 'F') {
      ++dist;
    }
    else {
      move[direction].push_back(dist);
      dist = 0;
      direction = 1 - direction;
    }
  }
  move[direction].push_back(dist);

  if (move[0].empty()) {
    if (x == 0 && y == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
  }

  unordered_set<int> sx, sy;
  sx.insert(move[0][0]);
  sy.insert(0);
  move[0].erase(move[0].begin());

  for (auto a : move[0]) {
    unordered_set<int> tmp;
    for (auto p : sx) {
      tmp.insert(p+a);
      tmp.insert(p-a);
    }
    sx = tmp;
  }

  for (auto b : move[1]) {
    unordered_set<int> tmp;
    for (auto p : sy) {
      tmp.insert(p+b);
      tmp.insert(p-b);
    }
    sy = tmp;
  }

  if (sx.count(x) && sy.count(y)) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;

const ll MOD_CONST = 1000000007;

int main() {
	int n;
	cin >> n;
	map<int, int> m;
	for (int i = 2; i <= n;i++) {
		int num = i;
		
		for (int j = 2;j <=i;j++) {
			while (num%j ==0) {
				num /= j;
				m[j]++;
			}
			if (num == 0) {
				break;
			}
		}
	}

	ll ans = 1;
	for (auto it = m.begin(); it != m.end(); it++) {
		
		ans = (ans* (it->second + 1)) % MOD_CONST;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    string S;
    cin >> S;
    string T = "ATCG";
    
    int ans = 0;
    int sum = 0;
    for (int i = 0; i < S.size(); i++) {
        bool flag = false;
        for (int j = 0; j < T.size(); j++) {
            if (S[i] == T[j]) {
                flag = true;
            }
        }
        if (!flag) {
            sum = 0;
        }else{
            sum++;
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
    
}

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

int main() {
    int N;
    cin >> N;
    int min = INT_MAX, cnt = 0;
    for (int i = 0; i < N; i++) {
        int num;
        cin >> num;
        if (min > num) {
            cnt++;
            min = num;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
def bellmanford(G, s):
    n = len(G)
    inf = float('inf')
    dist = [inf] * n
    dist[s] = 0
    for i in range(2*n):
        for v in range(n):
            for w, c in G[v]:
                if dist[w] > dist[v] + c:
                    dist[w] = dist[v] + c
                    if i >= n - 1:
                        return -1
    return dist
import sys
input = sys.stdin.readline

def main():
    inf = float("inf")
    V, E, r = map(int, input().split())
    graph = [[] for _ in range(V)]
    for _ in range(E):
        s, t, d = map(int, input().split())
        graph[s].append((t, d))
    dist = bellmanford(graph, r)
    if dist == -1:
        print("NEGATIVE CYCLE")
    else:
        for d in dist:
            if d == inf:
                print("INF")
            else:
                print(d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 6048
#include<stdio.h>
#include<ctype.h>
int main(){

  int i;
  char ch;

  while(1){

  scanf("%c", &ch);

  if ( ch == '\n' ) {
    printf("\n");
    break;
  }

  if ( isupper ( ch ) ){
    i = tolower( ch );
    printf("%c", i );
  } else {
    i = toupper ( ch );
    printf("%c", i );
  }

  }
  
  return 0;

}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    multiset<int>s;
    int cnt=0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(s.find(x)==s.end())s.emplace(x);
        else s.erase(x);
    }
    cout<<s.size()<<endl;
}


Measured memory_bytes: 8192
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
#define rep(i,n) for (int i=0; i<(n); ++i)

using namespace std;
using ll = long long;

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

    if(a<=9 && b <= 9){
        cout << a*b;
    }
    else {
        cout << "-1";
    }
}

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

int main(){
    int a, b, x, y, z;
    cin >> a >> b;
    x = a + b;
    y = a - b;
    z = a * b;
    int ans = max(max(x, y), z);
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
def function():
    N,M = map(int, input().split())
    paths = []
    for _ in range(N+1):
        paths.append([])
    
    for _m in range(M):
        A,B = map(int, input().split())
        paths[A].append(B)
        paths[B].append(A)
    
    dist = [-1]*(N+1)
    dist[1] = 0
    pre = [-1]*(N+1)
    q = [1] # 1からスタート
    while len(q) != 0:
        i = q.pop(0)
        for ne in paths[i]:
            if dist[ne] == -1:
                dist[ne] = dist[i]+1
                pre[ne] = i
                q.append(ne)
    #print(dist)
    print('Yes')
    pre.pop(0)
    pre.pop(0)
    for d in pre:
        print(d)

if __name__ == '__main__':
    function()


Measured memory_bytes: 34864
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl


using ll = long long;
const ll mod = LLONG_MAX;


int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ans=0;
  ans=min(b,d)-max(a,c);
  cout<<max(ans,0)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
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;
}
const long long INF = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    int hi, h, ans = 1;
    cin >> hi;
    rep(i, n - 1)
    {
        cin >> h;
        if (hi <= h)
        {
            hi = h;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;

public class Main {
	static int n;

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// n = Integer.parseInt(br.readLine());

		String str[] = br.readLine().split(" ");

		n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		ArrayList<Edge> edge = new ArrayList<>();

		for (int i = 0; i < m; i++) {
			str = br.readLine().split(" ");

			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;
			int c = Integer.parseInt(str[2]);
			edge.add(new Edge(a, b, c));
		}

		long ans = bellmanford(edge, 0, n - 1);

		if (ans == Long.MIN_VALUE)
			System.out.println("inf");
		else
			System.out.println(ans);
	}

	static long bellmanford(ArrayList<Edge> edge, int s, int g) {
		long[] dist = new long[n];
		int count = 0;
		long ans = 0;

		Arrays.fill(dist, Long.MIN_VALUE);
		dist[s] = 0;

		boolean loop = false;
		boolean update = true;

		while (update && !loop) {
			update = false;
			for (Edge e : edge) {
				if (dist[e.from] != Long.MIN_VALUE && dist[e.from] + e.cost > dist[e.to]) {
					dist[e.to] = dist[e.from] + e.cost;
					update = true;

				}
			}
			if (count == n) {
				ans = dist[n - 1];
			}
			if (count == 2 * n) {
				if (ans < dist[n - 1]) {
					return Long.MIN_VALUE;
				} else {
					return dist[g];
				}
			}
			count++;
		}
		return dist[g];
	}
}

class Edge implements Comparable<Edge> {

	int from;
	int to;
	long cost;

	public Edge(int from, int to, long cost) {
		this.from = from;
		this.to = to;
		this.cost = cost;
	}

	@Override
	public int compareTo(Edge e) {
		return (int) (this.cost - e.cost);
	}
}


Measured memory_bytes: 26152
import numpy
h,w = map(int,input().split())
grid = numpy.empty([h,w], str)
white_h = []
white_w = []
for i in range(h):
    grid[i] = list(input())
for i in range(h):
    if "#" not in grid[i]:
        white_h.append(i)
for i in range(w):
    if "#" not in grid[:, i]:
        white_w.append(i)
ans_grid = numpy.empty([h-len(white_h), w-len(white_w)], str)
cnt_h = 0
for i in range(h):
    if i not in white_h:
        cnt_w = 0
        for j in range(w):
            if j not in white_w:
                ans_grid[cnt_h, cnt_w] = grid[i,j]
                cnt_w += 1
        cnt_h += 1
for i in range(len(ans_grid)):
    print("".join(ans_grid[i]))





Measured memory_bytes: 20624
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define N 100003
int bas,son;
#define orta (bas+son)/2

int main(){
	string s;
	cin>>s;
	if(s[0] == s[1] and s[1] == s[2]){
		
			cout<<"No";
			return 0;
	}
	cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,n,i,j;
    cin>>a>>b;
    if(a%2==0||b%2==0)
    {
        cout<<"Even"<<endl;
    }
    else
    {
        cout<<"Odd"<<endl;
    }
    
}


Measured memory_bytes: 256
import sys
from operator import or_
sys.setrecursionlimit(10 ** 7)

# AC
# Python3 (3.4.3) TLE
# PyPy3 (2.4.0) 1572 ms


class SegmentTree:
    """
    引数：
        N: 処理する区間の長さ
        operator: モノイド演算 (max, min, __add__,ラムダ式,関数定義など)
        UNIT: 単位元
        a: 長さNの配列 a で初期化（a を与えない場合、単位元で初期化）
    注意: 内部的には 1-indexed
    """

    def __init__(self, N, operator, unit, a=None):
        self.op = operator
        self.UNIT = unit

        self.N0 = 2**(N-1).bit_length()
        self.tree = [self.UNIT]*(2*self.N0)
        if a != None:
            self.tree[self.N0:self.N0+N] = a[:]
            for k in range(self.N0-1, 0, -1):
                self.tree[k] = self.op(self.tree[2*k], self.tree[2*k+1])

    # a_k の値を x に更新
    def update(self, k, x):
        k += self.N0
        self.tree[k] = x
        k //= 2
        while k:
            self.tree[k] = self.op(self.tree[2*k], self.tree[2*k+1])
            k //= 2

    # 区間[l,r)をopでまとめる
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.UNIT
        while L < R:
            if R & 1:
                R -= 1
                s = self.op(self.tree[R], s)
            if L & 1:
                s = self.op(s, self.tree[L])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def get(self, k):  # k番目の値を取得。query[k,k]と同じ
        return self.tree[k + self.N0]

    def all(self):
        return self.tree[1]


N = int(input())
S = input()
S = [1 << (ord(x) - 97) for x in S]

seg = SegmentTree(N, or_, 0, S)

Q = int(input())

ans = []
for _ in range(Q):
    q, a, b = input().split()

    if q == '1':
        b = 1 << (ord(b) - 97)
        seg.update(int(a) - 1, b)
    else:
        r = seg.query(int(a) - 1, int(b))
        cnt = 0

        for i in range(26):
            if r & (1 << i):
                cnt += 1

        ans.append(str(cnt))


print("\n".join(ans))


Measured memory_bytes: 48980
module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n")[0],n=r.length,t={},o=0;o<n;o++){var u=r[o];t[u]||(t[u]=[],0!=o&&t[u].push(0)),t[u].push(o)}var a={};for(var i in t){var f=t[i];f.slice(-1)!=n-1&&f.push(n-1);for(var l=-1,c=1;c<f.length-1;c++){var p=f[c]-f[c-1];0!=f[c-1]&&(p-=1);var s=f[c+1]-f[c];f[c+1]!=n-1&&(s-=1);var v=Math.max(p,s);v>l&&(l=v)}-1==l&&(l=n+1),a[i]={Ta:l}}var d=n+1,b=0;for(var y in a){b+=1;var g=a[y].Ta;g<d&&(d=g)}1!=b?console.log(d):console.log(0)}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 7500
m, d2 = map(int, input().split())
count = 0
for m in range(1,m+1):
    for d in range(1,d2+1):
        d = str(d)
        if len(d) < 2:
            continue
        d1 = int(d[1])
        d10 = int(d[0])
        if d10 >= 2 and d1 >= 2 and d10 * d1 == m:
            count += 1
print(count)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double sec = sc.nextInt();
    int num = sc.nextInt();
    double maxSec = sc.nextInt();
    sc.close();
    maxSec += 0.5;
    double mult = maxSec / sec;
    System.out.println((int)mult * num);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)

int main() 
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	int a,b,ct=0;
	cin>>a>>b;
	int c[a];
	forr(i,0,a)
		cin>>c[i];
	sort(c,c+a);
	forr(i,0,b)
		ct+=c[i];
	cout<<ct;
	return 0; 	
}

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

int f(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
 
int main() {
  int n;
  int an=0;
  int bn=0;
  vector<int> a={};
  vector<int> b={};
  vector<int> numa={};
  vector<int> numb={};
  cin>>n;
  for(int i=0;i<n;i++){
    int c;
    cin>>c;
    a.push_back(c);
    numa.push_back(i+1);
  }
  for(int j=0;j<n;j++){
    int c;
    cin>>c;
    b.push_back(c);
    numb.push_back(j+1);
  }
  
  for(int i=0;i<n;i++){
    vector<int>::iterator p = find(numa.begin(), numa.end(),a[i]);
    if( p != numa.end() ){
      an += (p - numa.begin())*f(n-1-i);
    }
    numa[p - numa.begin()]=1000;
    sort(numa.begin(),numa.end());
  }
  for(int i=0;i<n;i++){
    vector<int>::iterator p = find(numb.begin(), numb.end(),b[i]);
    if( p != numb.end() ){
      bn += (p - numb.begin())*f(n-1-i);
    }
    numb[p - numb.begin()]=1000;
    sort(numb.begin(),numb.end());
  }
  

  cout<<abs(an-bn)<<endl;
  
    
    
  
}

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

int main() {
  int a, b; cin >> a >> b;
  if(a+b == 15) cout << "+" << endl;
  else if(a*b == 15){
    cout << "*" << endl;
  }
  else {
    cout << "x" << endl;
  }
  return 0;
}


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

typedef long long ll;
typedef long double ld;

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

    ll a, b, c, d, e, f, g;
    cin >> a >> b >> c >> d >> e >> f >> g;
    ll res = b + 2*(a/2) + 2*(d/2) + 2*(e/2);
    if(a && d && e) res = max(res, b + 3 + 2*((a-1)/2) + 2*((d-1)/2) + 2*((e-1)/2));
    cout << res;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
mod=10**9+7

DP=[1]+[0]*13

for i in range(N):
    NDP=[0]*14

    NDP[0]=DP[0]*2+DP[1]*2+DP[5]*2+DP[7]*2+DP[9]+DP[10]+DP[11]*2+DP[13]
    NDP[1]=DP[0]+DP[13]
    NDP[2]=DP[1]+DP[9]+DP[10]+DP[11]
    NDP[3]=DP[0]+DP[5]+DP[7]+DP[13]
    NDP[4]=DP[2]+DP[3]+DP[12]
    NDP[5]=DP[3]+DP[6]
    NDP[6]=DP[2]+DP[3]+DP[6]+DP[12]
    NDP[7]=DP[2]+DP[3]+DP[6]+DP[12]
    NDP[8]=DP[6]
    NDP[9]=DP[7]
    NDP[10]=DP[4]+DP[8]
    NDP[11]=DP[1]+DP[9]+DP[10]+DP[11]
    NDP[12]=DP[4]+DP[8]
    NDP[13]=DP[4]+DP[8]

    for i in range(14):
        NDP[i]=NDP[i]%mod


    DP=NDP
    #print(DP)

print(sum(DP)%mod)

Measured memory_bytes: 3064
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n - 2):
    if (p[i] < p[i + 1] and p[i + 1] < p[i + 2]) or (p[i] > p[i + 1] and p[i + 1] > p[i + 2]):
        cnt += 1
print(cnt)

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

int main() {
    long int x;
    cin >> x;
    long int tmp = x;
    long int fx = 0;
    for(int i = 0; i < 9; i++) {
        fx += (long int)tmp/(long int)pow(10.0, (double)8-i);
        tmp -= (long int)tmp/(long int)pow(10.0, (double)8-i) * (long int)pow(10.0,8-i);
    }
    if(x%fx == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
    public:
    const int MAXN=3e5+10;
    const ll mod=1e9+7;
    int n;
    vector<ll>a;
    void solve(){
        ios::sync_with_stdio(false);
        cin>>n;
        a.resize(n);
        for(auto &e:a)cin>>e;
        ll ans=0;
        for(int u=0;u<=60;u++){
            ll bits=0;
            for(int v=0;v<n;v++){
                if((a[v]>>u)&(1ll))bits++;
            }
            ans=(ans+((1ll)<<u)%mod*bits%mod*(n-bits)%mod)%mod;
        }
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main()
{
    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];
    int sum = 0;
    rep(i, 3)
    {
        sum += A[i];
    }
    if (sum >= 22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back

const int maxn = 2e6 + 10;
const int maxm = 2;
const ll mod = 1e9 + 7;


multiset < int > s;
set < int > st;
map < int , int > mp;
int a[maxn], b[maxn];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n, k;
  cin >> n >> k;
  for(int i = 0; i < n; ++i) {
		cin >> a[i];
		st.insert(a[i]);
		mp[a[i]] ++;
  }
  int z = 0;
  while(st.size()) {
		b[z ++] = mp[*st.begin()];
		st.erase(st.begin());
  }
  sort(b, b + z);
  int maj = 0;
  if(z <= k) {
		cout << 0 << endl;;
		return 0;
  }
  int i = z - 1;
  while(k --) {
		maj += b[i];
		i --;
  }
  cout << n - maj << endl;
  return 0;
}








Measured memory_bytes: 23936
def cross(ux, uy, vx, vy):
    return ux*vy - uy*vx


n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]

area = 0
x1, y1 = points[0]
for i in range(1, n - 1):
    xi, yi = points[i]
    xj, yj = points[i + 1]
    area += cross(xi - x1, yi - y1, xj - x1, yj - y1)

print('{:.1f}'.format(area / 2))



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

int main(){
    int n,m;
    cin>>n>>m;
    int a[n][m];
    int b[m],c[n];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        c[i]=0;
        for(int j=0;j<m;j++){
            c[i]+=a[i][j]*b[j];
        }
        cout<<c[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3092
N=int(input())
A=[0]+list(map(int,input().split()))+[0]
T=0
for i in range(N+1):
    T+=abs(A[i+1]-A[i])
for i in range(1,N+1):
    ex=abs(A[i-1]-A[i])+abs(A[i]-A[i+1])
    add=abs(A[i+1]-A[i-1])
    print(T-ex+add)


Measured memory_bytes: 14048
#!/usr/bin/env python3
S = input()
T = input()

if T in S:
    print(0)
    exit()

ans = 10 ** 5
for i in range(len(S) - (len(T) - 1)):
    c = len(T)
    for j in range(len(T)):
        if T[j] == S[i + j]:
            c -= 1
    ans = min(ans, c)

print(ans)


Measured memory_bytes: 9048
#include <bits/stdc++.h>
    
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
    
using namespace std;
    
using ll = long long;
using ld = long double;
using ull = unsigned long long;

signed main(){
    io();
    int a, b; cin >> a >> b;
    cout << (a == b ? "Yes" : "No") << '\n';
    return 0;
}

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

const int infinity = 1234567890;

using namespace std;
#define ll long long
int main() {
	ll n,k;
	cin>>n>>k;
	ll a[n+1],i;
	for(i=0;i<n;i++)
        cin>>a[i];
    ll dp[n+1],j;
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(i=2;i<n;i++){
            dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
        for(j=i-2;j>=0&&j>=i-k;j--)
        {
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }


        }
    cout<<dp[n-1]<<endl;

}


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

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

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size()-1; i++) {
    if(s[i] == 'A' && s[i+1] == 'C'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var v = o.l();
  var ans = 0;
  for(var i = 1; i <= k && i <= n; i++){
      for(var l = 0; l <= i; l++){
        var m = [];
        var s = 0;
        for(var l2 = 0; l2 < l; l2++){
          if(v[l2] < 0)m.push(v[l2]);
          s += v[l2];
        }
        for(var r = 0; r < i-l; r++){
          if(v[n-1-r] < 0)m.push(v[n-1-r]);
          s += v[n-1-r];
        }
        m.sort((a,b)=>a-b);
        for(var x = 0; x < k-i && x < m.length; x++){
          s -= m[x];
        }
        if(s > ans)ans = s;
      }
  }
  return ans;
}

Measured memory_bytes: 8740