akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
using PPI = pair<P, int>;
ll const mod = 998244353;
//ll const mod=1e9+7;
const ll MAX = 300000;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }


//////////////////////////////////////


int main() {
    int n;
    cin >> n;
    vvi a(n, vi(n));
    rep(i, n) {
        rep(j, n - 1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    rep(i, n)a[i][n - 1] = INF;
    vp q;
    vvi used(n, vi(n));
    vi index(n);
    auto get_game = [&](int y) {
        int my_x = index[y];
        
        int opo = a[y][my_x];
        int opo_x = index[opo];
        if (a[opo][opo_x] == y) {
            if (y > opo)swap(y, opo);
            if (used[y][opo])return;
            q.push_back(P(y, opo));
            used[y][opo] = 1;
            
        }
    };
    rep(i, n) {
        get_game(i);
    }
    
    int ans = 0;
    while (q.size()) {
        vp prev;
        q.erase(unique(all(q)), q.end());
        swap(q, prev);
        for (auto x : prev) {
            if(index[x.fs]<n-2)index[x.fs]++;
            if(index[x.sc]<n-2)index[x.sc]++;
        }
        for (auto x : prev) {

            get_game(x.fs);
            get_game(x.sc);
        }
        
        ans++;
    }
    rep(i,n){
      if(index[i]!=n-2){
        cout<<-1<<endl;
        return 0;
      }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8192
loop do

a,op,b = gets.split(" ")

a = a.to_i
b = b.to_i

  case op
    when '+' then
      puts a + b
    when '-' then
      puts a - b
    when '*' then
      puts a * b
    when '/' then
      puts a / b
    when '?' then
      break
  end
   
end

Measured memory_bytes: 8664
#include <stdio.h>
#include <stdlib.h>

#define MAX_NODE (100000)

int parent[MAX_NODE] = {0};
int* tree_cache[MAX_NODE];
int t_size[MAX_NODE];

void init_tree(int root, int* leafs, int leaf_size) {
	int i,j,node,id;
	int cache[MAX_NODE];
	
	// 葉の要素だけ実体化する
	for(i=0;i<leaf_size;i++) {
		id = leafs[i];
		cache[0] = id;
		for(j=1;j<MAX_NODE;j++) {
			node = parent[cache[j-1]];
			cache[j] = node;
			if(node == root) {
				t_size[id] = j + 1;
				break;
			}
		}
		tree_cache[id] = (int*)malloc(t_size[id]*sizeof(int));
		for(j=0;j<t_size[id];j++) tree_cache[id][j] = cache[j];

		// 途中の要素はポインタを設定
		for(j=1;j<t_size[id];j++) {
			node = tree_cache[id][j];
			tree_cache[node] = &tree_cache[id][j];
			t_size[node] = t_size[id] - j;
		}
	}
}



int binary_search(int left, int right, int* so, int* si, int root) {
	int i, node;
	int middle = (left + right) / 2;
	if(right - left < 40) {
		for(i=left,node=root;i<=right;i++) {
			if(so[i] == si[i]) {
				return so[i];
			}
		}
		return node;
	}
	
	if(so[middle] != si[middle]) {
		return binary_search(middle, right, so, si, root);
	}
	
	return binary_search(left, middle, so, si, root);
}

int solve(int source, int sink, int root) {
	int node;
	int last;
	int* p_so_list;
	int* p_si_list;
	int so, si;
	if(source == sink) return source;
	so = si = 0;

	p_so_list = tree_cache[source];
	so = t_size[source];
	p_si_list = tree_cache[sink];
	si = t_size[sink];

	if(si > so) {
		last = si - so;
		return binary_search(0, so, p_so_list, &p_si_list[last], root);
	}
	
	last = so - si;
	return binary_search(0, si, &p_so_list[last], p_si_list, root);
	
}

int main(void) {
	int i, j, m, n, t, q;
	int source, sink;
	int is_root[MAX_NODE] = {0};
	int leafs[MAX_NODE];
	int leaf_size = 0;
	int root;

	scanf("%d\n", &n);
	for(i=0;i<n;i++) {
		scanf("%d", &m);
		if(m == 0) leafs[leaf_size++] = i;

		for(j=0;j<m;j++) {
			scanf("%d", &t);
			is_root[t] = -1;
			parent[t] = i;
		}
	}
	
	// ルート
	root = 0;
	for(i=0;i<n;i++) {
		t_size[i] = -1;
		if(is_root[i] == 0) {
			root = i;
			break;
		}
	}

	init_tree(root, leafs, leaf_size);
	
	scanf("%d\n", &q);
	for(i=0;i<q;i++) {
		scanf("%d %d\n" ,&source, &sink);
		printf("%d\n", solve(source, sink, root));
	}

	return 0;
}

Measured memory_bytes: 6676
#include<bits/stdc++.h>
using namespace std;
int n,m,a[1005][1005];
char str[1005][1005];
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>str[i][j];
			if(str[i][j]=='#')
			{
				a[i][j]=-1000;
				if(i-1>=0 && j-1>=0 && a[i-1][j-1]!='#')a[i-1][j-1]++;
				if(i+1>=0 && j+1>=0 && a[i+1][j+1]!='#')a[i+1][j+1]++;
				if(i+1>=0 && j-1>=0 && a[i+1][j-1]!='#')a[i+1][j-1]++;
				if(i-1>=0 && j+1>=0 && a[i-1][j+1]!='#')a[i-1][j+1]++;
				
				if(i+1>=0 && a[i+1][j]!='#')a[i+1][j]++;
				if(i-1>=0 && a[i-1][j]!='#')a[i-1][j]++;
				if(j+1>=0 && a[i][j+1]!='#')a[i][j+1]++;
				if(j-1>=0 && a[i][j-1]!='#')a[i][j-1]++;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(a[i][j]>=0)cout<<a[i][j];
			else cout<<'#';
		}
		cout<<endl;
	}

    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    ll addA = min(A, 2 * C);
    ll addB = min(B, 2 * C);
    ll addAB = min(A + B, 2 * C);
    ll ans = 0;
    if(X >= Y){
        ans += Y * addAB + (X - Y) * addA;
    }else{
        ans += X * addAB + (Y - X) * addB;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

lli add(lli a, lli b) {
	a += b;
	if (a >= mod) a -= mod;
	return a;
}

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}

vector<vector<int>> a;
int n,m;
vector<int> dp;

void dfs(int u){
	dp[u]=0;
	for(int v:a[u]){
		if(dp[v]==-1)dfs(v);
		dp[u]=max(dp[u],dp[v]+1);
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	cin>>m;
	a.assign(n,vector<int>());
	for(int i=0;i<m;i++){
		int x;
		cin>>x;
		int y;
		cin>>y;
		x--;y--;
		a[x].pb(y);
	}
	dp.assign(n,-1);
	for(int i=0;i<n;i++){
		if(dp[i]==-1){
			dfs(i);
		}
	}
	int ans=0;
	for(int i=0;i<n;i++)ans=max(ans,dp[i]);
	cout<<ans<<endl;
}


Measured memory_bytes: 8192
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstdio>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)2e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


ll dp[3010][3010];

int main(){
	string s,t; cin >> s >> t;
	int n = s.size();
	int m = t.size();
	rep(i,3010)rep(j,3010) dp[i][j] = 0;
	rep(i,n){
		rep(j,m){
			if(s[i] == t[j]) dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1);
			dp[i+1][j+1] = max(dp[i+1][j+1],dp[i+1][j]);
			dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j+1]);
		}
	}

	//復元
	string ans = "";
	while(n > 0 && m > 0){
		if(dp[n][m] == dp[n][m-1]) m--;
		else if(dp[n][m] == dp[n-1][m]) n--;
		else{
			ans = s[n-1] + ans;
			n--; m--;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 71168
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    

	input = input.split("\n");
    n = input[0].split(" ");
    s = input[1].split(" ");
    //console.log(n,s);
	//文字列から10進数に変換するときはparseIntを使います
    var n = parseInt(n, 10);

    s = input[1].trim();   //'ABCDEF'うけとり
    var cnt = 0;
    for(i=0;i<n;i=r+3){
    var r=s.indexOf('ABC',i);
   // console.log(i,r);
      if (r ==-1){break;
               }
        else{cnt++;
       //      console.log(cnt);
            }
    }
    console.log(cnt);



   

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include<stdio.h>

int N,M;

int graph[8][8];

int check[8];

int count(int now,int depth){
    int i,j,k;

    if(depth >= N)
        return 1;

    k = 0;
    for(i = 0;i < N;i++){
        if(graph[now][i] == 1 && check[i] == 0){
            check[i] = 1;
            k += count(i,depth + 1);
            check[i] = 0;
        }
    }
    return k;
}

int main(void){
    int i,j,k;

    scanf("%d %d",&N,&M);

    for(i = 0;i < M;i++){
        scanf("%d %d",&j,&k);

        graph[j - 1][k - 1] = graph[k - 1][j - 1] = 1;
    }

    check[0] = 1;
    printf("%d\n",count(0,1));
    return 0;
}

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

int main() {
    char b;
    cin >> b;

    if (b == 'A') cout << 'T' << endl;
    if (b == 'T') cout << 'A' << endl;
    if (b == 'C') cout << 'G' << endl;
    if (b == 'G') cout << 'C' << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
map<LL,int>num;
int n;
LL x,ans=0,sum=0; 
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&x);
		sum+=x;
		if(sum==0)ans++;
		ans+=num[sum];
		num[sum]++;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 12800
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    A = stdin.readline().rstrip().split()
    ori_len = len(A)
    setA = set(A)
    set_len = len(setA)
    if ori_len == set_len:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 31152
#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x; cin >> x;
    cout << (x >= 30 ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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


    ll n,m,k,ans = 0;
    cin>>n>>m>>k;
    vector<ll>a(n + 1,0),b(m + 1,0);
    rep(i,n){
        ll tmp;
        cin>>tmp;
        a[i + 1] = a[i] + tmp; 
    }
    rep(i,m){
        ll tmp;
        cin>>tmp;
        b[i + 1] = b[i] + tmp;
    }

    rep(i,n + 1){
        if(k < a[i])continue;
        ll key = k - a[i];
        auto itr = upper_bound(all(b),key);
        ll p = itr - b.begin() - 1;
        ans = max(ans,p + i);
    }

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 6272
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
#define pii pair<int, int>
const double pi = acos(-1);
const int sz = 200002;
ll n, m, q, k;
int main() {
	io
	int t = 1;
	//cin>>t;
	while(t--) {
		cin>>n;
		if(n%1000 == 0) cout<<0;
		else
		cout<<1000-(n%1000)<<endl;
	}
}


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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int n;
    cin >> n;
    vector<ll> a(n + 1), fin(n + 1), beg(n + 1);
    bool flg = false;
    beg[0] = 1;
    rep(i, n + 1) {
        cin >> a[i];
        if(i > 0) {
            beg[i] = (beg[i - 1] - a[i - 1]) * 2;
            if(beg[i] <= 0) {
                flg = true;
            }
            if(beg[i] >= INFLL) {
                beg[i] = INFLL;
            }
        }
        /*
        if(i < 32) {
            if(a[i] > (1ll << (i + 1))) {
                flg = true;
            }
        }
        */
    }
    if(a[n] > beg[n]) flg = true;

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

    fin[n] = a[n];
    for(int i = n - 1; i >= 0; i--) {
        fin[i] = fin[i + 1] + a[i];
    }

    ll ans = 0;
    rep(i, n + 1) {
        ans += min(beg[i], fin[i]);
    }
    if(ans <= 0) ans = -1;
    cout << ans << endl;
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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;
}


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

int main() {
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(u == s) a--;
    else b--;
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  // Your code here!
  int n,m;
  cin>>n>>m;
  
  vector<int> a(m);
  int sum=0;
  for(int i=0;i<m;i++){
    cin>>a[i];
    sum+=a[i];
  }
  
  if(n-sum>=0) cout<<n-sum<<endl;
  else cout<<-1<<endl;
  
  
}


Measured memory_bytes: 3636
'use strict';

function Main(INPUT) {
    const input = INPUT.split(" ").map(n => Number(n));
    const a = input[0];
    const b = input[1];
    const c = input[2];
    const d = input[3];

    if ((Math.abs(a - b) <= d && Math.abs(b - c) <= d) || Math.abs(a - c) <= d) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}

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


Measured memory_bytes: 7372
//https://atcoder.jp/contests/dp/tasks/dp_b
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define INF 2000000000 //2e9
#define min(a,b) (a<b?a:b)
const int N = 2e5 + 5;
int n, k, h[N];
vector<int> cache;
int dp (int idx) {
    if (idx == 1)
        return 0;
    int &ans = cache[idx];
    if (ans != INF)
        return ans;
    for(int i = 1; i <= k; i++) 
        if (idx-i > 0)
            ans = min(ans, abs(h[idx]-h[idx-i]) + dp(idx-i));
    return ans;
}

int32_t main() {
    IOS;
    int i;
    cin >> n >> k;
    cache.assign(n+1, INF);
    for(i = 1; i <= n; i++) 
        cin >> h[i];
    cout << dp(n);
    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  for (int i = 1; i <= n; ++i) {
    if (i % 3 == 0) {
      fprintf(stdout, " %d", i);
    }
    else {
      for (int x = i; x > 0; x /= 10) {
        if (x % 10 == 3) {
          fprintf(stdout, " %d", i);
          break;
        }
      }
    }
  }
  fprintf(stdout, "\n");
  return 0;
}

Measured memory_bytes: 1196
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
  int x, y;
  cin >> x >> y;
  if(x%y == 0) cout << -1 << endl;
  else cout << x << endl;
  return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<unordered_set> 
#include<cmath>
using namespace std;
//long long p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define fcout cout << fixed << setprecision(15)
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n, int mod) {
    if (n == 0) { return 1 % mod; }
    int x = rui(a, n / 2, mod);
    x *= x; x %= mod;
    if (n % 2 == 1) { x *= a; x %= mod; }
    return x;
}
vel pa;
int root(int x) {
    if (pa[x] == -1) { return x; }
    int ans = root(pa[x]); pa[x] = ans;
    return ans;
}
void marge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) { pa[x] = y; }
}
int gcd(int x, int y) {
    if (x < y) { return gcd(y, x); }
    if (y == 0) { return x; }
    return gcd(y, x % y);
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
vel uni(vel x) {
    if (x.size() == 0) { return x; }
    sor(x);
    int n = x.size();
    vel ans(1, x[0]);
    for (int j = 1; j < n; j++) {
        if (x[j - 1] != x[j]) { ans.push_back(x[j]); }
    }
    x = ans;
    return x;
}
void pr(vel& v) {
    int n = v.size();
    if (n != 0) {
        cout << v[0];
        rep(i, n - 1) {
            cout << " " << v[i + 1];
        }
        cout << endl;
    }
}
signed main(){
    int n, m; cin >> n >> m;
    cout << n * m << endl;
    return 0;
}



Measured memory_bytes: 3728
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<vector>
#include<functional>
#include<string.h>
#include<limits.h>
#include<queue>
#include<deque>
#include<stack>
#include<stdlib.h>
#include<algorithm>
#include<cmath>
#define mod 1000000007
#define int long long
using namespace std;

signed main() {
	int a, b; cin >> a >> b;
	int ans = 1;
	if (abs(a - b) > 1) {
		puts("0");
		return 0;
	}
	if (abs(a - b) == 0) {
		ans *= 2;
	}
	for (int i = 1; i <= a; i++) {
		ans = ans*i%mod;
	}
	for (int i = 1; i <= b; i++) {
		ans = ans*i%mod;
	}
	cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll X; cin >> X;

    ll now = 100;

    for (int i = 1;true;i++){
        now *= 1.01;
        if(now >= X){
            cout << i << endl;
            return 0;
        }
    }

    return 0;

}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
	int n, d, x;
	cin >> n >> d >> x;
	d--;

	int ans = x;
	rep(i, n) {
		int a;
		cin >> a;
		ans += d / a + 1;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b)for(int i=(a);i<=(b);i++)
#define repR(i,n) for(int i=n;i>=0;i--)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue<int>
#define PQR priority_queue<int,VE,greater<int>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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;
}

using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

const long long MOD = 1000000007;
const long long INF = 1LL << 50;
// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int h, w, n; cin >> h >> w >> n;
	vector<P>vec(n); rep(i, n)cin >> vec[i].first >> vec[i].second;
	sort(ALL(vec));
	VE ans(10);
	ans.front() = (h - 2)*(w - 2);
	rep(i, n) {
		P p = vec[i];
		rep(j, 3)rep(k, 3) {
			int x = p.first - j; int y = p.second - k;
			if (x <= 0 || y <= 0 || x + 2 > h || y + 2 > w)continue;
			int cnt = 0;
			rep(l, 3)rep(m, 3) {
				if (binary_search(ALL(vec), P(x + l, y + m))) {
					cnt++;
				}
			}
			ans[cnt]++;
		}
	}
	int sum = 0;
	FORR(i, 1, 9) {
		ans[i] /= i; sum += ans[i];
	}
	cout << ans.front() - sum << endl;
	rep(i, 9)cout << ans[i + 1] << endl;
	return 0;
}

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

using namespace std;

const long long INF = 1e18L+5;

int main(){
	int N, W;
	cin >> N >> W;
	
	vector<long long> weights(N), values(N);
	for(int index = 0; index < N; index++)
		cin >> weights[index] >> values[index];

	int sum = 0;
	for(int value: values)
		sum += value;
	
	vector<long long> DP(sum + 1, INF);
	DP[0]=0;
	
	for(int index = 0; index < N; index++)
		for(int value = sum - values[index]; value >= 0; value--)
			DP[value + values[index]] = min(DP[value + values[index]], DP[value] + weights[index]);
	
	long long result=0;
	for(int index = sum; index >= 0; index--)
		if(DP[index] <= W)
			result = max(result, (long long)index);	
	cout << result;

	return 0;
}


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

int main(){
 int sx,sy,tx,ty;	
 cin >> sx >> sy >> tx >> ty;
 string a="",c="";
 int rcnt=0;
 int ucnt=0;
 
 if(sx < 0 && tx >= 0) rcnt = abs(sx) + tx;
 else if(sx >= 0 && tx >= 0) rcnt = abs(tx - sx);
 else if(sx < 0 && tx < 0) rcnt = abs(sx - tx);
 
 if(sy < 0 && ty >= 0) ucnt = abs(sy) + ty;
 else if(sy >= 0 && ty >= 0) ucnt = abs(ty - sy);
 else if(sy < 0 && ty < 0) ucnt = abs(sy - ty);
 
 //cout << rcnt << " " << ucnt;
 for(int i = 1; i <= rcnt; i++) a += 'R';
 for(int i = 1; i <= ucnt; i++) a += 'U';
 
 c += "DR";
 c += a;
 c += "UL";
 
  cout << a;
  for(int i = 0; i < (int)a.size(); i++){
   if(a[i] == 'R') cout << "L";
   else if(a[i] == 'U') cout << "D";	 
  }
  cout << c;
  for(int i = 0; i < (int)c.size(); i++){
   if(c[i] == 'R') cout << "L";
   else if(c[i] == 'U') cout << "D";	 
   else if(c[i] == 'L') cout << "R";	 
   else if(c[i] == 'D') cout << "U";	 
  }
 return 0;
}

Measured memory_bytes: 3608
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> t = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            t.add(sc.nextInt());
        }
        Collections.sort(t);
        int cnt = 0;
        int cntBus = 0;
        int min = t.get(0);
        for (int i : t) {
            if (cntBus < c && i <= min + k) {
                cntBus++;
                continue;
            }
            cntBus = 1;
            min = i;
            cnt++;
        }
        cnt++;
        System.out.println(cnt);
    }
}


Measured memory_bytes: 58916
#include<stdio.h>
int getsn(long long int n)
{
    int sum=0;

    while(n!=0)
    {
        sum=sum+n%10;
        n=n/10;
    }
    return sum;
}

int main()
{
    int i, j, k, count;
    long long int x=1, n=1;
    scanf("%d", &k);
    puts("1");
    for(i=1; i<k; i++)
    {
        if((i-count)%9==0)
        {
            if(x+n>n*getsn(x+n))
            {
                n=n*10;
                count=0;
            }
            else
            {
                count++;
            }
        }
        x=x+n;
        printf("%lld\n", x);
    }
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int n, b, x = -1, y = -1, z = -1;
	cin >> n >> b;
	for(int i = 0; i <= n; i++){
		for(int j = i; j <= n; j++){
			if(10000 * i + 5000 * (j - i) + 1000 * (n - j) == b){
				x = i;
				y = j - i;
				z = n - j;
				break;
			}
		}
	}
	cout << x << " " << y << " " << z << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = map(int,input().split())

dict = {}
for i,a in enumerate(A):
    idx = a - 1
    t = (idx, i)
    if i <= idx:
        t = (i, idx)
    if t in dict:
        dict[t] += 1
    else:
        dict[t] = 1


ans = 0
for d in dict.values():
    if d == 2:
        ans += 1
print(ans)


Measured memory_bytes: 30572
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  (h : n : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  abs <- sequence . replicate n $ unsafeListToTuple . map unsafeTextToInt . T.words <$> T.getLine :: IO [(Int, Int)]
  let
    abs' = VU.fromList abs
    minSumBs :: VU.Vector Int
    minSumBs = VU.constructN (succ h) rec
      where
        rec v | l == 0    = 0
              | otherwise = VU.minimum . VU.map ((+) <$> (v VU.!) . max 0 . flip subtract l . fst <*> snd) $ abs'
          where
            l = VU.length v
  print $ minSumBs VU.! h

unsafeListToTuple :: [Int] -> (Int, Int)
unsafeListToTuple (x : y : _) = (x, y)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////




int main(){
    ll n,k;cin>>n>>k;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll dp[n];rep(i,0,n-1)dp[i]=inf;
    dp[0]=0;
    rep(i,1,n-1){
        for(ll j=i-1;j>=i-k&&j>=0;j--){
            Min(&dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n-1]<<endl;
    
    return 0;
}




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

int main()
{
    long double N ,K;
    scanf("%Lf%Lf", &N, &K);

    long double ans = 0.0;
    for (long double i = 1.0; i < N+1.0; ++i)
    {
        long double ct = 0.0;
        long double tmp = i;
        while (K > tmp)
        {
            tmp *= 2.0;
            ct++;
        }
        ans += pow(0.5, ct);
    }

    ans /= N;

    printf("%.12Lf\n", ans);
}

Measured memory_bytes: 128
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// template<class... Args>
// auto create(size_t n, Args&&... args) {
// 	if constexpr(sizeof...(args) == 1)
// 		return vector(n, args...);
// 	else
// 		return vector(n, create(args...));
// }

// template<typename... T>
// void read(T&... args) {
// 	((cin >> args), ...);
// }

// template<typename... T>
// void write(T&&... args) {
// 	((cout << args), ...);
// }

void solve() {
	int n, q, bi, ci;
	cin >> n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	cin >> q;
	int ans = accumulate(arr.begin(), arr.end(), 0LL);
	unordered_map<int, int> mp;
	for(auto ele : arr)
		mp[ele]++;
	while(q--) {
		cin >> bi >> ci;
		cout << ans - (bi * mp[bi]) + (ci * mp[bi]) << "\n";
		ans = ans - (bi * mp[bi]) + (ci * mp[bi]);
		mp[ci] += mp[bi];
		mp[bi] = 0;
	}	
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}


Measured memory_bytes: 7860
open Batteries
open Printf
let () =
  let a,b = Scanf.scanf "%d %d " (fun a b -> a,b) in

  Printf.printf "%s\n" @@
  if a mod 3 = 0 || b mod 3 = 0 || (a+b) mod 3 = 0 then "Possible" else "Impossible"



Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#define lmid l,m,rt<<1
#define rmid m+1,r,rt<<1|1
#define LL long long
#define rl r-l+1
using namespace std;
char s[105],t[205];
int main()
{
     int n;
     scanf("%d",&n);
     scanf("%s",s);
     int cnt=0;
     int sum=0,sum1=0;
     for(int i=n-1;i>=0;i--)
     {
          if(s[i]==')')
               t[cnt++]=')',sum++;
          if(s[i]=='(')
          {
               if(sum>0)
               {
                    t[cnt++]='(';
                    sum--;
                    continue;
               }
               else t[cnt++]='(',sum1++;
          }
     }
     while(sum)
     {
          sum--;
          t[cnt++]='(';
     }
     //cout<<sum<<endl;
     for(int i=cnt-1;i>=0;i--)
          cout<<t[i];
     while(sum1)
     {
          sum1--;
          cout<<")";
     }
     cout<<endl;
}


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

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

int main() {
	int a, b, c;
	while (cin >> a >> b >> c, a != 0) {
		int min_sum_xy = 1L << 30, min_sum = 1L << 30, ans_x = -1, ans_y = -1;
		
		auto update = [&](int x, int y) {
			if (min_sum_xy > x+y) {
				min_sum_xy = x+y;
				min_sum = a * x + b * y;
				ans_x = x;
				ans_y = y;
			} else if (min_sum_xy == x+y) {
				if (min_sum > a * x + b * y) {
					min_sum = a * x + b * y;
					ans_x = x;
					ans_y = y;
				}
			}
		};
		
		for_(x,0,50001) {
			int Z = a * x + c;
			if (Z % b == 0) update(x, Z/b);
			Z = a * x - c;
			if (Z >= 0 && Z % b == 0) update(x, Z/b);
			Z = c - a * x;
			if (Z >= 0 && Z % b == 0) update(x, Z/b);
		}
		
		cout << ans_x << " " << ans_y << endl;
	}
}

Measured memory_bytes: 3072
N, M = map(int, input().split(' '))
def sunuke_f3(n, m) :
    if n >= m :
        return(m//2)
    else :
        if 2*n < m :
            return(n + (m-2*n)//4)
        else :
            return(m//2)
print(sunuke_f3(N, M))

Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long N, A, B;
  string S;
  cin >> N >> A >> B >> S;
  long a = 0, b = 0;
  rep (i, N) {
    if (S[i] == 'a') {
      if (a+b < A+B) {
        cout << "Yes" << endl;
        a++;
      } else cout << "No" << endl;
    }
    if (S[i] == 'b') {
      if (a+b < A+B and b < B) {
        cout << "Yes" << endl;
        b++;
      } else cout << "No" << endl;
    }
    if (S[i] == 'c') cout << "No" << endl;
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 848
def main():
    N = int(input())
    a = list(map(int, input().split()))
    #N = 1000
    #a = [i for i in range(N)]

    #summation = [abs(sum(a[:(i+1)]) - sum(a[(i+1):])) for i in range(len(a)-1)]

    summation = []
    sumtemp = sum(a)
    tmp1 = 0
    for i in range(len(a)-1):
        tmp1 += a[i]
        tmp2 = sumtemp - tmp1
        tmp = abs(tmp1 - tmp2)
        summation.append(tmp)
        
    print(min(summation))

main()



Measured memory_bytes: 24816
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] arr = new int[m][2];
        for (int i=0; i<m; i++) {
            arr[i][0] = sc.nextInt() - 1;
            arr[i][1] = sc.nextInt() - 1;
        }

        UnionFind uf = new UnionFind(n);
        for (int i=0; i<m; i++) {
            uf.unite1(arr[i][0], arr[i][1]);
        }

        Set<Integer> set = new HashSet<>();
        for (int i=0; i<n; i++) {
//            System.out.println(uf.parent[i]);
            set.add(uf.find(i));
        }

//        System.out.println(set);
        System.out.println(set.size() - 1);

    }

    class UnionFind {

        int[] parent, rank, size;

        void init(int n) {
            parent = new int[n];
            rank = new int[n];
            for (int i=0; i<n; i++) {
                parent[i] = i;
                rank[i] = 0;
            }
        }

        UnionFind(int n) {
            parent = new int[n];
            size = new int[n];
            for (int i=0; i<n; i++) {
                parent[i] = i;
            }
        }

        public int find(int x) {
            if (x==parent[x]) return x;
            return parent[x] = find(parent[x]);
        }

        //    結合して木のサイズを更新
        public void unite1(int x, int y) {
            x = find(x);
            y = find(y);
            if (x==y) return;
            parent[x] = y;
        }
        
        //    結合して木の深さを更新
        public void unite2(int x, int y) {
            x = find(x);
            y = find(y);
            if (x==y) return;
            if (rank[x] < rank[y]) {
                parent[x] = parent[y];
            } else {
                parent[y] = parent[x];
                if (rank[x]==rank[y]) rank[x]++;
            }
        }

        public boolean same(int x, int y) {
            return find(x) == find(y);
        }

        public int size(int x) {
            return size[find(x)];
        }


    }


}



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

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(ll i = 0; i < n; ++i)
#define REP3(i, s, e) for(ll i = s; i <= e; ++i)

constexpr double PI=3.14159265358979323846;

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

int main(){
    ll A1 = read<ll>();
    ll A2 = read<ll>();
    ll A3 = read<ll>();
    
    if(A1 + A2 + A3 >= 22){ write("bust"); }
    else { write("win"); }
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;


ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
bool root(string s){
    int n=s.length();
    if(n==2){
        if(s[0]==s[1]){
            return true;
        }
        else return false;
    }
    if(n==3){
        if(s[0]==s[2]){
            return true;
        }
        else return false;
    }
 
    return false;
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

//深さ優先
vector<int> seen;
vector<ll> h;
 
//普通の深さ優先探索seenを返す感じ
void dfs(const Graph &G,int v){

    seen[v] = 0; //v探索済み
 
    P good=make_pair(v,h[v]);
    for(auto next_v :G[v]){
        if(seen[next_v]!=-1) continue;//もう探索していた
        if(h[next_v]>good.second){
            good=make_pair(next_v,h[next_v]);
        }
        dfs(G,next_v);
    }
 
    if(!(h[v]==good.second && v==good.first)){
        seen[good.first]=1;
    }
}


int n;

void dfs(string s, char mx){
    if(s.length()==n){
        cout<<s<<endl;
    }else{
        for(char c='a';c<=mx;c++){
            dfs(s+c,((c==mx) ? (char)(mx+1) : mx));
        }
    }
}


signed main(){ 
    string s; cin>>s;
    if(s[0]==s[1]&&s[1]==s[2]){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }

}  


Measured memory_bytes: 256
#include <iostream>
                        #include<cmath>
                        #include<string>
                        using namespace std;
                        int main()
                        {
                          int arr[5];
                          for(int i=1;i<=5;i++)
                          {
                            cin>>arr[i];
                            if(arr[i]==0)
                            {
                              cout<<i;
                              break;
                            }
                          }
                            
                        }

Measured memory_bytes: 3588
import sys

x = sys.stdin.readline()

a=0
b=0

for i in x:
  if ( i == 'A'):
    a = 1
  if ( i == 'B'):
    b = 1

if( a == 1 and b == 1):
	print "Yes"
else:
	print "No"

sys.stdout.flush()


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

#define endl "\n"
typedef long long LL;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e3 + 5;

int w, n;
int a[ N ], b[ N ];
int dp[ 1001 ][ 10001 ];

int solve(int idx, int rem) {
  if (rem <= 0) return 0;
  if (idx > n) return inf;
  if (dp[idx][rem] != -1) return dp[idx][rem];
  int ret = inf;
  ret = min(ret, solve(idx, rem - a[idx]) + b[idx]);
  ret = min(ret, solve(idx + 1, rem));
  return dp[idx][rem] = ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  cin >> w >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(1, w) << endl;
  return 0;
}



Measured memory_bytes: 39936
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define maxn 1010
using namespace std;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n;
struct P{
    int x,y;
}p[maxn];
int a[maxn],cnt;
char ans[maxn],top;
void work(int x,int y)
{
    top=0;
    for(int i=cnt;i>=1;i--)
    {
        if(abs(x)>abs(y))
        {
            if(x<0)
            {
                x+=a[i];
                ans[++top]='L';
            }
            else{
                x-=a[i];
                ans[++top]='R';
            }
        }
        else{
            if(y<0)
            {
                y+=a[i];
                ans[++top]='D';
            }
            else{
                y-=a[i];
                ans[++top]='U';
            }
        }
    }
    for(int i=top;i>=1;i--)  printf("%c",ans[i]);
    puts("");
}
int main()
{
    n=read();
    for(int i=1;i<=n;i++)  p[i].x=read(),p[i].y=read();
    int com=((p[1].x+p[1].y)&1);
    for(int i=1;i<=n;i++)
    {
        if(((p[i].x+p[i].y)&1)!=com)
        {
            puts("-1");
            return 0;
        }
    }
    int mx=0;
    for(int i=1;i<=n;i++)  mx=max(mx,p[i].x+p[i].y-(!com));
    if(com==0)  a[++cnt]=1;
    for(int i=0;;i++)
    {
        if((1ll<<i)>mx)  break;
        a[++cnt]=(1<<i);
    }
    printf("%d\n",cnt);
    for(int i=1;i<=cnt;i++)  printf("%d ",a[i]);
    puts("");
    for(int i=1;i<=n;i++)  work(p[i].x,p[i].y);
    return 0;
}


Measured memory_bytes: 256