akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

int main(void){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i=0;i<n;i++)	scanf("%d", &a[i]);
	
	int cur=1;
	
	for(int i=0;i<n;i++){
		if(a[i]==cur)	cur++;
	}
	if(cur==1)	printf("-1");
	else	printf("%d", n-cur+1);
		
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>

using namespace std;

int SearchCount(vector<int>, int);

int main(){
  int i, n, m, Search, Count;
  vector<int> data;

  while(1){
    cin >> n;
    if(n == 0) break;

    for(i=0; i<n; ++i){
      cin >> m;
      data.push_back(m);
    }
    cin >> Search;

    Count = SearchCount(data, Search);
    cout << Count << endl;
    data.clear();
  }

  return 0;
}

int SearchCount(vector<int> data, int Search){
  int middle, left = 0, right = data.size()-1, count=0;

  while(right >= left){
    middle = (left + right)/2;
    count++;
    if(Search == data[middle]){
      break;
    }else if(Search < data[middle]){
      right = middle-1;
    }else{
      left = middle+1;
    }      
  }
  return count;

}

Measured memory_bytes: 0
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		//int b = Integer.parseInt(sc.next());
		//int c = Integer.parseInt(sc.next());

		System.out.println(a == 1 ? "0" : 1);

	}
}

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

using namespace std;

typedef long long ll;

string S;
ll ruisekiwa[100001][4];

ll dp[100001][4];

const ll MOD = 1000000007;

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A')ruisekiwa[i + 1][0]++;
		else if (S[i] == 'B')ruisekiwa[i + 1][1]++;
		else if (S[i] == 'C')ruisekiwa[i + 1][2]++;
		else if (S[i] == '?')ruisekiwa[i + 1][3]++;
		for (int j = 0; j < 4; j++) {
			ruisekiwa[i + 1][j] += ruisekiwa[i][j];
		}
	}

	dp[0][0] = 1;

	for (int i = 1; i <= S.size(); i++) {

		for (int j = 0; j < 4; j++) {
			if (S[i - 1] == '?')
				dp[i][j] += dp[i - 1][j] * 3;
			else
				dp[i][j] += dp[i - 1][j];
		}

		if (S[i - 1] == 'A' || S[i - 1] == '?') {
			dp[i][1] += dp[i - 1][0];
		}
		if (S[i - 1] == 'B' || S[i - 1] == '?') {
			dp[i][2] += dp[i - 1][1];
		}
		if (S[i - 1] == 'C' || S[i - 1] == '?') {
			dp[i][3] += dp[i - 1][2];
		}

		for (int j = 0; j < 4; j++) {
			dp[i][j] %= MOD;
		}
	}
	
	cout << dp[S.size()][3] << endl;

	return 0;
}

Measured memory_bytes: 6784
#include<stdio.h>
int  main()
{
  int N,M,A[10000],i,wa;
  scanf("%d%d%",&N,&M);
  wa=0;
  for(i=0;i<M;i++)
  {
    scanf("%d",&A[i]);
    wa=wa+A[i];
  }
  if(wa<=N)
  {
    printf("%d",N-wa);
  }
  else
  {
    printf("%d",-1);
  }
}

Measured memory_bytes: 1736
#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
//#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(bool);
void precalc();
clock_t start;
int main() {
#ifdef AIM
  freopen("/home/alexandero/ClionProjects/ACM/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/ACM/output.txt", "w", stdout);
  //freopen("out.txt", "w", stdout);
#else
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
#endif
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
    //cout << "Case #" << testNum++ << ": ";
    //cerr << testNum << endl;
    solve(true);
    //cerr << testNum - 1 << endl;
  }
  cout.flush();
#ifdef AIM1
  while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cerr << "\n\n time: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

  return 0;
}

//BE CAREFUL: IS INT REALLY INT?

template<typename T>
T binpow(T q, T w, T mod) {
  if (!w)
    return 1 % mod;
  if (w & 1)
    return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template<typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
  sort(all(a));
  a.erase(unique(all(a)), a.end());
}

void precalc() {}

template<typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}

//#define int li
//const int mod = 1000000007;

void solve(bool read) {
    int h, w, d;
    cin >> h >> w >> d;
    string cols = "RYGB";
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            int num1 = (i + j) / d;
            int num2 = (i - j + w) / d;
            int col = 0;
            if (num1 & 1) {
                col ^= 1;
            }
            if (num2 & 1) {
                col ^= 2;
            }
            cout << cols[col];
        }
        cout << endl;
    }

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int const MOD = 1000000007;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
   
    int n;
    while(cin>>n){
        if(n==0)break;
        int dp[n+1]={}; dp[0]=1;
        for (int i = 0; i < n; i++){
            for (int j = 1; (j <= 3)&&(i+j <= n); j++){
                dp[i+j]+=dp[i];
            }
        }
    cout<<dp[n]/3650+1<<'\n';
    }
}


Measured memory_bytes: 3068
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define pr(x) cout<<#x<<" "<<x;
#define pl(x) cout<<#x<<" "<<x<<endl;
#include<math.h>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_set>
using namespace std;
map <string, int> dp;
int direction[4] = { 1, -1, 4, -4 };
void bfs(){
    queue <string >que;
    que.push("01234567");
    dp["01234567"] = 0;
    while(que.size()){
        string now = que.front();
        que.pop();
        int index = 0;
        for(int i = 0;i<8;i++){
            if(now[i] =='0'){
                index = i;
                break;
            }
        }
        for(int i =0;i<4;i++){
            int n = index + direction[i];
            if(n>=0&&n<8&&!(index==3&&i==0)&&!(index==4&&i==1)){
                string next = now;
                swap(next[n],next[index]);
                if(dp.find(next)==dp.end()){
                    dp[next] = dp[now]+1;
                    que.push(next);
                }
            }
        }
    }

}



int main(){
    bfs();
	string line;
	while (getline(cin, line))
	{
		line.erase(remove(line.begin(), line.end(), ' '), line.end());
		cout << dp[line] << endl;
	}

	return 0;


}

Measured memory_bytes: 5220
#include<bits/stdc++.h>
#define pb emplace_back
#define rt(v) return cout<<v,0
#define sz(v) (int)(v.size())
#define all(a) a.begin(),a.end()
#define endl '\n'
#define space " "
typedef long long ll;
typedef unsigned long long ull;
const int N = 10 + 1e5;
const int mod = 1e9 + 7;
/*

███╗   ███╗███████╗███╗   ███╗███████╗    ██╗      ██████╗ ██████╗ ██████╗
████╗ ████║██╔════╝████╗ ████║██╔════╝    ██║     ██╔═══██╗██╔══██╗██╔══██╗
██╔████╔██║█████╗  ██╔████╔██║█████╗      ██║     ██║   ██║██████╔╝██║  ██║
██║╚██╔╝██║██╔══╝  ██║╚██╔╝██║██╔══╝      ██║     ██║   ██║██╔══██╗██║  ██║
██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║███████╗    ███████╗╚██████╔╝██║  ██║██████╔╝
╚═╝     ╚═╝╚══════╝╚═╝     ╚═╝╚══════╝    ╚══════╝ ╚═════╝ ╚═╝  ╚═╝╚═════╝

*/

using namespace std;
void Ferrari() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main() {
	int n; cin >> n;
	vector<int>v(n);
	for (int& i : v) cin >> i;
	for (int i = 1; i < n; ++i) {
		if (v[i] < v[i - 1]) rt("No");
		v[i] = max(v[i] - 1, v[i - 1]);
	}
	cout << "Yes";
	return 0;
}
//1 2 3 4 5 -


//5 4 3 2 1
/* stuff you should look for
	* keepin sharp mind.
	* int overflow, array bounds.
	* special cases (n=1?), set tle , make sure you understand the problem correctly.
	* don`t stuck in a problem.
	* test the idea on samples.
	*/

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

class Node {
public :
	int location;
	int p, l, r;
	Node() {};
};

class Point {
public:
	int id, x, y;
	Point() {};
	Point(int id, int x, int y) :id(id), x(x), y(y) {};
	bool operator < (const Point &p) const {
		return id < p.id;
	}

	void print(){
		printf("%d\n", id);
	}

};

const int maxx = 1000010;
const int NIL = -1;

Point p[maxx];
Node T[maxx];
vector<Point> A;
int n,q,np=0;

bool cxddx(Point xx, Point yy){
	return xx.x<yy.x;
}
bool cxddy(Point xx, Point yy){
	return xx.y<yy.y;
}

int makekdtree(int left,int right,int depth){
	if(left>=right) return NIL;
	int mid = (left+right)/2;
	int t=np++;
	if(depth%2==0){
		sort(p+left,p+right,cxddx);
	}
	else{
		sort(p+left,p+right,cxddy);
	}
	T[t].location=mid;
	T[t].l=makekdtree(left,mid,depth+1);
	T[t].r=makekdtree(mid+1,right,depth+1);
	return t;
}

void find(int v,int sx,int sy,int tx,int ty,int depth){
	int x=p[T[v].location].x,y=p[T[v].location].y;
	if(sx<=x && sy<=y && tx>=x && ty>=y){
		A.push_back(p[T[v].location]);
	}
	if(depth%2==0){
		if(T[v].l!=NIL){
			if(sx<=x) find(T[v].l,sx,sy,tx,ty,depth+1);
		}
		if(T[v].r!=NIL){
			if(tx>=x) find(T[v].r,sx,sy,tx,ty,depth+1);
		}
	}
	else{
		if(T[v].l!=NIL){
			if(sy<=y) find(T[v].l,sx,sy,tx,ty,depth+1);
		}
		if(T[v].r!=NIL){
			if(ty>=y) find(T[v].r,sx,sy,tx,ty,depth+1);
		}
	}
	return ;
}

int main(){
	int x,y;
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d %d", &x, &y);
		p[i] = Point(i, x, y);
		T[i].l = T[i].r = T[i].p = NIL;
	}
	int root=makekdtree(0,n,0);
	
	scanf("%d", &q);
	int sx,sy,tx,ty;
	while(q--){
		scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
		A.clear();
		find(root,sx,sy,tx,ty,0);
		sort(A.begin(),A.end());
		int len=A.size();
		for(int i=0;i<len;i++) A[i].print();
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 16496
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
#define all(obj) obj.begin(), obj.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
constexpr ll bigNum = 1000000007;

signed main()
{
    fast;
    int M, D = 0;
    int d1, d10, m = 0;
    cin >> M >> D;
    int count = 0;
    for (int i = 1; i <= M; i++)
    {
        for (int j = 1; j <= D; j++)
        {
            d10 = j / 10;
            d1 = j - (d10 * 10);
            if (i == d1 * d10 && d1 >=2 && d10 >=2)
            {
                count++;
            }
        }
    }
    cout << count;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
using graph = vector<vector<int>>;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define all(x) (x).begin(),(x).end()
#define size(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000

#define pb push_back
#define mp make_pair
#define f first
#define s second

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

#define FIND(a,b) find(all(a),b)!=a.end()

graph dp(100100,vector<int>(3,0));

bool vs(char t,int i){
	if(t=='r'&&i==2)return true;
	if(t=='s'&&i==0)return true;
	if(t=='p'&&i==1)return true;
	else return false;
}

int main(){
	int n,k;cin>>n>>k;
	int r,s,p;cin>>r>>s>>p;
	string t;cin>>t;
	int ans=0;
	graph v(k);
	rep(i,size(t)){
		v[i%k].pb(t[i]);
	}
	rep(o,k){
		dp[0][0]=vs(v[o][0],0)*r;
		dp[0][1]=vs(v[o][0],1)*s;
		dp[0][2]=vs(v[o][0],2)*p;

		FOR(i,1,size(v[o])-1){
			dp[i][0]=max(dp[i-1][1]+vs(v[o][i],0)*r,dp[i-1][2]+vs(v[o][i],0)*r);
			dp[i][1]=max(dp[i-1][2]+vs(v[o][i],1)*s,dp[i-1][0]+vs(v[o][i],1)*s);
			dp[i][2]=max(dp[i-1][0]+vs(v[o][i],2)*p,dp[i-1][1]+vs(v[o][i],2)*p);
		}
		ans+=max(dp[size(v[o])-1][0],max(dp[size(v[o])-1][1],dp[size(v[o])-1][2]));
	}
	cout<<ans<<endl;
}





Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a,b,x,y;
    cin>>a>>b>>x>>y;

    for(int i=0;;i++)
    {
        if(i%2==0)
        {
            x-=b;
            if(x<=0)
            {
                cout<<"Yes"<<endl;
                break;
            }
        }
        else
        {
            a-=y;
            if(a<=0)
            {
                cout<<"No"<<endl;
                break;
            }
        }

    }



    return 0;
}


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

const int INF = 1e9;

int dfs(int rest, int count) {
  if(rest==0) return count;
  if(rest<6) return dfs(rest-1,count+1);

  int ret=INF;
  int numFor6=0;
  while(rest>=pow(6,numFor6)){
    numFor6++;
  }
  ret = min(ret, dfs(rest-pow(6,numFor6-1),count+1));

  int numFor9=0;
  while(rest>=pow(9,numFor9)){
    numFor9++;
  }
  ret = min(ret, dfs(rest-pow(9,numFor9-1),count+1));

  return ret;
}


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

  cout << dfs(N, 0) << endl;

  return 0;
}

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

using namespace std;

int main(){
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  int l[100010], r[100010];
  rep(i,Q){
    cin >> l[i] >> r[i];
    l[i]--; r[i]--;
  }
  int num[100010];
  rep(i,N) num[i]=0;
  rep(i,N-1){
    if(S[i]=='A'&&S[i+1]=='C') num[i+1]=num[i]+1;
    else num[i+1]=num[i];
  }
  rep(i,Q){
    int ans=0;
    if(!l[i]) ans=num[r[i]];
    else{
      ans=num[r[i]]-num[l[i]-1];
      if(S[l[i]-1]=='A'&&S[l[i]]=='C') ans--;
    }
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int x=c-a;
	int y=d-b;
	cout<<c-y<<' '<<d+x<<' '<<a-y<<' '<<b+x;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
int a, b;
string c, d;
/**********************************************/

int main(){
    cin >> a >> b;
    cout << a + (b - a) * 2 << endl;
}


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

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


Measured memory_bytes: 2992
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long long dp[n + 2][n + 2];
    vector<long long>v(n + 2), cum(n + 2);
    cum[0] = 0;
    for(int i = 1; i <= n; i++){
        cin >> v[i];
        cum[i] = cum[i - 1] + v[i];
        dp[i][i] = v[i];
    }
    for(int i = 2; i <= n; i++){
        for(int l = 1; l + i - 1 <= n; l++){
            int r = l + i - 1;
            long long x = v[l] + cum[r] - cum[l] - dp[l + 1][r];
            long long y = v[r] + cum[r - 1] - cum[l - 1] - dp[l][r - 1];
            dp[l][r] = max(x, y);
        }
    }
    cout << 2*dp[1][n] - cum[n];
    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    string s;
    cin >> s;
    int res = 0;
    if(s.size() == 1)
    {
        cout << 0;
        return 0;
    }
    FOR(i, 0, s.size() / 2 - 1)
    {
        if(s[i] != s[s.size() - i - 1]) res++;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX(a,b) ((a>b)?(a):(b))
int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    printf("%d\n",MAX(a*b,c*d));
    return 0;
}

Measured memory_bytes: 128
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string solve(int n, string s) {
	vector<int> a(n), b(n), c(2 * n);
	int ca = 0, cb = 0;
	for (int i = 0; i < 2 * n; ++i) {
		if (s[i] == 'a') c[i] = ca, a[ca++] = i;
		if (s[i] == 'b') c[i] = cb, b[cb++] = i;
	}
	vector<string> dp(2 * n), cmax(2 * n + 1);
	for (int i = 2 * n - 1; i >= 0; --i) {
		int others = (s[i] == 'a' ? b[c[i]] : a[c[i]]);
		if (others >= i) {
			if (s[i] == 'a') {
				dp[i] = "ab" + cmax[others + 1];
			}
			else {
				vector<int> st;
				int right = i;
				for (int j = c[i]; j < n; ++j) {
					if (a[j] < b[j]) continue;
					if (!st.empty() && b[j] > right) break;
					st.push_back(a[j]);
					st.push_back(b[j]);
					right = max(right, a[j]);
				}
				sort(st.begin(), st.end());
				string prefix;
				for (int j : st) prefix += s[j];
				dp[i] = prefix + (st.empty() ? "" : cmax[st.back() + 1]);
			}
		}
		cmax[i] = max(cmax[i + 1], dp[i]);
	}
	return cmax[0];
}
int main() {
	int n; string s;
	cin >> n >> s;
	cout << solve(n, s) << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int n,m,i,j;
    scanf("%d %d",&n,&m);
    if(n>m)
    {
        for(i=1;i<=n;i++)
            printf("%d",m);
    }
    else if(n<m)
    {
        for(i=1;i<=m;i++)
            printf("%d",n);
    }
    else if(n==m)
    {
        for(i=1;i<=n;i++)
            printf("%d",m);
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
int a[7],i,b,c,d,e;
while(scanf("%d",&a[0])!=EOF){
for(i=1;i<6;i++){
scanf("%d",&a[i]);
}
scanf("\n");
b=3600*a[0]+60*a[1]+a[2];
c=3600*a[3]+60*a[4]+a[5];
b=c-b;
d=b/3600;
b=b-3600*d;
e=b/60;
b=b-60*e;
printf("%d %d %d\n",d,e,b);
}
return 0;
}




Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define reg register
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int h,w,k;
int f[105][10],fib[205];
int main(){
	cin>>h>>w>>k;fib[1]=fib[2]=1;
	for(reg int i=3;i<=200;i++)fib[i]=(fib[i-1]+fib[i-2])%mod;
	f[h+1][1]=1;
	for(reg int i=h+1;i>1;i--){
		for(reg int j=1;j<=w;j++){
			if(j>1)f[i-1][j-1]=(f[i-1][j-1]+1ll*f[i][j]*fib[j-1]%mod*fib[w-j+1]%mod)%mod;
			f[i-1][j]=(f[i-1][j]+1ll*f[i][j]*fib[j]%mod*fib[w-j+1]%mod)%mod;
			if(j<w)f[i-1][j+1]=(f[i-1][j+1]+1ll*f[i][j]*fib[j]%mod*fib[w-j]%mod)%mod;
		}
	}printf("%d\n",f[1][k]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF (1e9)
#define N 100005
using namespace std;
string s;
int n,l=INF,r=0,L[N],R[N];

int main(){
  cin>>n>>s;
  s='x'+s;
  for(int i=1;i<s.size();i++){
    if(s[i]=='>')l=min(l,i);
    else r=max(r,i);
  }
  for(int i=1;i<s.size();i++){
    if(s[i]=='>')L[i]+=L[i-1]+1;
    else L[i]+=L[i-1];
  }
  for(int i=s.size()-1;i>=1;i--){
    if(s[i]=='<')R[i]+=R[i+1]+1;
    else R[i]+=R[i+1];
  }
  int ans=0;
  for(int i=1;i<s.size();i++){
    if(!L[i-1]&&!R[i+1])
      if(s[i]=='>')ans=max(ans,(int)s.size()-i);
      else ans=max(ans,i);
    else if(L[i-1]-R[i+1]==1&&s[i]=='<')
      ans=max(ans,(int)s.size()-l);
    else if(R[i+1]-L[i-1]==1&&s[i]=='>')
      ans=max(ans,r);
    else if(L[i-1]==R[i+1]){
      if(s[i]=='>')
	ans=max(ans,(int)s.size()-l);
      else ans=max(ans,r);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n=0;
    string s;
    cin>>s;
    for (int i=0;i<4;i++) {
        if (s.at(i)=='+') {
            n++;
        } else {
            n--;
        }
    }
    cout<<n<<endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args) { 
		/* 
		 * */
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int K = I.nextInt();
		while (K-->0) {
			O.p("ACL");
		}
	}
	public static double max(double a, double b) {return Math.max(a, b);}
	public static double min(double a, double b) {return Math.min(a, b);}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x) {return Math.abs(x);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(min(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


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

int main(){
    int n;
    cin >> n;
    int num[10][10];
    memset(num,0,sizeof(num));
    for(int i=1;i<=n;i++){
        string s = to_string(i);
        int a = (int)(s[0]-'0');
        int b = (int)(s[s.length()-1]-'0');
        num[a][b]++;
    }
    int ans=0;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            ans+=num[i][j]*num[j][i];
        }
    }
    cout << ans << endl;

}

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

int main()
{
    long long A, B;
    cin >> A >> B;
    long long result = 1;
    long long x = 2;
    while (x <= A && x <= B) {
        if (A % x == 0 && B % x == 0) {
            A /= x;
            B /= x;
            result *= x;
        } else {
            x += 1;
        }
    }
    
    result *= A * B;
    cout << result;
    
    return 0;
}

Measured memory_bytes: 888
/**
 * author:    Ziel
 * created:   23.04.2020 20:19:46
**/

// ~zaletaet~

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back

using namespace std;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const double EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for (string& x: a)
        cin >> x;
    vector<vector<ll>> dp(h + 1, vector<ll>(w + 1));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (!i || !j) {
                if (i) dp[i][j] = dp[i - 1][j] * (a[i - 1][j] == '.');
                else if (j) dp[i][j] = dp[i][j - 1] * (a[i][j - 1] == '.');
                else dp[i][j] = 1;
            } else dp[i][j] = ((dp[i - 1][j] * 1ll * (a[i - 1][j] == '.')) + (dp[i][j - 1] * 1ll * (a[i][j - 1] == '.'))) % MOD;
        }
    }
    cout << dp[h - 1][w - 1];
            
    
	return 0;
}

/*
	Raise your standard.
*/


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

int main(){
    int H,W;
    while(1){
     cin >> H >> W;
     if(H == 0 && W == 0)break;
     for(int s = 0; s < H; s++){
         
         if(s == 0 || s == H - 1){
             for(int i = 0; i < W; i++){
                 printf("#");
             }
         }
         
         else{
             printf("#");
             for(int i = 0; i < W - 2; i++){
                 printf(".");   
             }
             printf("#");
         }
         
         printf("\n");
     }
     printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2980
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
//#include <tuple>
#include <set>
#include <string.h>
#include <functional>

#define X first
#define Y second
#define MP make_pair
//#define MT make_tuple
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
#define FOR(i, n) REP(i, 0, n)
typedef long long ll;
using namespace std;
const int MAX = 500;

template<class T, class U>
void convert(T &t, U &u)
{
	stringstream ss;
	ss << t;
	ss >> u;
}

int main()
{
	int n;
	while (cin >> n && n){
		vector<int> vi;
		FOR(i, n){
			int t; cin >> t;
			vi.push_back(t);
		}

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

		ll ans = 0;
		ll sum = 0;
		FOR(i, vi.size() - 1){
			sum += vi[i];
			ans += sum;
		}
		
		cout << ans << endl;
 	}

	return 0;
}

Measured memory_bytes: 1320
import java.io.*;
        import java.util.Scanner;

public class Main{
    public static void main(String []args) throws IOException
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n==1)
            System.out.println("Hello World");
        else{
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(a+b);
        }

    }
}

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

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

Measured memory_bytes: 3592
#include<stdio.h>
int main()
{
  int n,i,j,u,k,v,c,x;
  int d[101][101]={0};

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

    for(j=0; j<k; j++){
      scanf("%d%d",&v,&c);
      d[u][v] = c;
    }
  }

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      if(d[i][j]==0 && i!=j)
	d[i][j]=1000000;
    }
  }
  
  for(x=0; x<n; x++){
    for(i=0; i<n; i++){
      for(j=0; j<n; j++){

	if(d[i][x]+d[x][j]<d[i][j])
	  d[i][j] = d[i][x]+d[x][j];
	else
	  d[i][j] = d[i][j];
      }
    }
  }
  
  for(i=0; i<n; i++){
    printf("%d %d\n",i,d[0][i]);
  }

  return 0;
}



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

int main() {
    long n, r = 0;
    cin >> n;
    for(int i = 2; i <= n / i; i++) {
        if(n % i)
            continue;
        int c = 0;
        while(n % i == 0)
            n /= i, c++;
        int k = 0;
        for(; k * (k + 1) / 2 <= c; k++)
            ;
        r += k - 1;
    }
    if(n > 1)
        r++;
    cout << r << endl;
    return 0;
}


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  if(a == b){
    cout << c << endl;
  }
  else if(b == c){
    cout << a << endl;
  }
  else{
    cout << b << endl;
  }
}

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

using namespace std;

int main()
{
    long long int n,i,m,sum=0;
    scanf("%lld%lld",&n,&m);
    long long int a[m];
    for(i=0;i<m;i++){
        scanf("%lld",&a[i]);
        sum=sum+a[i];
    }
    if(sum>n) printf("-1\n");
    else printf("%lld",n-sum);
}


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

const int INF = 1e9;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int res = INF;
  for (int i = -100; i <= 100; i++) {
    int sum = 0;
    rep(j,n) sum += (a[j] - i) * (a[j] - i);
    res = min(res,sum);
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 256
import Control.Monad
import Data.List

main=do
 n<-readLn
 d<-replicateM n readLn
 print(f (sort d::[Int]) 0)
  where f d i = if (length d)>1 then (f (tail d) (if d!!0/=d!!1 then i+1 else i)) else i+1

Measured memory_bytes: 1020
def main():
	import sys

	MAX = 1000000

	table = [True]*1000000
	table[0] = table[1] = False

	primes = []
	counted = 0

	for i in range(MAX):
		if table[i]:
			primes.append(i)
			for j in range(2*i, MAX, i):
				table[j] = False

	for line in sys.stdin:
		n = int(line)

		cnt = 0
		for prime in primes:
			if prime > n:
				break
			else:
				cnt += 1
		print(cnt)


if __name__ == '__main__':
	main()

Measured memory_bytes: 18104
//#pragma comment(linker, "/STACK:1024000000,1024000000")
/* vim: set fdm=marker */
//{{{
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < 0) return gcd(-a, b);
	if(b < 0) return gcd( a,-b);
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}

ll qpow(ll a, ll n, ll mod) {
	a %= mod;
	ll ans = 1LL;
	while(n) {
		if(n & 1) ans = (ans*a % mod);
		a = (a*a % mod);
		n >>= 1;
	}
	return ans;
}

inline ll rev(ll a, ll p) {
	return qpow(a, p - 2, p);
}

#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define rep(x, st, en) for(int x = st; x < en; x++)
#define rer(x, st, en) for(int x = st; x >= en; x--)
#define pb push_back
#define mp make_pair
#define dbgm(msg, var) cerr<<#msg<<" "<<#var<<" = "<<var<<endl; 
#define dbg(var) cerr<<#var<<" = "<<var<<endl;
#define X first
#define Y second
inline int in() { int x; cin>>x; return x; }
#ifdef ALNDBG
namespace alndbg {
	clock_t s, e;
}
#endif

inline void tic() {
#ifdef ALNDBG
	alndbg::s = clock();
#endif
}

inline void toc() {
#ifdef ALNDBG
	alndbg::e = clock();
	cerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<" ms"<<endl;
#endif
}

//}}}

// -------------------- Spliters ------------------------
const int maxn = 1010;
int dx[2] = { 0, 1};
int dy[2] = { 1, 0};
int H, W;
bool vis[maxn][maxn];
char m[maxn][maxn];
void go(int x, int y) {
	vis[x][y] = true;
	for(int i = 0; i < 2; i++) {
		int nx = x + dx[i], ny = y + dy[i];
		if(0 <= nx && nx < H && 0 <= ny && ny < W && m[nx][ny] == '#') {
			go(nx, ny);
			break;
		}
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin>>H>>W;
	rep(i, 0, H) cin>>m[i];
	if(m[0][0] != '#') { cout<<"Impossible"<<endl; return 0; }
	go(0, 0);
	if(!vis[H - 1][W - 1]) { cout<<"Impossible"<<endl; return 0; }
	bool ok = true;
	rep(i, 0, H) {rep(j, 0, W) if(m[i][j] == '#' &&!vis[i][j]) {
		ok = false;
		break;
	}
		if(!ok) break;
	}
	if(!ok) { cout<<"Impossible"<<endl; return 0;}
	cout<<"Possible"<<endl;
	return 0;
}
// --USE C++11
// *-USE O2


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  cin>>n>>m;
  vector<int> l(n);
  rep(i,n){
    l.at(i) = 0;
  }
  rep(j,m){
    int a,b;
    cin>>a>>b;
    l.at(a-1)++;
    l.at(b-1)++;
  }
  rep(k,n){
    cout<<l.at(k)<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
//Function
lli combi(lli n, lli r){
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main() {
	int n, r;
	cin >> n >> r;
	if(n>=10){
		cout << r << endl;
		return 0;
	}else{
		cout << r+100*(10-n) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

class Node implements Comparable<Node> {
  int index;
  int distance;
  
  Node(int index, int distance) {
    this.index = index;
    this.distance = distance;
  }
  
  public int compareTo(Node node) {
    return this.distance - node.distance;
  }
}

class Solver {
  int n;
  ArrayList<ArrayList<Integer>> edges;
  
  private Node dijkstra(int startIndex) {
    boolean[] visited = new boolean[n + 1];
    PriorityQueue<Node> queue = new PriorityQueue<>();
    Node lastNode = new Node(startIndex, 0);
    queue.add(lastNode);
    
    while (!queue.isEmpty()) {
      Node node = queue.poll();
      if (visited[node.index]) {
        continue;
      }
      visited[node.index] = true;
      lastNode = node;
      for (int nextIndex : edges.get(node.index)) {
        if (visited[nextIndex]) {
          continue;
        }
        queue.add(new Node(nextIndex, node.distance + 1));
      }
    }
    return lastNode;
  }
  
  public String solve(int n, ArrayList<ArrayList<Integer>> edges) {
    this.n = n;
    this.edges = edges;
    
    Node lastNode1 = dijkstra(1);
    Node lastNode2 = dijkstra(lastNode1.index);
    if ((lastNode2.distance + 1) % 3 != 2) {
      return "First";
    } else {
      return "Second";
    }
  }
}

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    ArrayList<ArrayList<Integer>> edges = new ArrayList<>();
    for (int i = 0; i <= n; i++) {
      edges.add(new ArrayList<>());
    }
    for (int i = 0; i < n-1; i++) {
      int a = reader.nextInt();
      int b = reader.nextInt();
      edges.get(a).add(b);
      edges.get(b).add(a);
    }
    System.out.println(new Solver().solve(n, edges));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}



Measured memory_bytes: 92864
#include <stdio.h>
int main()
{
    int a,s,b;
    scanf("%d %d",&a,&b);
    s=a+b;
    if(s%2==0)
         s/=2;
    else
    {
        s/=2;
        s+=1;
    }
    printf("%d",s);
}	

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

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

  vi h(n);
  rep(i,n) cin >> h.at(i);
  reverse(h.begin(), h.end());

  int cnt = 0;
  int ans = 0;
  rep(i,n-1){
    if (h.at(i) <= h.at(i+1)) cnt++;
    else cnt = 0;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out)
            throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        boolean[] cups = new boolean[3];
        cups[0] = true;
        while (true) {
            String line = reader.readLine();
            if (line == null || line.isEmpty()) {
                break;
            }
            int p = line.charAt(0) - 'A';
            int q = line.charAt(2) - 'A';
            boolean tmp = cups[p];
            cups[p] = cups[q];
            cups[q] = tmp;
        }
        for (int i = 0; i < cups.length; i++) {
            if (cups[i]) {
                out.println((char) (i + 'A'));
                break;
            }
        }
    }
}

Measured memory_bytes: 9056
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per0(i, st, ed) for (int i = (st); i > ed; --i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
#define chmin(a, b) (a = a > b ? b : a)
#define chmax(a, b) (a = a < b ? b : a)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}

const int maxn = 3e3 + 5;
int dp[maxn][maxn];

int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    string a, b;
    sf(a, b);
    int la = a.size(), lb = b.size();
    rep0(i, 0, la) {
        rep0(j, 0, lb) {
            if (a[i] == b[j]) {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
            }else {
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
    }
    int x = la - 1, y = lb - 1;
    int c = dp[la][lb];
    prln(c);
    string ans;
    while (x >= 0 && y >= 0) {
        if (a[x] == b[y]) {
            ans.push_back(a[x]);
            --x;
            --y;
        }else if (dp[x + 1][y + 1] == dp[x][y + 1]) --x;
        else --y;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 35456
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		List<Integer> a = new ArrayList<>();
		for (int i = 0; i < 9; i++) {
			a.add(sc.nextInt());
		}
		int N = sc.nextInt();
		int res = 0;
		for (int i = 0; i < N; i++) {
			int num = sc.nextInt();
			int index = a.indexOf(num);
			if (-1 < index) {
				res += Math.pow(2,index);
			}
		}
		int[] yesArr = {7, 56, 448, 73, 146, 292, 273, 84};
        boolean bingo = false;
        for (int yes : yesArr) {
            if ((res & yes) == yes) {
                bingo = true;
                break;
            }
        }
        System.out.println(bingo ? "Yes" : "No");
	}
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

template <typename T>
struct Kruskal {
    struct edge {
        int from, to, used;
        T cost;
        edge(int from_, int to_, T cost_) : from(from_), to(to_), cost(cost_), used(0) {}
        bool operator<(const edge &e) const { return cost < e.cost; }
    };

    vector<int> rank, parent;
    vector<edge> es;
    Kruskal(int n) : rank(n + 1, 0), parent(n + 1) {
        iota(parent.begin(), parent.end(), 0);
    }
    // union-find methods
    int root(int x) {
        if (x != parent[x]) {
            parent[x] = root(parent[x]);
        }
        return parent[x];
    }
    bool isSame(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y) { return link(root(x), root(y)); }
    bool link(int x, int y) {
        if (x == y)
            return false;
        if (rank[x] > rank[y]) {
            parent[y] = x;
        } else {
            parent[x] = y;
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
        return true;
    }
    // Kruskal methods
    void addEdge(int f, int t, T c) { es.emplace_back(f, t, c); }
    T build() {
        sort(es.begin(), es.end());
        T res = 0;
        for (auto &e : es) {
            if (!isSame(e.from, e.to)) {
                res += e.cost;
                unite(e.from, e.to);
                e.used = 1;
            }
        }
        return res;
    }
};

int main() {
    int n;
    cin >> n;
    vi x(n), y(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
    }
    Kruskal<ll> kr(n);
    vi orderx(n);
    vi ordery(n);
    iota(orderx.begin(), orderx.end(), 0);
    iota(ordery.begin(), ordery.end(), 0);
    auto compx = [&](int l, int r) { return x[l] < x[r]; };
    auto compy = [&](int l, int r) { return y[l] < y[r]; };
    sort(orderx.begin(), orderx.end(), compx);
    sort(ordery.begin(), ordery.end(), compy);
    for (int i = 1; i < n; ++i) {
        ll mincostx = min(abs(x[orderx[i]] - x[orderx[i - 1]]),
                          abs(y[orderx[i]] - y[orderx[i - 1]]));
        ll mincosty = min(abs(x[ordery[i]] - x[ordery[i - 1]]),
                          abs(y[ordery[i]] - y[ordery[i - 1]]));
        kr.addEdge(orderx[i], orderx[i - 1], mincostx);
        kr.addEdge(ordery[i], ordery[i - 1], mincosty);
    }
    ll ret = kr.build();
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 10608
#include<bits/stdc++.h>
#include <math.h>
#include <cmath>
#include <limits>
#include <iostream>
#include <assert.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	int x,y,cost;
};
int a[30001]={};
int t[10][10][10]={};
int t2[10]={},t3[10][10]={};
int main(){

	int n;
	cin>>n;
	rep(i,n){
		char c;
		cin>>c;
		if(c=='0')a[i]=0;
		if(c=='1')a[i]=1;
		if(c=='2')a[i]=2;
		if(c=='3')a[i]=3;
		if(c=='4')a[i]=4;
		if(c=='5')a[i]=5;
		if(c=='6')a[i]=6;
		if(c=='7')a[i]=7;
		if(c=='8')a[i]=8;
		if(c=='9')a[i]=9;
	}
	int total=0;
	rep(i,n-2){
		if(t2[a[i]]==1)continue;
		for(int j=i+1; j<n-1; j++){
			if(t3[a[i]][a[j]]==1)continue;
			for(int k=j+1; k<n; k++){
				if(t[a[i]][a[j]][a[k]]==1)continue;
				t[a[i]][a[j]][a[k]]=1;
				total++;
			}
			t3[a[i]][a[j]]=1;
		}
		t2[a[i]]=1;
	}
	cout<<total<<endl;
	return 0;

}



Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  cout << fixed << setprecision(15);
  double l; cin >> l;
  double ans=(l/3)*(l/3)*(l/3);
  cout << ans << endl;
  
}

Measured memory_bytes: 256