akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		long n = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();

		long ans = (b * (n - 1) + a) - (a * (n - 1) + b) + 1;
		ans = (a > b || (n == 1 && a != b)) ? 0 : ans;

		out.println(ans);
		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public int nextInt() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

}


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

int main() {
  int n;
  double m = 0;
  cin >> n;
  vector<double> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
    m += 1.0 / a.at(i);
  }
  cout << 1.0 / m << endl;
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())
if A + B + C == 17:
  if A == 5:
    if B + C == 12:
      print("YES")
    else:
      print("NO")
  elif A == 7:
    if B + C == 10:
      print("YES")
    else:
      print("NO")
  else:
    print("NO")
else:
  print("NO")


Measured memory_bytes: 3316
n = int(input())
a = list(map(int, input().split()))

INF = 10 ** 18
ans = 1
if any([n == 0 for n in a]):
    print(0)
    exit()

for n in a:
    ans *= n
    if ans > INF:
        ans = -1
        break
print(ans)

Measured memory_bytes: 21656
s=int(input())

if s<3:
    print(0)
    exit()

ans=0

mod = 10**9+7 #出力の制限
n = 10**4 # nの最大値を指定
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

for i in range(s//3):
    s-=3
    ans+=cmb(s+i,i)
    ans%=mod

print(ans)

Measured memory_bytes: 10156
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b;cin>>a>>b;
  print(a*b/__gcd(a,b));
  return 0;
}

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

int main() {
    int x, n;
    cin >> x >> n;
    if (n != 0) {
        vector<int> p(n);
        rep(i, n) cin >> p[i];
        sort(p.begin(), p.end());
        vector<int> p_;
        p_.push_back(p[0]-1);
        rep(i, n) {
            if (p[i+1] > p[i]) {
                rep(j, p[i+1] - p[i] - 1) {
                    p_.push_back(p[i] + j + 1);
                }
            }
        }
        p_.push_back(p[n-1]+1);
        int near = 0;
        rep(i, p_.size()) {
            if (p_[i] >= x) {
                near = i;
                break;
            }
        }
        if (p_[near] - x >= x - p_[near-1]) near--;
        cout << p_[near] << endl;
    }
    else {
        cout << x << endl;
    }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int n ;
  cin >> n ;
  vector<int> vecv(n) ;
  vector<int> vecc(n) ;
  int sum = 0 ;
  
  REP(i, n){
    cin >> vecv.at(i) ;
  }
  REP(i, n){
    cin >> vecc.at(i) ;
  }
  REP(i, n){
    if(vecv.at(i)-vecc.at(i)>0){
      sum += vecv.at(i)-vecc.at(i) ;
    }
  }
  
  cout << sum << endl ;
  
    return 0 ;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

        System.out.println(result ? "Yes" : "No");
    }
}


Measured memory_bytes: 62552
#include <bits/stdc++.h>
using namespace std;
int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return b;
  return gcd(b, a % b);
}

int main() {
  long long int a, b, c, d;
  cin >> a >> b >> c >> d;
  long long int g = gcd(c, d);
  long long int e = (c * d) / g;
  cout << (b - a + 1)  - ((b/c + b/d - b/e) - ((a-1)/c + (a-1)/d - (a-1)/e)) << endl;
}
    

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

int main() {
  int a,b,c;
  cin >> a >> b;
  
  c = a * b % 2;
  
  if (c == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }  
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    # ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int y=1,n;
        cin>>n;
         y=n/1000;
         if(n==y*1000)
            cout<<0<<endl;
        else

        cout<<(y+1)*1000-n<<endl;
        
    
    
    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int H,W;
    while (1) {
        scanf("%d %d",&H,&W);
        if(H==0 && W==0) break;
        for(int i=0; i<H; i++) {
            if (i==0 || i==H-1) {
                for(int j=0; j<W; j++) {
                    printf("#");
                }
            } else {
                for(int j=0; j<W; j++) {
                    if(j==0 || j==W-1) {
                        printf("#");
                    }else {
                        printf(".");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    map<ll, int> mp;
    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        mp[a]++;
    }

    ll a = -1, b = -1;
    for (auto p : mp) {
        if (p.second >= 4) {
            a = p.first;
            b = p.first;
        } else if (p.second >= 2) {
            if (b == -1) {
                b = p.first;
            } else if (a == -1) {
                a = p.first;
            } else {
                a = b;
                b = p.first;
            }
        }
    }
    if (a == -1 || b == -1) {
        cout << 0 << endl;
    } else {
        cout << a * b << endl;
    }
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define int long long
signed main(){
  int a,b,c=0,d;
  cin>>a;
  for(int i=1;i<=a;i++){
    for(int j=2;j<=a+1;j++){
      d=pow(i,j);
      if(d<=a) c=max(d,c);
    }
  }
  cout<<c<<"\n";
}

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

string s;

using result = pair<string,int>;

result st(int p);
result le(int p);
result ci(int p);

result le(int p){
    int k=0;
    while(true){
        if(s[p]=='+') k++;
        else if(s[p]=='-') k--;
        else break;
        p++;
    }
    if(s[p]=='?') return make_pair("A",p+1);
    int ret = s[p]-'A'+k;
    while(ret<0) ret+=26;
    ret%=26;
    string ans="A";
    ans[0]+=ret;
    return make_pair(ans,p+1);
}

result st(int p){
    if(s[p]=='['){
        result ret = ci(p+1);
        ret.second++;//skip ']'
        reverse(ret.first.begin(),ret.first.end());
        return ret;
    }else{
        return le(p);
    }
}

result ci(int p){
    string ans;
    while(p<s.size() and s[p]!=']'){
        result ret=st(p);
        p=ret.second;
        ans+=ret.first;
    }
    return make_pair(ans,p);
}

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

    while(cin>>s){
        if(s==".")break;
        cout<<ci(0).first<<"\n";
    }

    return 0;

}


Measured memory_bytes: 3232
n=int(input())
d=dict()
for _ in range(n):
    hoge=int(input())
    if d.get(hoge,0)==0:
        d[hoge]=1
    else:
        d[hoge]+=1
ans=0
for i in d.values():
    if i%2==1:
        ans+=1
print(ans)

Measured memory_bytes: 19364
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

#define p(a, b) make_pair(a, b)

ll A[301][301];
pair<ll, pair<int, int> > C[90000];

/*================================================
	Dijkstra
================================================*/
typedef ll COST_TYPE;
#define NMAX (301)
#define INF ((ll)1e18)
vector<pair<COST_TYPE, int> > G[NMAX];
COST_TYPE cost[NMAX];
bool done[NMAX] = { false };

void dijkstra(int root)
{
	priority_queue<pair<COST_TYPE, int>, vector<pair<COST_TYPE, int> >, greater<pair<COST_TYPE, int> > > PQ;
	pair<COST_TYPE, int> current;	/* first: cost, second: index */
	COST_TYPE next_cost;
	int current_index, next_index, size;

	rep(i, NMAX) {
		done[i] = false;
		cost[i] = INF;
	}

	cost[root] = 0;
	PQ.push(make_pair(0, root));

	while (!PQ.empty()) {
		current = PQ.top();
		PQ.pop();

		current_index = current.second;

		if (done[current_index]) continue;
		done[current_index] = true;

		size = (int)G[current_index].size();
		rep(i, size) {
			next_index = G[current_index][i].second;
			next_cost = G[current_index][i].first;

			if ((!done[next_index])
				&& (cost[next_index] > cost[current_index] + (COST_TYPE)next_cost)) {
				cost[next_index] = cost[current_index] + (COST_TYPE)next_cost;
				PQ.push(make_pair(cost[next_index], next_index));
			}
		}
	}
}

int main()
{
	int N, num = 0;
	ll ans = 0;

	cin >> N;
	repc(i, 1, N) repc(j, 1, N) cin >> A[i][j];

	repc(i, 1, N - 1) repc(j, i + 1, N) {
		C[num] = p(A[i][j], p(i, j));
		num++;
	}

	sort(C, C + num);

	rep(i, num) {
		ll dis = C[i].first;
		int src = C[i].second.first;
		int dest = C[i].second.second;

		dijkstra(src);

		if (cost[dest] > dis) {
			G[src].push_back(p(dis, dest));
			G[dest].push_back(p(dis, src));
			ans += dis;
		}
		else if (cost[dest] < dis) {
			ans = -1;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1792
#ABC107

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

a = [i for i in a if "#" in i]

b = [("").join(list(i)) for i in list(zip(*a))]

b = [i for i in b if "#" in i]

c = [("").join(list(i)) for i in list(zip(*b))]

for i in c:
    print(i)

Measured memory_bytes: 3064
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};
// variable update
inline void modAdd(int& _a, int _b, int _m) { _a = (_a + _b) % _m; }
inline void modAdd(lint& _a, lint _b, lint _m) { _a = (_a + _b) % _m; }
inline void minUpdate(int& _a, int _b) { _a = min(_a, _b); }
inline void minUpdate(lint& _a, lint _b) { _a = min(_a, _b); }
inline void maxUpdate(int& _a, int _b) { _a = max(_a, _b); }
inline void maxUpdate(lint& _a, lint _b) { _a = max(_a, _b); }

int n, k, a[100010];

void solve() {
	for_(i,1,n) a[i] = a[i] +  a[i - 1];
	int ans = a[k - 1];
	for_(i,k,n) maxUpdate(ans, a[i] - a[i - k]);
	printf("%d\n", ans);;
}

int main() {
	while (cin >> n >> k, n) {
		for_(i,0,n) scanf("%d", &a[i]);
		solve();
	}
	return 0;
}

Measured memory_bytes: 1616
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
	ll hituyou=0;
	ll N,K;
	double kakuritu1,kakuritu_sum=0;
	cin>>N>>K;
	for(ll i=1;i<=N;i++){
		while(i*(int)pow(2.0,hituyou*1.0)<K)hituyou++;
		//cout<<hituyou<<endl;
		kakuritu_sum+=(1.0/(double)N)*pow((1.0/2.0),hituyou*1.0);
		hituyou=0;
	}
	printf("%.12f\n",kakuritu_sum);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  
  int a, b, c, d, e;
  
  a = A % 10; if (a == 0) a = 10;
  b = B % 10; if (b == 0) b = 10;
  c = C % 10; if (c == 0) c = 10; 
  d = D % 10; if (d == 0) d = 10;
  e = E % 10; if (e == 0) e = 10;
  
  int ans1 = min(min(min(min(a, b), c), d), e);
  
  int f, g, h, i, j;
  
  f = (A / 10 + 1) * 10; if (a == 10) f -= 10;
  g = (B / 10 + 1) * 10; if (b == 10) g -= 10;
  h = (C / 10 + 1) * 10; if (c == 10) h -= 10;
  i = (D / 10 + 1) * 10; if (d == 10) i -= 10;
  j = (E / 10 + 1) * 10; if (e == 10) j -= 10;
  
  int ans0 = f + g + h + i + j - 10;
  
  cout << ans0 + ans1 << endl;
}

Measured memory_bytes: 256
// This is my template for fast solving

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <memory>
#include <initializer_list>
#include <iomanip>
#include <stack>
#include <bitset>
#include <cstdio>
// #include <complex>
// #include <random>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
// const ll INF = 1e18;
// const ld INF = 1e20;
// const ll MOD = 1e9 + 7;
// const ld EPS = 1e-10;
// const ld PI = acos(-1);

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (size_t i = 0; i < v.size(); ++i) {
        os << v[i];
        if (i + 1 != v.size()) {
            os << " ";
        }
    }
    return os;
}

// struct Node {

//     Node (int k, int v): l(nullptr), r(nullptr), key(k), value(v), size(1) {}

//     Node* l;
//     Node* r;
//     int key;
//     int value;
//     size_t size;
// };

// Node* insert(Node* p, Node* x) {
//     if (p == nullptr) {
//         return x;
//     }
//     if (p->key > x->key) {
//         p->l = insert(p->l, x);
//     } else {
//         p->r = insert(p->r, x);
//     }
//     p->size += 1;
//     return p;
// }

// size_t size(Node* p) {
//     if (p == nullptr) {
//         return 0;
//     }
//     return p->size;
// }

// Node* find(Node* p, int k) {
//     if (size(p->l) >= k) {
//         return find(p->l, k);
//     }
//     if (size(p->l) + 1 == k) {
//         return p;
//     }
//     return find(p->r, k - size(p->l) - 1);
// }


void solve() {
    map<string, int> m = {{"SUN", 1}, {"MON", 2}, {"TUE", 3}, {"WED", 4}, {"THU", 5}, {"FRI", 6}, {"SAT", 7}};
    string s;
    cin >> s;
    int k = m[s];
    cout << 8 - k << "\n"; 
}

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    // int q;
    // cin >> q;
    // while (q--) {
    //     solve();
    // }

    solve();

    // Node* root = nullptr;

    // root = insert(root, new Node(1, 1));
    // root = insert(root, new Node(2, 2));
    // root = insert(root, new Node(3, 3));
    // root = insert(root, new Node(4, 4));

    // auto res = find(root, 4);

    // cout << res->key << " " << res->value << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define pii pair <int, int>
#define all(vv) (vv).begin(), (vv).end()
#define rep(ii, jj, ll, ss) for(int ii = jj; ii < ll; ii += ss)
#define time cerr << '\n' << (double)clock()/CLOCKS_PER_SEC << '\n'; return 0;

int n;
vector <int> v;

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	bool yay = false;
	int ans = 0;
	cin >> n;
	rep(i, 0, n, 1) {
		int x; cin >> x;
		if (x == 1) yay = true;
		v.pb(x);
	}
	if (!yay) cout << -1;
	else {
		bool ok = false;
		int next = 2;
		rep(i, 0, n-1, 1) {
			if (v[i] == 1) ok = true;
			if (!ok) {
				++ans;
				continue;
			}
			else {
				if (v[i+1] != next) ++ans;
				else ++next;
			}
		}
		cout << ans;
	}
	time
}

Measured memory_bytes: 5304
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int I, ans, T, J, L, S, Z;
	cin >> I >> ans >> T >> J >> L >> S >> Z;

	int anss = ans;

	anss += (I - I % 2) + (L - L % 2) + (J - J % 2);


	if (min(J, L)&&I) {
		ans += 3;
		I--;
		J--;
		L--;
		ans += (I - I % 2) + (L - L % 2) + (J - J % 2);
	
	}

	cout << max(ans,anss) << endl;
	


	return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;

namespace abc108_b
{
    class program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int x1 = int.Parse(input[0]);
            int y1 = int.Parse(input[1]);
            int x2 = int.Parse(input[2]);
            int y2 = int.Parse(input[3]);
            int x3 = x2 + y1 - y2;
            int x4 = x3 - x2 + x1;
            int y3 = y2 + x2 - x1;
            int y4 = y3 + y1 - y2;
            Console.WriteLine(x3 + " " + y3 + " " + x4 + " " + y4);
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long long int a=0,b=0,c=0,A;
  string T;
  cin>>T;
  for(int i=0;i<T.size();i++){
    if(c==0){
      if(T.at(i)=='0'){a++;}
      c=1;
    }
    else{
      if(T.at(i)=='1'){a++;}
      c=0;
    }
  }
  b=T.size()-a;
  if(a>b){A=b;}
  else{A=a;}
  cout<<A<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int n;
    while(cin >> n)
    {
        if(n == -1 ) break;

        vector<int> ans;
        if(n == 0) ans.push_back(0);
        
        while(n)
        {
            ans.push_back(n % 4);
            n /= 4;
        }
        

        int l = ans.size();
        REP(l) cout << ans[l - i - 1] ;
        cout<< endl;

    }
    return 0;
}

Measured memory_bytes: 0
// Great Ocean View

#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> H;
    H.assign(N, -1);
    int max = 0;
    int count = 0;
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    for (int i = 0; i < N; i++) {
        if (max <= H[i]) {
            max = H[i];
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
f ::[String]->[String]->[String]->[Int]
f [] _ _ =[]
f (x:xs) ns ms=let d=length (filter (== x) ns)- length (filter (== x) ms)
               in d:f xs ns ms

main = do
      x<-getContents
      let y=lines x
          n=read (head y)::Int
          ns=take n $ tail y
          ms=drop (n+2) y
      putStrLn $ show $ maximum $ (read "0"::Int) : f ns ns ms

Measured memory_bytes: 636
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        for (int i = 0; i < s.length() - 2; i++) {
            if (s.charAt(i) == s.charAt(i + 1)) {
                System.out.println((i + 1) + " " + (i + 2));
                return;
            } else if (s.charAt(i) == s.charAt(i + 2)) {
                System.out.println((i + 1) + " " + (i + 3));
                return;
            }
        }
        if (s.charAt(s.length() - 2) == s.charAt(s.length() - 1)) {
            System.out.println((s.length() - 1) + " " + s.length());
            return;
        }
        System.out.println("-1 -1");
    }

}


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

using namespace std;

int main() {
	int A, B;
	string s;

	cin >> A >> B;

	if (A == 1) A += 13;
	if (B == 1) B += 13;
	if (A > B)	s = "Alice";
	else if (A < B)	s = "Bob";
	else	s = "Draw";

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			int out = 0;
			int r = 0;
			int sum = 0;
			String s = "";
			while(out<3){
				s = sc.next();
				if(s.compareTo("OUT")==0){
					out++;
				}else if(s.compareTo("HIT")==0){
					if(r==3){
						sum++;
					}else{
						r++;
					}
				}else{
					sum += r+1;
					r = 0;
				}	
			}
			System.out.println(sum);
		}
	
	}	
}

Measured memory_bytes: 17244
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;




int main() {

	int a,b;
	cin>>a>>b;
	int x=0;
	for(int i=0;i<a;i++){
		string p;
		cin>>p;
		for(int j=0;j<p.size();j++)
			if(p[j]=='#')x++;
	}
	if(x==a+b-1)cout<<"Possible"<<endl;
	else cout<<"Impossible"<<endl;
	   
	
	return 0;
}

	

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  
  int x,y,a,b,c;
  
  scanf("%d %d",&x,&y);
  
  a=x;
  b=y;
  
  if(x>y){
    a=x;
    b=y;
    while(1){
      c=a%b;
      if(c==0)break;
      a=b;
      b=c;
    }
  }
  else if(x<=y){
    a=y;
    b=x; 
    while(1){
      c=a%b;
      if(c==0)break;
      a=b;
      b=c;
    }  
  }
  printf("%d\n",b);
  return 0;
}



Measured memory_bytes: 2140
import java.util.Scanner;

class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int tosi[] = new int[n];
        int M[] = new int[n];
        int D[] = new int[n];
        int i;

        int k;
        int c = 0;

        for (k = 0; k < n; k++) {
            int total = 0;
            int day = 0;
            tosi[k] = sc.nextInt();
            M[k] = sc.nextInt();
            D[k] = sc.nextInt();

            for (i = tosi[k] + 1; i <= 1000; i++) {
                if (i % 3 == 0) {
                    total += 200;
                } else {
                    total += 195;
                }
            }
            if (tosi[k] % 3 == 0) {
                int tuki = (M[k] - 1) * 20;
                day = tuki + D[k] - 6;
             

            } else {
                if ((M[k] - 1) % 2 == 0) {
                    day = ((M[k] - 1) / 2) * 20 + ((M[k] - 1) / 2) * 19 + D[k] - 1;
                  
                } else {
                    day = ((M[k]) / 2) * 20 + ((M[k] - 1) / 2) * 19 + D[k] - 1;
               
                }

            }

            total = total - day;
            System.out.println(total);
        }

    }

}



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

bool isPrime(int x) {
	
	for(int i = 2; i*i<=x; i++) {
		if(x%i == 0) return false;
	}
	
	return true;
}

int main() {
	int x;
	cin >> x;
	while(!isPrime(x)) x++;
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long ;
using P = pair<int, int>;

void solver(int A, int B, int C, bool &flg){

    int buf{}, cnt = 1;
    map<int, int> div;

    while(true){
        buf = A*cnt;
        buf %= B;
        ++cnt;
        
        if(div[buf] != 0) break;
        else div[buf]++;
    }

    for(auto p: div){
        auto divisor = p.first;
        if(divisor == C) flg = true;
    }

    return;
}

int main(){

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

    bool ans = false;
    solver(A, B, C, ans);

    if(ans) cout << "YES"s << endl;
    else cout << "NO"s << endl;

    return 0;
}

Measured memory_bytes: 3580
fun main() {
    // 文字列
    var n = readLine()!!.toInt()
//    val x: String = readLine()!!
    // 数値
//    val int =readLine()!!.toInt()
    // 行
//    val list = readLine()!!.split(" ").map (String::toInt )
//    val (a, b, c) = readLine()!!.split(" ").map(String::toInt)
//    var k = readLine()!!.toInt()
    
    if(n>=30){
        print("Yes")
    }else{
        print("No")
    }

}

Measured memory_bytes: 34516
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author acesine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt(), L = in.nextInt();
            List<String> l = new ArrayList<String>();
            for (int i = 0; i < N; i++) {
                l.add(in.next());
            }
            Collections.sort(l);
            out.println(String.join("", l));
        }

    }
}



Measured memory_bytes: 22996
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n;cin>>n;lint sum=0,x;
    vector<lint> vec(n);for(int i=0;i<n;i++){
        cin>>x;
        sum+=x;vec[i]=x;
    }
    long double mid=sum/2.0;
    lint tmp=0,ans=0;
    for(int i=0;i<n;i++){
        if(tmp+vec[i]>=mid){
            ans=min(sum-tmp*2,(tmp+vec[i])-(sum-(tmp+vec[i])));
            break;
        }
        tmp+=vec[i];
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, ord = 0;
    cin >> n;
    vector<int> k(n);
    for(int i = 0; i < n; i++){
    cin >> k.at(i);
}
for(int j = 1; j < n - 1; j++)
{
    /* code */if(k.at(j-1) < k.at(j) && k.at(j) < k.at(j+1))
    ord++;
 else if(k.at(j-1) > k.at(j) && k.at(j) > k.at(j+1)) 
   ord++;
}
cout << ord << endl;
}




Measured memory_bytes: 256
q=int(input())
S=list()

for i in range(q):
    query = input().split()
    #print(query)
    if query[0] == '0':      #pushBack(x)
        S.append(query[1])
    
    elif query[0] == '1':    #randomeAccess(p)
        print("{}".format(S[int(query[1])]))
    
    elif query[0] == '2':    #popBack()
        S.pop()



Measured memory_bytes: 19820
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    used = set()
    w = input().strip("\n")
    lastw = w[len(w) - 1]
    used |= {w}
    for _ in range(N - 1):
        w = input().strip("\n")
        if w[0] != lastw or w in used:
            print("No")
            break
        else:
            lastw = w[len(w) - 1]
            used |= {w}
    else: print("Yes")

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigDecimal number1 = new BigDecimal(scanner.next());
			BigDecimal number2 = new BigDecimal(scanner.next());
			System.out.println(number1.divide(number2, 10, RoundingMode.HALF_UP));
		}
	}
}

Measured memory_bytes: 23252
'use strict'
function main(input) {
    input = input.split('\n')
    const troops = input[1].split('')
    const n = Number(input[0])
    let countsW = [0]
    for (let i = 1; i <= n; i++) {
        countsW[i] = (troops[i - 1] == 'W') ? countsW[i - 1] + 1 : countsW[i - 1];
    }
    let min, cnt = 0
    for (let i = 0; i < n; i++) {
        cnt = parseInt(countsW[i])
        cnt += n - (i + 1) - (countsW[n] - countsW[i + 1])
        min = (min < cnt) ? min : cnt
    }
    console.log(min)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

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

  int n = s.length();
  bool is_st = true;
  for(int i=0; i<n/2; i++){
    if(s[i] != s[n-1-i]){
      is_st = false;
      break;
    }
  }
  for(int i=0; i<n/4; i++){
    if(s[i] != s[(n - 1)/2-1 - i]){
      is_st = false;
      break;
    }
  }

  if(is_st) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 888
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    s = input()
    ans = 0
    for i in range(2 ** (len(s) - 1)):
        num = s[0]
        for j in range(len(s) - 1):
            if (i >> j) & 1:
                ans += int(num)
                num = ""
            num += s[j + 1]
        if len(num) != 0:
            ans += int(num)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9120
#include <stdio.h>
#include <stdlib.h>
#include <map>

#define MAX_N (100000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  long N, M, as[MAX_N];
  scanf("%ld %ld", &N, &M);
  for (int i = 0; i < N; i++) {
    scanf("%ld", &as[i]);
  }

  // create accumulated sum array
  int bs[MAX_N + 1];
  bs[0] = 0;
  for (int i = 0; i < N; i++) {
    bs[i + 1] = (bs[i] + as[i]) % M;
  }

  // store number of occurence of each mod
  map<long, long> num_occurrences;
  for (int i = 0; i <= N; i++) {
    num_occurrences[bs[i]]++;
  }

  // solve
  long ans = 0;
  for (pair<long, long> p : num_occurrences) {
    const long cnt = p.second;
    ans += (cnt * (cnt - 1)) / 2;
  }
  printf("%ld\n", ans);

  return 0;
}


Measured memory_bytes: 5376
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int A, B;
	cin >> A >> B;
	if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0){
		cout << "Possible" << endl;
	}
	else{
		cout << "Impossible" << endl;
	}
	return 0;
}

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

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;

vll k(1);
vll b(1);
ll solve(ll n,ll y){
    if(y>=k[n]) return b[n];
    if(y>k[n-1]+2) return b[n-1]+1+solve(n-1,y-k[n-1]-2);
    if(y==k[n-1]+2) return b[n-1]+1;
    if(y>1) return solve(n-1,y-1);
    return 0;
}
signed main(){
    stin(s);
    ll n=s.sz;
    ll a=0;
    ll k=0;
    FOR(i,0,n-1){
        if(s[n-1-i]=='B'){
            k++;
            a+=i+1-k;
        }
    }
    sal(a);
}


Measured memory_bytes: 640
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use std::collections::{BTreeSet, BinaryHeap};
const INF: usize = 999999999999;

#[fastout]
fn main() {
    input! {
        h:usize,w:usize,
    }

    let mut s = BTreeSet::new();
    let mut heap = BinaryHeap::new();
    for i in 1..=w {
        s.insert((i, 0));
        heap.push((0_isize, i));
    }
    for k in 1..=h {
        input! {
            a:usize,b:usize,
        }
        if b == w {
            for i in s.range((a, 0)..=(b, INF)).map(|p| *p).collect::<Vec<_>>() {
                s.remove(&i);
            }
        } else {
            let mut r = s.range((a, 0)..=(b, INF));
            let (mut idx, mut value) = (INF, INF);
            if let Some(x) = r.next_back() {
                idx = x.0;
                value = x.1;
            }
            if idx != INF {
                for i in s.range((a, 0)..=(b, INF)).map(|p| *p).collect::<Vec<_>>() {
                    s.remove(&i);
                }

                if s.range((b + 1, 0)..=(b + 1, INF)).count() == 0 {
                    s.insert((b + 1, b + 1 - idx + value));
                    heap.push((-1 * (b + 1 - idx + value) as isize, b + 1));
                }
            }
        }
        //dbg!(&s);
        while !heap.is_empty() {
            let p = heap.peek().unwrap();
            let idx = p.1;
            let value = (p.0 * -1) as usize;
            if !s.contains(&(idx, value)) {
                heap.pop();
            } else {
                break;
            }
        }
        if heap.is_empty() {
            println!("-1");
        } else {
            println!("{}", k + (heap.peek().unwrap().0 * -1) as usize);
        }
    }
}


Measured memory_bytes: 15056
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int K = input.nextInt();
		int[] arr = new int[N];
		int ans = 0;
		for (int i = 0; i < N; i++) {
			arr[i] = input.nextInt();
		}
		Arrays.sort(arr);
		for (int i = 0; i < K; i++) {
			ans+=arr[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 30272
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void test_case()
{
	string s;
	cin>>s;
	// cout<<s;
	ll total=0;
	for(char& ch : s)
	{
		total += ch - '0';
	}
	if(total % 9 == 0)
		cout<<"Yes";
	else
		cout<<"No";
	return;
}

int main(){
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	int T = 1;
	// cin>>T;
	while(T--)
		test_case();

}

Measured memory_bytes: 3712
#include <stdio.h>
#include <stdlib.h>
int main() {
    int A,B,C,D;
    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    scanf("%d",&D);
    while (C>0&&A>0) {
        C=C-B;
        if(C<=0){
            printf("Yes");
            break;
        }
        A=A-D;
        if(A<=0){
            printf("No");
            break;
        }
    }
}


Measured memory_bytes: 1732
//problem - p(indu)
#include<iostream>
#include<cmath>
#include<cstdio>

int main()
{
    long long int num{0};
    int remain{0},count{0};
    char s[20] = {0};
    
    scanf("%lli",&num);
    
    while(num > 0){
        remain = num % 26;
        
        if(remain == 0){
            s[count] = 26;
        }else{
            s[count] = remain;
        }
        
        num -= 1;
        num /= 26;
        count++;
    }
    
    while(--count >= 0){
        printf("%c",s[count] + 'a' - 1);
    }
    
    printf("\n");
    return 0;
}

Measured memory_bytes: 3764
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  char s[a+b+5];
  scanf("%s", s);
  bool check = true;
  for (int i=0; i<a+b+1; i++) {
    if (i == a) {
      if (s[i] == '-')
        continue;
    } else {
      if (s[i] - '0' >= 0 && s[i] - '0' <= 9)
        continue;
    }
    check = false;
    break;
  }
  if (check) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
  A--, B--, C--, D--;
  string S; cin >> S;
  bool possible1 = true, possible2 = false;
  for (int i=A+1;i<max(C,D)-1;i++){
    if (i+1<N && S[i]=='#' && S[i+1]=='#') possible1 = false;
  }
  for (int i=B-1;i<=D-1;i++){
    if (S.substr(i,3)=="...") possible2 = true;
  }

  if (C<D && possible1) cout << "Yes" << endl;
  else if (possible1 && possible2) cout << "Yes" << endl;
  else cout << "No" << endl;



  // cout << fixed << setprecision(10);
  
  return 0;
}



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

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

	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans = a + b + c >= 22 ? "bust" : "win";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin >> x;
    if(x>=400 && x <600) cout << "8\n";
    else if(x>=600 && x <800) cout << "7\n";
    else if(x>=800 && x <1000) cout << "6\n";
    else if(x>=1000 && x <1200) cout << "5\n";
    else if(x>=1200 && x <1400) cout << "4\n";
    else if(x>=1400 && x <1600) cout << "3\n";
    else if(x>=1600 && x <1800) cout << "2\n";
    else if(x>=1800 && x <2000) cout << "1\n";
    return 0;
}


Measured memory_bytes: 3640
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1e17;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

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


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


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


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


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

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll ans=MOD,tmp=v[0],sum=Svec(v);
  rep(i,n-1){
    ans=min(ans,abs(2*tmp-sum));
    tmp+=v[i+1];
  }
  cout<<ans<<endl;
  
  
}


Measured memory_bytes: 3328
while True:
    n,r=[int(s)for s in input().split(" ")]
    if n==r==0:break
    ops=[[int(s)for s in input().split(" ")]for i in range(r)]
    cd=[n-i for i in range(n)]
    for op in ops:
        p,c=op
        l=cd[p-1:p+c-1]
        del cd[p-1:p+c-1]
        cd=l+cd
    print(cd[0])

Measured memory_bytes: 7616
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 

const double EPS=0.00001;
const long double PI = acos(-1.0);
 


int main(){
    LL N,Z,W;
    cin>>N>>Z>>W;
    vector<LL>a(N);
    REP(i,N)cin>>a[i];
    if(N==1){
        cout<<abs(W-a[N-1])<<endl;
        return 0;
    }
    LL res=max(abs(W-a[N-1]),abs(a[N-2]-a[N-1]));
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
using namespace std;
#define int long

signed main() {
	int A, B, C;
	cin >> A >> B >> C;
	int max_num = max({ A, B, C });
	int ans;
	if (max_num == A)ans = 10 * A + B + C;
	else if (max_num == B)ans = A + 10 * B + C;
	else ans = A + B + 10 * C;
	cout << ans;
}

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

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

	if(n%500 <= a) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;
vector<ll> numbers;

bool isrr(string s){
  bool f=true;
  rep(i, s.size()-1){
    int d = abs((s[i]-'0')-(s[i+1]-'0'));
    if(d>1)f=false;
  }
  return f;
}

int main(){
  int k;cin>>k;
  vector<string>results, n_results;
  rep(i, 10){
    results.push_back(to_string(i));
  }
  while(results.size()<k+10){
    for(auto t: results){
      rep(i, 10){
        string tt(t);
        char c = '0'+i;
        tt.insert(tt.begin(), c);
        if( tt[0]=='0' || isrr(tt) )n_results.push_back(tt);
      }
    }
    swap(n_results, results);
    n_results.clear();
  }

  sort(results.begin(), results.end());

//  return 0;

  results[k].erase(0, results[k].find_first_not_of('0'));

  cout<<results[k]<<endl;

//rep(i, results.size())cout<<results[i]<<' ';  

  return 0;
}

Measured memory_bytes: 14956
def func(k):
    ans = 1 - (k-1)//2%2
    for d in range(1, 45):
        if (k & (1<<d)) and (k & 1 == 0):
            ans += 1<<d
    return ans

A, B = map(int, input().split())

fA = func(max(0, A-1))
fB = func(B)
print(fA ^ fB)


Measured memory_bytes: 2940