akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int h, w, k;
int main() {
    cin >> h >> w >> k;
    vector<vector<char>> s(h, vector<char>(w, '.'));
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            cin >> s.at(i).at(j);
        }
    }
    vector<vector<int>> ans(h, vector<int>(w, 0));
    vector<bool> yoko(h, false);
    int cnt = 1;

    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            if(s.at(i).at(j) == '#') {
                yoko.at(i) = true;
                s.at(i).at(j) = '!';
                ans.at(i).at(j) = cnt;
                if(j != 0) {
                    for(int k = 0; k < j; ++k) {
                        if(s.at(i).at(k) == '.') {
                            s.at(i).at(k) = '!';
                            ans.at(i).at(k) = cnt;
                        }
                    }
                    for(int m = j+1; m < w; ++m) {
                        if(s.at(i).at(m) == '.') {
                            s.at(i).at(m) = '!';
                            ans.at(i).at(m) = cnt;
                        }else {
                            break;
                        }
                    }
                }else {
                    for(int l = j+1; l < w; ++l) {
                        if(s.at(i).at(l) == '.') {
                            s.at(i).at(l) = '!';
                            ans.at(i).at(l) = cnt;
                        }else {
                            break;
                        }
                    }
                }
                cnt++;
            }
        }
    }

    for(int i = 0; i < h; ++i) {
        if(!yoko.at(i)) {
            if(i == 0) {
                int k;
                for(k = 1; ; ++k) {
                    if(yoko.at(i+k)) break;
                }
                for(int j = 0; j < w; ++j) {
                    ans.at(i).at(j) = ans.at(i+k).at(j);
                }
            }else if(i == h-1) {
                int l;
                for(l = 1; ; ++l) {
                    if(yoko.at(i-l)) break;
                }
                for(int j = 0; j < w; ++j) {
                    ans.at(i).at(j) = ans.at(i-l).at(j);
                }
            }else {
                int m;
                bool fin = false;
                int idx = 0;
                for(m = 1; ; ++m) {
                    if(i+m < h-1) {
                        if(yoko.at(i+m)) {
                            fin = true;
                            idx = i+m;
                        }
                    }
                    if(i-m > 0) {
                        if(yoko.at(i-m)) {
                            fin = true;
                            idx = i-m;
                        }
                    }
                    if(fin) break;
                }
                for(int j = 0; j < w; ++j) {
                    ans.at(i).at(j) = ans.at(idx).at(j);
                }
            }
        }
    }

    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            cout << ans.at(i).at(j) << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a>b)System.out.println("a > b");
        else if(a<b)System.out.println("a < b");
        else System.out.println("a == b");
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}



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

int c[33], s[444][33];
int sc(int i, int t, const vector<int> &v) {
    int j = i - 1, k = i + 1;
    while(j >= 0 && v[j] != t)
        j--;
    while(k < v.size() && v[k] != t)
        k++;
    return s[i][t] + c[t] * (i - j) * (k - i);
}
int main() {
    int d;
    cin >> d;
    for(int i = 0; i < 26; i++)
        cin >> c[i];
    for(int i = 0; i < d; i++)
        for(int j = 0; j < 26; j++)
            cin >> s[i][j];
    random_device rd;
    mt19937 mt(rd());
    uniform_int_distribution<> rc(0, 25), r0(0, d - 1), r2(1, 6);
    uniform_real_distribution<> ru(0, 1);
    vector<int> tt(d);
    for(int &i : tt)
        i = rc(mt);
    int cnt = 0;
    auto ti = clock();
    for(;;) {
        auto T = (clock() - ti) / 1.9 / CLOCKS_PER_SEC;
        if(T > 1)
            break;
        auto U = pow(2e3, 1 - T) * pow(6e2, T);
        for(int cn = 0; cn < 100; cn++, cnt++) {
            if(rc(mt) < 13) {
                int x0 = r0(mt), xc = rc(mt);
                int di = sc(x0, xc, tt) - sc(x0, tt[x0], tt);
                if(ru(mt) <= exp(di / U))
                    tt[x0] = xc;
                continue;
            }
            int x2 = r2(mt);
            uniform_int_distribution<> r1(0, d - 1 - x2);
            int x1 = r1(mt);
            x2 += x1;
            int di = -sc(x1, tt[x1], tt) - sc(x2, tt[x2], tt);
            swap(tt[x1], tt[x2]);
            di += sc(x1, tt[x1], tt) + sc(x2, tt[x2], tt);
            if(ru(mt) > exp(di / U))
                swap(tt[x1], tt[x2]);
        }
    }
    for(int i : tt)
        cout << i + 1 << '\n';
    cerr << cnt << endl;
    return 0;
}


Measured memory_bytes: 4304
n, k = map(int, input().split())
p, q = 0, 0
if k % 2 == 1:
    for i in range(1, n + 1):
        if i % k == 0:
            p += 1
else:
    for i in range(1, n + 1):
        if i % k == 0:
            p += 1
        elif i % k == k // 2:
            q += 1
print(p ** 3 + q ** 3)

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);

	string s, t;
	cin >> s >> t;
	cout << t << s << endl;
	
}

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

ll n;
vector<pair<ll,ll>> p;
double ans=0;

void dfs(vector<bool> &visit,ll now,ll num,double sum){
    if(num==n-1){ans+=sum;return;}

    for(ll i=0;i<n;i++){
        if(!visit[i]){
            visit[i]=true;

            ll xnow=p[now].first,ynow=p[now].second;
            ll xi=p[i].first,yi=p[i].second;
            double add=sqrt(pow(xnow-xi,2)+pow(ynow-yi,2));//now->iへの距離をsumに加算
            
            dfs(visit,i,num+1,sum+add);
            visit[i]=false;
        }
    }
    return;
}

ll fact(ll n){//階乗
    ll num=1;
    while(n>=1){
        num*=n;
        n--;
    }
    return num;
}

int main(){
    cin>>n;
    p.resize(n);
    for(ll i=0;i<n;i++){//i町の座標
        cin>>p[i].first>>p[i].second;
    }

    vector<bool> visit(n,false);
    
    for(ll i=0;i<n;i++){
        visit[i]=true;
        dfs(visit,i,0,0);
        visit[i]=false;
    }

    printf("%.10f\n",ans/fact(n));
    return 0;
}

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

using ld=double;
using P=complex<ld>;
const ld pi=acos(-1);
struct State{
    int v,pre;
    int c; 
};

bool operator<(const State& lhs,const State& rhs){
    return true;
}

int idx(State st){
    return st.v+20*st.pre+st.c*20*20;
}
int main(){
    int n;
    cin>>n;
    ld r,theta;
    cin>>r>>theta;
    theta=(theta)/180*pi;
    vector<P> xy(n);
    for(int i=0;i<n;i++){
        ld tmpx,tmpy;
        cin>>tmpx>>tmpy;
        xy[i]={tmpx,tmpy};
    }
    int res=0;
    priority_queue<pair<ld,State>,vector<pair<ld,State>>,greater<>> que;
    que.push({ld(0),State{0,0,0}});
    const ld INF=1e9;
    vector<ld> dist(5*1e6,INF);
    vector<ld> check(5*1e6,0);
    dist[0]=0;

    vector<vector<vector<int>>> edge(n,vector<vector<int>>(n));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(i==k || j==k) continue;
                if(i!=j){
                    ld phi=arg((xy[k]-xy[j])/(xy[j]-xy[i]));
                    if(phi>pi) phi-=2*pi;
                    if(abs(phi)>theta){
                        continue;
                    }
                }
                edge[i][j].push_back(k);
            }
        }
    }

    while(!que.empty()){
        auto tmp=que.top(); que.pop();
        auto ret=tmp.second;
        int v=ret.v,pre=ret.pre;
        int c=ret.c;
        int id=idx(ret);
        ld w=tmp.first;
        if(check[id]) continue;
        check[id]=true;
        if(w>r) break;
        res=max(res,c);
        for(int k=0;k<edge[pre][v].size();k++){
            int i=edge[pre][v][k];
            State to{i,v,c+1};
            int toidx=idx(to);
            if(w+abs(xy[i]-xy[v])<dist[toidx]){
                dist[toidx]=w+abs(xy[i]-xy[v]);
                que.push({dist[toidx],to});
            }
        }

    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 81456
// {{{ by unolight
#pragma region
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
#pragma endregion
// }}}

void main() {
    int n;
    R(n);
    VI a(n);
    REP(i,n) R(a[i]);
    // 1+ n-1 -, 2+ n-2-,...,(n-1)+ 1-
    sort(ALL(a));
    int m=lower_bound(ALL(a),0)-a.begin();
    chmin(m,n-1);
    chmax(m,1);
    int sum=a[0];
    vector<PII> ans;
    for ( int i=m; i<n-1; i++ ) {
        ans.emplace_back(sum,a[i]);
        sum-=a[i];
    }
    ans.emplace_back(a[n-1],sum);
    sum-=a[n-1];
    sum*=-1;
    for ( int i=1; i<m; i++ ) {
        ans.emplace_back(sum,a[i]);
        sum-=a[i];
    }
    W(sum);
    for ( auto [a,b]:ans ) W(a,b);
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}


Measured memory_bytes: 4704
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n,m;
  cin >> n >> m;

  vector<string> a(n),b(m);

  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];

  bool ans = false;
  rep(i,n-m+1)
  {
    int pos = a[i].find(b[0]);
    if(pos == string::npos)
    {
      continue;
    }
    bool _is = true;
    rep(j,m)
    {
      string buf = a[i + j].substr(pos, sz(b[j]));
      if(buf != b[j])
      {
        _is = false;
      }
    }
    if(_is)
    {
      ans = true;
      break;
    }
  }

  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

int a[100001];
int n;
struct BIT{
    int size;
    vector<ll> dat;
    void init(int n){
        size=n;
        dat.clear();
        dat.resize(n+1);
    }
    void add(int i,ll x){
        while(i<=size){
        dat[i]+=x;
        i +=i&-i;
        }
    }
    ll sum(int i){
        ll s=0;
        while(0<i){
            s +=dat[i];
            i -=i&-i;
        }
    return s;
    }
};
int sum[100001];
ll m;
bool test(int d){
    rep(i,n)sum[i]=(a[i]>=d?1:-1);
    FOR(i,1,n) sum[i]+=sum[i-1];
    ll tot=0;
    BIT b;
    b.init(n*2+2);
    b.add(n+1,1);
    rep(i,n){
        tot+=b.sum(sum[i]+n+1);
        b.add(sum[i]+n+1,1);
    }
    if(tot>=(m-1)/2+1) return true;
    else return false;
}
int main(){
    cin>>n;
    m=(ll)n*(n+1)/2;
    rep(i,n)cin>>a[i];
    int lb=1,ub=1000000001;
    while(ub-lb>1){
        int mid=(ub+lb)/2;
        if(test(mid)) lb=mid;
        else ub=mid;
    }
    cout<<lb<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
string yes = "Yes\n";
string no = "No\n";

int  main()
{
	int a,b,x; cin >> x >> a >> b;
	if (a >= b)
	{
		cout << "delicious"; return 0;
	}
	if (b - a <= x)
		cout << "safe";
	else
		cout << "dangerous";
	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  string w;
  cin>>w;
  map<char,int> m;
  rep(i,w.length()) m[w[i]]++;
  bool ja=true;
  for(auto x:m){
    if(x.second%2==1){
      ja=false;
    }
  }
  if(ja){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}   

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int h,w,x,y;
	cin>>h>>w>>x>>y;
	cout<<(double)(h)*(double)(w)/2.0<<' '<<(x*2==h&&y*2==w? 1:0);
    return 0;
}


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

using namespace std;
typedef long long LL;
const int N = 2e5+10;
LL a[N];

int main(){
  LL mn = 1LL<<62;
  int n;
  cin >> n;
  LL sum = 0, sum_now = 0 ;
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum += a[i];
  }
  LL res = 0;
  for(int i=0;i<n-1;i++){
    sum_now += a[i];
    res = sum - sum_now - sum_now;
    if(res < 0) res = -res;
    mn = min(mn, res);
  }
  cout << mn << endl;
}


Measured memory_bytes: 1792
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let cs: Vec<char> = s.chars().collect();
    let s1: String = vec![cs[0], cs[1]].into_iter().collect();
    let s2: String = vec![cs[2], cs[3]].into_iter().collect();
    let u1: u8 = s1.parse().unwrap();
    let u2: u8 = s2.parse().unwrap();
    if 1 <= u1 && u1 <= 12 {
        if 1 <= u2 && u2 <= 12 {
            println!("AMBIGUOUS");
        } else {
            println!("MMYY");
        }
    } else {
        if 1 <= u2 && u2 <= 12 {
            println!("YYMM");
        } else {
            println!("NA");
        }
    }
}


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

/*------------------------------------------------------------------*/

#define ll long long int
#define mp make_pair
#define pb push_back
#define MOD 1000000007

bool isvowel(char c)
{
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return true;
        return false;
}
ll isprime(ll n)
{
    ll ans=1;
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            ans = i;
    }
    return ans;
}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    if(b==1)
        return a%m;
    ll temp=power(a,b/2,m);
    if(b%2==0)
        return ((temp%m)*(temp%m))%m;
    else
        return ((((temp%m)*(temp%m))%m)*a%m)%m;
}

/*-----------------------------------------------------------------------------*/

ll c(ll n, ll k)
{
    ll C[n + 1][k + 1];
    ll i, j;

    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {

            if (j == 0 || j == i)
                C[i][j] = 1;

            else
                C[i][j] = (C[i - 1][j - 1]%MOD +
                          C[i - 1][j])%MOD;
        }
    }
    return C[n][k]%MOD;
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {

        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;


        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
ll func(ll n)
{
    ll ans=0;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            if(i/10==0)
                ans+=1+func(i)*func(n/i);
            else
                ans+=func(i)*func(n/i);
        }
    }
    return ans;
}
ll dp[2001][2001];
ll check(vector<pair<ll,ll> >v,ll l,ll r,ll i)
{ 
   //cout<<l<<" "<<r<<endl;
   if(l>r)
    return 0; 
   if(dp[l][r]!=-1)
    return dp[l][r]; 
   ll ans=0;
   ll p1=v[i].first;
   ll p2=v[i].second;
   ans=max(p1*(p2-l)+check(v,l+1,r,i+1),p1*(r-p2)+check(v,l,r-1,i+1));
   return dp[l][r]=ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    //freopen("1.txt","rt",stdin);
    //freopen("output.txt","wwt",stdout);

    ll t;
    t=1;
    //cin>>t;
    //ll t1=0;
    while(t--)
    {
      ll a,b;
      cin>>a>>b;
      ll p=a*100;
      ll p2=p/8;
      if(p%8)
       p2++;
      ll ans1=-1,ans2=-1;
      ll p1=p2/10;
      if(p1==b)
      {
          ans1=p2;
      }

      p=b*100;
      p2=p/10;
      if(p%10)
       p2++;
      p1=(p2*8)/100;
      if(p1==a)
       ans2=p2;
      if(ans1!=-1&&ans2!=-1)
      cout<<min(ans1,ans2);
      else if(ans1==-1)
       cout<<ans2;
      else if(ans2==-1)
       cout<<ans1;
      else
      {
          cout<<ans1;
      }
        
    }
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define BUFSIZE 10000
int A,B;
int main(void){
char hoge[BUFSIZE];
char hogehoge[BUFSIZE];
char hogehogehoge[BUFSIZE];
    scanf("%s",hoge);
    scanf("%s",hogehoge);
    scanf("%d %d",&A,&B);
    scanf("%s",hogehogehoge);

if(hoge[0]==hogehogehoge[0]){
    printf("%d %d",A-1,B);
    }else if(hogehoge[0]==hogehogehoge[0]){
    printf("%d %d",A,B-1);
    }else{
    return 0;    
    }

}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for(int i = 0; i < h; i++) {
    cin >> s[i];
  }
  int c = 0;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(s[i][j] == '#') c++;
    }
  }
  if(c == h + w - 1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}

Measured memory_bytes: 256
//
// Created by 李青坪 on 2018/10/17.
//

#include <cstdio>
#include <algorithm>

using namespace std;
#define MAXN 25
#define NIL -1

struct Node{
    int parent;
    int left;
    int right;
};

Node tree[MAXN];
int depth[MAXN];
int height[MAXN];

int getRoot(int n){
    for (int i = 0; i < n; ++i) {
        if (tree[i].parent == NIL) return i;
    }
}

void initTree(int n){
    for (int i = 0; i < n; ++i) {
        tree[i].parent = tree[i].left = tree[i].right = NIL;
    }
}

void getDepth(int start, int dep){
    depth[start] = dep;
    if (tree[start].left != NIL) getDepth(tree[start].left, dep+1);
    if (tree[start].right != NIL) getDepth(tree[start].right, dep+1);
}

int getHeight(int start){
    if (start == NIL) return -1;
    if (tree[start].left == NIL && tree[start].right == NIL){
        height[start] = 0;
        return 0;
    }
    height[start] = max(1+getHeight(tree[start].left), 1+getHeight(tree[start].right));
    return height[start];
}

void printTree(int n){
    for (int i = 0; i < n; ++i) {
        printf("node %d: parent = %d, ", i, tree[i].parent);
        int parent = tree[i].parent;
        if (parent != NIL){
            if (tree[parent].left != i) printf("sibling = %d, ", tree[parent].left);
            else printf("sibling = %d, ", tree[parent].right);

        } else{
            printf("sibling = -1, ");
        }
        bool isLeaf = false;
        if (tree[i].left == NIL && tree[i].right == NIL) {
            isLeaf = true;
            printf("degree = %d, ", 0);
        }
        else{
            int degree = (tree[i].left != NIL && tree[i].right != NIL) ? 2 : 1;
            printf("degree = %d, ", degree);
        }
        printf("depth = %d, height = %d, ", depth[i], height[i]);
        if (depth[i] == 0){
            printf("root");
        } else if (isLeaf){
            printf("leaf");
        }else printf("internal node");
        printf("\n");
    }
}

int main(){
    int n;
    scanf("%d", &n);
    initTree(n);
    int node_id, left, right;
    for (int i = 0; i < n; ++i) {
        scanf("%d %d %d", &node_id, &left, &right);
        tree[node_id].left = left;
        tree[node_id].right = right;
        if (left != NIL) tree[left].parent = node_id;
        if (right != NIL) tree[right].parent = node_id;
    }
    int root = getRoot(n);
//    printf("%d", root);
    getDepth(root, 0);
    getHeight(root);
    printTree(n);
}
/*
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
 */


Measured memory_bytes: 2764
#include <stdio.h>

int main() {
	int n, cnt=0;
	char q;
	scanf("%d", &n);
	for(int i=0; i<n; i++)
	{
		scanf("%c", &q);
		if(q=='Y') {cnt=1; break;}
	}
	if(cnt==1) printf("Four"); 
	if(cnt==0) printf("Three");
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main() {
	char b;
	cin >> b;
	if (b == 'A')cout << "T";
	if (b =='G')cout << "C";
	if (b == 'T')cout << "A";
	if (b == 'C')cout << "G";

}

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

int main(){
    int h,w;
    cin >> h >> w;
    while ( !( h==0 && w==0 ) ){
        for (int j=0; j<h ; j++ ){
            for (int i=0; i<w ; i++){
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
        cin >> h >> w;
    }

    return 0;
}

Measured memory_bytes: 3088
#include <stdio.h>

int main(void){
    int n,k;
    char s[20];
    int i;
    
    scanf("%d", &n);
    scanf("%s", s);
    scanf("%d", &k);
    
    for(i = 0; i < n; i++){
        if(s[i] != s[k-1]){
            s[i] = '*';
        }
    }
    
    printf("%s\n", s);
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
const int N=5e5+7;
int n,q,as[N],L[N],R[N];
int main(){
	scanf("%d%d",&n,L);
	R[n+1]=1;
	for(int i=1;i<=n;++i){
		scanf("%d",as+i);
		L[i]=std::min(L[i-1],std::abs(L[i-1]-as[i]));
	}
	for(int i=n;i;--i)R[i]=R[i+1]+(R[i+1]<=as[i]/2?0:as[i]);
	scanf("%d",&q);
	for(int i=1,x;i<=q;++i){
		scanf("%d",&x);
		puts(L[x-1]>=R[x+1]?"YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 7808
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int digNum(ll x, int n){
    ll num = pow(10, n - 1);
    num = x / num;
    num %= 10;
    return num;
}

int main(){
    ll A, B;
    string str;
    cin >> A;
    int num = digNum(A, 1);
    if(digNum(A, 1) == 3)cout << "bon" << endl;
    else if(num == 0 || num == 1 || num == 6 || num == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    int arr[n+5];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    int mid=n/2;
    cout<<arr[mid]-arr[mid-1]<<endl;


    return 0;
}


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

typedef pair<int,int> pii;
#define F first
#define S second

int main() {
    int N, W, sum = 0;
    cin >> N >> W;
    vector<pii> O(N);
    for(pii & x : O) {
        cin >> x.F >> x.S;
        sum += x.S;
    }

    vector<long long> dp(sum+1, 10e11);
    dp[0] = 0;   
    for(pii & x : O) 
        for(int i=sum-x.S; i>=0; i--) 
            dp[i+x.S] = min(dp[i+x.S], dp[i] + x.F); 
    
    int res = 0;
    for(int i=0; i<=sum; i++) 
        if(dp[i] <= W) res = max(res, i);

    cout <<  res << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <string>
#include <sstream>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define SORT(x) sort((x).begin(), (x).end())
#define clr(a,b) memset((a),(b),sizeof(a))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int table[100000];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	while(cin >> n,n){
		rep(i,100000) table[i] = 0;
		rep(i,n){
			char t;
			int a,b,c,d,e,f;
			cin >> a >> t >> b >> t >> c >> d >> t >> e >> t >> f;
			c += a*3600+b*60;
			f += d*3600+e*60;
			table[c]++;
			table[f]--;
		}
		for(int i = 1; i < 100000; i++) table[i] += table[i-1];
		int ans = 0;
		rep(i,100000) ans = max(ans,table[i]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 1584
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  string s,t;
  cin >> s >> t;
  cout <<t  << s<<endl;
}


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

int main()
{
    int a, b;
    scanf("%d %d",&a,&b);
    int ma=max(a,b),mi=min(a,b);
    for(int i=0;i<ma;i++)
    {
        printf("%d",mi);
    }
    printf("\n");
	return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef long long lint;

int N;
lint x, a[2020];

int main() {
	cin >> N >> x;
	for_(i,0,N) cin >> a[i];
	
	vector< lint > min_a(N, 1 << 30);
	lint ans = 1LL << 60;
	
	for_(k,0,N) {
		lint ans_k = 0;
		for_(i,0,N) ans_k += (min_a[i] = min(min_a[i], a[(i - k + N) % N]));
		ans = min(ans, ans_k + (lint)k * x);
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

int H, W;
int N;
vector<int> a;

int cells[101][101];
queue<int> q;

int main() {
  cin >> H >> W;
  cin >> N;

  int ai;
  for (int i = 0; i < N; i++) {
    cin >> ai;
    a.push_back(ai);
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < a[i]; j++) {
      q.push(i + 1);
    }
  }

  for (int i = 0; i < H; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < W; j++) {
        cells[i][j] = q.front();
        q.pop();
      }
    } else {
      for (int j = W - 1; j >= 0; j--) {
        cells[i][j] = q.front();
        q.pop();
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << cells[i][j];
      if (j != W - 1) cout << " ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 384
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(false);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N;
  cin >> N;
  vi A(N);
  cin >> A;
  sort(rall(A));

  multiset<int> s;
  s.insert(A[0]);
  int ans = 0;
  rep(i, 1, N) {
    int x = A[i];
    auto itr = prev(s.end());
    ans += *itr;
    s.erase(itr);
    s.insert(x);
    s.insert(x);
  }
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 14284
#include<iostream>
#define INF 100000000
using namespace std;
int main(){
  int n,m;
  while(cin>>n>>m){
    if(n==0&&m==0) break;
    int d0[m+1][m+1],d1[m+1][m+1];
    for(int i=1;i<=m;i++){
      for(int j=1;j<=m;j++){
    d0[i][j] = INF;
    d1[i][j] = INF;
      }
    }
    int a,b,cost,time;
    for(int i=0;i<n;i++){
      cin >> a >> b >> cost >> time;
      d0[a][b] = d0[b][a] = cost;
      d1[a][b] = d1[b][a] = time;
    }
    for(int i=1;i<=m;i++){
      for(int j=1;j<=m;j++){
    for(int k=1;k<=m;k++){
      d0[j][k] = min(d0[j][k],d0[j][i]+d0[i][k]);
      d1[j][k] = min(d1[j][k],d1[j][i]+d1[i][k]);
    }
      }
    }
    int s,p,q,r;
    cin >> s;
    for(int i=0;i<s;i++){
      cin >> p >> q >> r;
      if(p==q) cout << 0 << endl;
      else if(r==0) cout << d0[p][q] << endl;
      else cout << d1[p][q] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)    cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\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;}

int main(void) {
  int n;
  cin >> n;
  string s;
  cin >> s;

  ll r=0, g=0, b=0;
  rep(i,n){
    if(s[i]=='R') r++;
    if(s[i]=='G') g++;
    if(s[i]=='B') b++;
  }

  ll ans = r*g*b;
  rep(i,2000){
    int length=3+i*2;
    if(length>n) break;
    rep(j,n-length+1){
      if(s[j]!=s[j+1+i] && s[j]!=s[j+2+2*i] && s[j+1+i]!=s[j+2+2*i]){
        ans--;
      }
    }
  }

  prt(ans);
}


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

const long long MOD = 1000000007;
const long long MAX = 2000000;

template <typename T> T gcd(T a, T b) { return b != 0 ? gcd(b, a % b) : a; }

template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }



int main() {
	int N;
	cin>>N;
	if(N>=400&&N<=599){
    cout<<8<<endl;
  }else if(N>=600&&N<=799){
    cout<<7<<endl;
  }else if(N>=800&&N<=999){
    cout<<6<<endl;
  }else if(N>=1000&&N<=1199){
    cout<<5<<endl;
  }else if(N>=1200&&N<=1399){
    cout<<4<<endl;
  }else if(N>=1400&&N<=1599){
    cout<<3<<endl;
  }else if(N>=1600&&N<=1799){
    cout<<2<<endl;
  }else if(N>=1800&&N<=1999){
    cout<<1<<endl;
  }
  
}


Measured memory_bytes: 3632
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class DABS {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int first = in.nextInt(), second = in.nextInt();
            int[] a = new int[n + 1];
            for (int i = 0; i < n; i++) {
                a[n - 1 - i] = in.nextInt();
            }
            a[n] = second;

            if (n == 1) {
                out.println(Math.abs(second - a[0]));
                return;
            }

            int[] min = new int[n];
            int[] max = new int[n];
            min[0] = max[0] = Math.abs(a[0] - a[1]);
            for (int i = 1; i < n; i++) {
                min[i] = Math.abs(a[0] - a[i + 1]);
                for (int j = 0; j < i; j++) {
                    min[i] = Math.min(min[i], max[j]);
                }
                max[i] = Math.abs(a[0] - a[i + 1]);
                for (int j = 0; j < i; j++) {
                    max[i] = Math.max(max[i], min[j]);
                }
            }

            int answer = max[n - 1];
            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23508
#include <iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
    int  a=0,b=0,i=0;
    b=100000;
    cin >> a;
    for(i=0;i<a;i++){
        b=b*1.05;
        b=((b-1)/1000);
        b=b*1000+1000;

    }

    cout << b << endl;



    //cout << endl;

return 0;

}

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

int main() {
    int A, B, C, sum;
    cin >> A >> B >> C;
    sum = A + B + C;

 if(sum > 21){
    cout << "bust" << endl;
 }
else{
    cout << "win" << endl;
}
}
    


Measured memory_bytes: 256
package main

import (
	"bufio"
	"os"
		"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)
const (
	allb = "bbb"
	allw = "www"
)

func main() {
	for scanner.Scan() {
		row1 := scanner.Text()
		if row1 == "0" {
			break
		}
		scanner.Scan()
		row2 := scanner.Text()
		scanner.Scan()
		row3 := scanner.Text()
		x := make([]string, 8)
		x[0] = row1
		x[1] = row2
		x[2] = row3
		for i := 0; i < 3; i++ {
			col := make([]string, 3)
			col[0] = string(row1[i])
			col[1] = string(row2[i])
			col[2] = string(row3[i])
			x[i+3] = strings.Join(col, "")
		}
		tmp := make([]string, 3)
		tmp[0] = string(row1[0])
		tmp[1] = string(row2[1])
		tmp[2] = string(row3[2])
		x[6] = strings.Join(tmp, "")
		tmp[0] = string(row1[2])
		tmp[1] = string(row2[1])
		tmp[2] = string(row3[0])
		x[7] = strings.Join(tmp, "")
		flag := false
		for _, v := range x {
			if string(v) == allb {
				fmt.Println("b")
				flag = true
				break
			} else if string(v) == allw {
				fmt.Println("w")
				flag = true
				break
			}
		}
		if !flag {
			fmt.Println("NA")
		}
	}
}


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

const int maxn = 1005;

#define LL long long

int a, b, c;
int K;

LL A[maxn], B[maxn], C[maxn];
LL AB[maxn * maxn];

priority_queue< pair<LL, pair<int, int> > > pq;

void work()
{
    cin >>a >>b >>c >>K;

    for(int i = 0; i < a; i++) cin >>A[i];
    for(int i = 0; i < b; i++) cin >>B[i];
    for(int i = 0; i < c; i++) cin >>C[i];

    for(int i = 0; i < a; i++)
        for(int j = 0; j < b; j++)
            AB[i * b + j] = A[i] + B[j];

    AB[a * b] = -INT_MAX;
    C[c] = -INT_MAX;

    sort(AB, AB + a * b);
    sort(C, C + c);
    reverse(AB, AB + a * b);
    reverse(C, C + c);

    for(int i = 0; i < c; i++) pq.push(make_pair(AB[0] + C[i], make_pair(0, i)));

    while(K--)
    {
        pair<LL, pair<int, int> > p = pq.top();
        pq.pop();

        cout <<p.first <<endl;

        int u = p.second.first, v = p.second.second;

        pq.push(make_pair(AB[u + 1] + C[v], make_pair(u + 1, v)));
    }
}

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
#endif // yukihana0416
    work();
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))

#define dbg(x) cerr << #x << " = " << x << endl;
#define dbgall(x) cerr << #x << " = "; for(auto i_ : x) cerr << i_ << " "; cerr << endl;
#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

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

void run_test() {
	string s, t; cin >> s >> t;
    int ans = 0;
    rep(i, sz(s)) ans += s[i] != t[i];
    cout << ans << endl;
}

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

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


Measured memory_bytes: 3756
unittest
{
	assert( [ "3 5 2 7" ].parse.expand.solve == 15 );
	assert( [ "100 600 200 300" ].parse.expand.solve == 60000 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abcd = input.front.split.to!( long[] );
	return tuple( abcd[ 0 ], abcd[ 1 ], abcd[ 2 ], abcd[ 3 ] );
}

auto solve( long a, long b, long c, long d )
{
	auto ab = a * b;
	auto cd = c * d;
	return ( ab < cd ) ? cd : ab;
}


Measured memory_bytes: 256