akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int x,y;
  scanf("%d %d",&x,&y);
    if((x==1 && y==3)||(x==3 && y==1)) printf("Yes\n");
    else if((x==1 && y==5)||(x==5 && y==1)) printf("Yes\n");
    else if((x==1 && y==7)||(x==7 && y==1))printf("Yes\n");
    else if((x==1 && y==8)||(x==8 && y==1))printf("Yes\n");
    else if((x==1 && y==10)||(x==10 && y==1))printf("Yes\n");
    else if((x==1 && y==12)||(x==12 && y==1))printf("Yes\n");
    else if((x==3 && y==5)||(x==5 && y==3))printf("Yes\n");
    else if((x==3 && y==7)||(x==7 && y==3))printf("Yes\n");
    else if((x==3 && y==8)||(x==8 && y==3))printf("Yes\n");
    else if((x==3 && y==10)||(x==10 && y==3))printf("Yes\n");
    else if((x==3 && y==12)||(x==12 && y==3))printf("Yes\n");
    else if((x==5 && y==7)||(x==7 && y==5))printf("Yes\n");
    else if((x==5 && y==8)||(x==8 && y==5))printf("Yes\n");
    else if((x==5 && y==10)||(x==10 && y==5))printf("Yes\n");
    else if((x==5 && y==12)||(x==12 && y==5))printf("Yes\n");
    else if((x==7 && y==10)||(x==10 && y==7))printf("Yes\n");
    else if((x==7 && y==12)||(x==12 && y==7))printf("Yes\n");
    else if((x==7 && y==8)||(x==8 && y==7))printf("Yes\n");
    else if((x==8 && y==10)||(x==10 && y==8))printf("Yes\n");
    else if((x==8 && y==12)||(x==12 && y==8))printf("Yes\n");
    else if((x==10 && y==12)||(x==12 && y==10))printf("Yes\n");
    else if(x==12 && y==12)printf("Yes\n");
    else if((x==4 && y==6)||(x==6 && y==4))printf("Yes\n");
    else if((x==4 && y==9)||(x==9 && y==4))printf("Yes\n");
    else if((x==4 && y==11)||(x==11 && y==4))printf("Yes\n");
    else if((x==6 && y==9)||(x==9 && y==6))printf("Yes\n");
    else if((x==6 && y==11)||(x==11 && y==6))printf("Yes\n");
    else if((x==9 && y==11)||(x==11 && y==9))printf("Yes\n");
    else if(x==11 && y==11)printf("Yes\n");
    else if(x==1 && y==1) printf("Yes\n");
    else if(x==3 && y==3)printf("Yes\n");
    else if(x==5 && y==5)printf("Yes\n");
    else if(x==7 && y==7)printf("Yes\n");
    else if(x==8 && y==8)printf("Yes\n");
    else if(x==10 && y==10)printf("Yes\n");
    else if(x==12 && y==12)printf("Yes\n");
    else if(x==4 && y==4)printf("Yes\n");
    else if(x==6 && y==6)printf("Yes\n");
    else if(x==9 && y==9)printf("Yes\n");
    else printf("No\n");
  return 0;
}


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

struct BipartiteMatching{
    int n,time;
    vector<vector<int>> G;
    vector<int> match,used,dead;
    BipartiteMatching(int n):n(n),time(0),G(n),
        match(n,-1),used(n,-1),dead(n,0){}
    void add_edge(int u,int v){
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    int dfs(int v){
        used[v]=time;
        for (int u:G[v]){
            if (dead[u]) continue;
            int w=match[u];
            if (w<0||(used[w]<time&&dfs(w))){
                match[v]=u;
                match[u]=v;
                return 1;
            }
        }
        return 0;
    }
    int build(){
        int res=0;
        for (int v=0;v<n;++v){
            if (dead[v]) continue;
            if (match[v]<0){
                ++time;
                res+=dfs(v);
            }
        }
        return res;
    }
    vector<int> matching(){return match;}
    int disable(int v){
        int u=match[v];
        if (u>=0) match[u]=-1;
        match[v]=-1; dead[v]=1;
        ++time;
        return u>=0?dfs(u)-1:0;
    }
    int enable(int v){
        dead[v]=0;
        ++time;
        return dfs(v);
    }
};

const int MAX_N=110;

int N,M;
int A[MAX_N][MAX_N],B[MAX_N][MAX_N];

void solve1(){
    vector<vector<bool>> used(N,vector<bool>(M,false));
    for (int j=0;j<M;++j){
        BipartiteMatching BM(2*N);
        for (int i=0;i<N;++i){
            for (int jj=0;jj<M;++jj){
                if (!used[i][jj]){
                    BM.add_edge((A[i][jj]-1)/M,N+i);
                }
            }
        }
        BM.build();
        vector<int> arrange=BM.matching();
        for (int i=0;i<N;++i){
            for (int jj=0;jj<M;++jj){
                if (used[i][jj]) continue;
                if ((A[i][jj]-1)/M==arrange[N+i]){
                    used[i][jj]=true;
                    B[i][j]=A[i][jj];
                    break;
                }
            }
        }
    }
    for (int i=0;i<N;++i)
        for (int j=0;j<M;++j)
            cout << B[i][j] << (j==M-1?'\n':' ');
}

void solve2(){
    for (int j=0;j<M;++j){
        vector<int> col(N);
        for (int i=0;i<N;++i) col[i]=B[i][j];
        sort(col.begin(),col.end());
        for (int i=0;i<N;++i) A[i][j]=col[i];
    }
    for (int i=0;i<N;++i)
        for (int j=0;j<M;++j)
            cout << A[i][j] << (j==M-1?'\n':' ');
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    for (int i=0;i<N;++i)
        for (int j=0;j<M;++j)
            cin >> A[i][j];
    solve1(); solve2();
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main() {
  ll n;cin >> n;
  vector<ll> a(n), b(n);
  for(int i = 0; i < n; ++i)cin >> a[i];
  int num = 0;
  for(int i = n-1; i >= 0; --i){
    if(num%2==0){
      b[num/2]=a[i];
    }
    else{
      b[n-1-num/2]= a[i];
    }
    ++num;
  }
  for(int i = 0; i < n; ++i){
    cout << b[i];
    if(i==n-1){
      cout << endl; 
    }
    else{
      cout << ' ';
    }
  }
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int N = 5e5 + 10;

int ans[N];
int to[N];

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

	int n, d;
	cin >> n >> d;
	vector<int> a(n);
	for (auto &t : a) {
		cin >> t;
	}
	to[n] = 1;
	for (int i = n - 1; i >= 0; i--) {
		if (a[i] >= 2 * to[i + 1]) {
			to[i] = to[i + 1];
		} else {
			to[i] = to[i + 1] + a[i];
		}
	}
	int c = d;
	for (int i = 0; i < n; i++) {
		if (to[i + 1] <= c) {
			ans[i] = 1;
		}
		c = min(c, abs(c - a[i]));
	}
	int q;
	cin >> q;
	while (q--) {
		int x;
		cin >> x;
		x--;
		if (ans[x]) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
}

Measured memory_bytes: 13696
#include<stdio.h>
long long N[2][800010],L[2][800010],T;
long long  hyouka(long long a,long long b){return a+b;}
long long MIN(long long a,long long b){return  a<b?a:b;}
void lsset(int n,int x){
  int i;
  for(T=1;T<n;T*=2);
  for(i=0;i<T;i++)N[x][T+i]=i<n?n-1:0;
  for(i=T-1;i;i--)N[x][i]=hyouka(N[x][i*2],N[x][i*2+1]);
}
void lasy(int i,int l,int r,int x){
  if(L[x][i]==0)return;
  N[x][i]=MIN(L[x][i],N[x][i]);
  if(r-l>1){
    L[x][i*2  ]=L[x][i];
    L[x][i*2+1]=L[x][i];
  }
  L[x][i]=0;
}
void lsadd(int a,int b,int c,int i,int l,int r,int x){
  lasy(i,l,r,x);
  if(r<=a||b<=l)return;
  if(a<=l&&r<=b){
    if(L[x][i]==0)L[x][i]=c;
    else L[x][i]=MIN(c,L[x][i]);
    lasy(i,l,r,x);
  }
  else{
    lsadd(a,b,c,i*2  ,l,(l+r)/2,x);
    lsadd(a,b,c,i*2+1,(l+r)/2,r,x);
    N[x][i]=hyouka(N[x][i*2],N[x][i*2+1]);
  }
}
long long lsget(int a,int b,int i,int l,int r,int x){
  lasy(i,l,r,x);
  if(b<=l||r<=a)return 0;
  if(a<=l&&r<=b)return N[x][i];
  return hyouka(lsget(a,b,i*2,l,(l+r)/2,x),lsget(a,b,i*2+1,(l+r)/2,r,x));
}
int main(){
  long long n,m,ans=0,a,b,i,near;
  long long min[2]={1e18,1e18};
  scanf("%lld %lld",&n,&m);
  lsset(n,0);
  lsset(n,1);
  ans=(n-2)*(n-2);//printf("%d\n",ans);
  //for(i=0;i<n;i++)printf("%lld ",N[1][T+i]);printf("\n");
  for(i=0;i<m;i++){
    //int j;
    //for(j=0;j<n;j++)printf("%lld ",lsget(j,j+1,1,0,T,0));printf("\n");
    //for(j=0;j<n;j++)printf("%lld ",lsget(j,j+1,1,0,T,1));printf("\n");
    scanf("%lld %lld",&a,&b);
    b--;
    if(b==0)continue;
    near=lsget(b,b+1,1,0,T,a-1);//printf("%lld\n",near);
    ans-=near-1;
    if(min[a-1]>b){
      lsadd(0,near,b,1,0,T,2-a);
      min[a-1]=b;
    }
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 15560
#include<bits/stdc++.h>
#define read(x) scanf("%d",&x)
#define ll long long
using namespace std;
const int maxn = 1e3 + 50;

ll n,m;
vector<int> res;  //最后答案 
int par[maxn];  //记录前驱

struct Edge{
    int to, next;
}e[maxn*3];
int head[maxn], tot;
void addedge(int u,int v){
    e[++tot].to = v; e[tot].next = head[u]; head[u] = tot;
}

int main()
{
    cin>>n>>m;
    for(int i=1,x,y;i<=m;i++){
        cin>>x>>y;
        addedge(x,y);
        //cout<<x<<" "<<y<<endl; 
    }
    //memset(head, -1, sizeof(head));
    for(int i=1;i<=n;i++){
        queue<int> q;
        memset(par, -1, sizeof par);
        for(int j=head[i];j;j=e[j].next){
            par[e[j].to] = i;
            q.push(e[j].to);
            //cout<<i<<" e[j].to: "<<e[j].to<<endl;
        }
        while(q.size()){
            int u = q.front(); q.pop();
            //cout<<"u "<<u<<endl;
            for(int j=head[u];j;j=e[j].next){
                if(e[j].to == i){  //如果回到原点
                    vector<int> tmp;
                    while(u!=i){
                        tmp.push_back(u);
                        u = par[u];
                    }
                    tmp.push_back(i);
                    if(res.size()==0 || res.size()> tmp.size()) res = tmp;
                    break;
                }else if(par[e[j].to] == -1){
                    par[e[j].to] = u;
                    q.push(e[j].to);
                }
            }
        }
    }
    if(res.size() == 0){
        cout<<-1<<endl;
    }else{
        cout<<res.size()<<endl;
        for(int i=0;i<res.size();i++){
            cout<<res[i]<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,W,a[109],w[109];
long long dp[109][100009];
int main()
{
    cin>>n>>W;
    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;
    for(int i=1;i<=n;i++)cin>>w[i]>>a[i];
    for(int i=1;i<=n;i++)
    {
        //cout<<a[i]<<"\n";
        for(int j=0;j<=100000;j++)
        {
            if(dp[i-1][j]!=-1)
                {
                    if(dp[i-1][j+a[i]]!=-1)dp[i][j+a[i]]=min(dp[i-1][j+a[i]],dp[i-1][j]+w[i]);
                    else dp[i][j+a[i]]=dp[i-1][j]+w[i];
                    //cout<<dp[i][j+w[i]]<<" ";
                }
            if(dp[i][j]!=-1&&dp[i-1][j]!=-1)dp[i][j]=min(dp[i][j],dp[i-1][j]);
            else dp[i][j]=max(dp[i][j],dp[i-1][j]);
        }
    }
    long long ans=0;
    for(int i=100000;i>=0;i--)
    {
        if(dp[n][i]<=W&&dp[n][i]!=-1)
        {
            ans=i;
            break;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 85376
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N;
int A[200001];
int E[400001], ne[400001], he[200001];
//vector<int> V;
int V[200001], v;
void dfs(int p, int mae) {
	if (V[v - 1] < A[p]) {
		V[v++] = A[p];
		for (auto to = he[p]; to; to = ne[to]) {
			if (E[to] != mae) {
				dfs(E[to], p);
			}
		}
		he[p] = v--;
	}
	else {
		int itr = lower_bound(V, V + v, A[p]) - V;
		swap(V[itr], A[p]);
		for (auto to = he[p]; to; to = ne[to]) {
			if (E[to] != mae) {
				dfs(E[to], p);
			}
		}
		he[p] = v;
		V[itr] = A[p];
	}
}

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
inline int getintA() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}
char dn[1300000], *di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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

	N = getint();
	rep1(i, N) A[i] = getintA();
	int k = 1;
	rep(i, N - 1) {
		int u = getint(), v = getint();
		E[k] = v;
		ne[k] = he[u];
		he[u] = k++;
		E[k] = u;
		ne[k] = he[v];
		he[v] = k++;
	}

	V[v++] = 2000000000;
	dfs(1, -1);

	rep1(i, N) putint(he[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 21460
#include<iostream>
//#include<algorithm>
//#include<string>
using namespace std;

int main()
{
  int i,j,N,ans;
  cin>>N;
  int P[N];
  ans=0;
  int Min=10000000;
  for(i=0;i<N;i++) cin>>P[i];
  
  for(i=0;i<N;i++)
  {
    Min=min(Min,P[i]);
    if(P[i]==Min) ans++;
  }
    
   
  cout<<ans;
}

Measured memory_bytes: 1024
// Abx082 C
object Main extends App {
  val sc = new java.util.Scanner(System.in)

  val n = scala.io.StdIn.readLine.toInt
  val list = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val map = list.groupBy(identity).mapValues(_.length).toMap
  var delete_count = 0
  var checked = Map[Int, Boolean]()

  list.foreach({e =>
    if (checked.isDefinedAt(e)) {
    } else {
      if (map(e) > e) {
        delete_count += map(e) - e
      }

      if (map(e) < e) {
        delete_count += map(e)
      }

      checked += (e -> true)
    }
  })
  println(delete_count)
}


Measured memory_bytes: 116188
a = []
for _ in range(3):
    a.append([int(x) for x in input().split()])
n = int(input())
b = []
for _ in range(n):
    b.append(int(input()))
for i, aa in enumerate(a):
    for j, aaa in enumerate(aa):
        if aaa in b:
            a[i][j] = 0
if a[0][0] == 0 and a[0][1] == 0 and a[0][2] == 0 or\
   a[1][0] == 0 and a[1][1] == 0 and a[1][2] == 0 or\
   a[2][0] == 0 and a[2][1] == 0 and a[2][2] == 0 or\
   a[0][0] == 0 and a[1][0] == 0 and a[2][0] == 0 or\
   a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0 or\
   a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0 or\
   a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0 or\
   a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int d, a;
	int i, j;
	int cnt[102];
	for (i = 0; i < n; i++)
		cnt[i] = 0;
	for (i = 0; i < k; i++)
	{
		scanf("%d", &d);
		for (j = 0; j < d; j++)
		{
			scanf("%d", &a);
			cnt[a - 1]++;
		}
	}
	int ans = 0;
	for (i = 0; i < n; i++)
		if (cnt[i] == 0)
			ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define x first
#define y second
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define xmod (ll)(1e9+7)
using namespace std;

ll len,dp_l[10005][105],d,dp_s[10005][105],sum,num;
string s;
int main(){
	ios::sync_with_stdio(false);
	cin >> s >> d; len=s.length();
	for (int i=0;i<s[0]-'0';i++){
		dp_l[0][i%d]++;
	} 
	dp_s[0][(s[0]-'0')%d]++; 
	for (int i=1;i<len;i++){
		for (int j=0;j<d;j++){
			for (int k=0;k<=9;k++){
				dp_l[i][(k+j)%d]+=dp_l[i-1][j];
				dp_l[i][(k+j)%d]%=xmod;
			}
			for (int k=0;k<s[i]-'0';k++){
				dp_l[i][(k+j)%d]+=dp_s[i-1][j];
				dp_l[i][(k+j)%d]%=xmod;
			}
			dp_s[i][(s[i]-'0'+j)%d]=dp_s[i-1][j];
		}
	}
	num=dp_l[len-1][0]+dp_s[len-1][0]-1;
	if (num < 0)
	num+=xmod;
	cout << num%xmod << "\n";
    return 0;
}

Measured memory_bytes: 16640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>

#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)        cout<<a<<endl;
#else
#define tr(a)    
#endif

#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)    for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int N;
    cin>>N;
    int x=0;
    rep(i,0,N){
        int temp;
        cin>>temp;
        x^=(temp%2);
    }   
    if(x)cout<<"NO\n";
    else cout<<"YES\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0351

#include<bits/stdc++.h>
const int N = 1505;
const int inf = 1e9;
using namespace std;

typedef pair <int, int> ii;
vector <ii> adj[N];
int n, m, d[N][N], ans, visit[N], f[N], ck[N];

void dijkstra(int S){
    for (int i = 1; i <= n; i++) d[S][i] = inf; d[S][S] = 0;
    priority_queue <ii, vector <ii>, greater<ii> > mq; mq.push(ii(d[S][S], S));
    while (mq.size()){
        ii z = mq.top(); mq.pop();
        int u = z.second, val = z.first;
        if (val != d[S][u]) continue;
        ans = max(ans, val);
        for (int i = 0; i < adj[u].size(); i++){
            int v = adj[u][i].first, cost = adj[u][i].second;
            if (d[S][v] > d[S][u] + cost){
                d[S][v] = d[S][u] + cost;
                mq.push(ii(d[S][v], v));
            }
        }
    }
}

void dfs(int u, int root){
    if (visit[u]) return;
    visit[u] = true;
    f[u] = d[root][u];
    for (int i = 0; i < adj[u].size(); i++){
        int v = adj[u][i].first, cost = adj[u][i].second;
        if (d[root][v] == d[root][u] + cost){
            dfs(v, root); f[u] = max(f[u], f[v]);
        }
    }
    if (f[u] == ans) ck[u] = 1;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int u, v, d; cin >> u >> v >> d;
        adj[u].push_back(ii(v, d));
        adj[v].push_back(ii(u, d));
    }
    for (int i = 1; i <= n; i++) dijkstra(i);
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++) visit[j] = 0;
        dfs(i, i);
    }
    int cnt = 0; for (int i = 1; i <= n; i++) if (!ck[i]) cnt++;
    cout << cnt << "\n";
    for (int i = 1; i <= n; i++) if (!ck[i]) cout << i << "\n";
}



Measured memory_bytes: 12144
#include <stdio.h>

int main(void)
{
        int n;
        scanf("%d",&n);
        if(n>=64)printf("64\n");
        else if(n>=32)printf("32\n");
        else if(n>=16)printf("16\n");
        else if(n>=8)printf("8\n");
        else if(n>=4)printf("4\n");
        else if(n>=2)printf("2\n");
        else printf("1\n");
        return 0;
}


Measured memory_bytes: 1656
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

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

    if ( N == 1 ) {
        cout << "Yes" << endl;
        cout << 2 << endl;
        cout << 1 << " " << 1 << endl;
        cout << 1 << " " << 1 << endl;
        return 0;
    }

    long long z;
    for ( long long i = 3; i < 1000; i++ ) {
        long  long a = i*(i-1)/2;
        if ( a > N ) { cout << "No" << endl; return 0; }
        if ( a == N ) { z = i; cout << "Yes" << endl; break; }
    }
    cout << z << endl;

    vector< vector<int> > A(z);
    long long x = 1;
    for ( long long a = 0; a < z; a++ ) {
    for ( long long b = a+1; b < z; b++ ) {
        A[a].push_back(x);
        A[b].push_back(x);
        x++;
    }
    }

    for ( int i = 0; i < z; i++ ) {
        cout << A[i].size() << " ";
        for ( int j = 0; j < A[i].size(); j++ ) {
            cout << A[i][j];
            if ( j != A[i].size()-1 ) { cout << " "; }
        }
        cout << endl;
    }



    return 0;
}

Measured memory_bytes: 2304
#include<stdio.h>
#define N 2000002

int n,A[N],B[N],C[N];

void count_sort(int A[],int k){
  long i;
  
  for(i=0;i<k;i++) C[i] = 0;
  for(i=1;i<=n;i++) C[A[i]]++;
  for(i=1;i<k;i++) C[i] = C[i] + C[i-1];
  for(i=n;i>=1;i--){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
  for(i=1;i<n;i++) printf("%d ",B[i]);
  printf("%d\n",B[n]);
}

int main(){
  int i,k=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++) {
    scanf("%d",&A[i]);
    if(k<A[i]) k = A[i];
  }
  k = k+1;
  count_sort(A,k);
  return 0;
}

Measured memory_bytes: 17892
N = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(N - 1):
    if P[i] == i + 1:
        tmp = P[i]
        P[i] = P[i + 1]
        P[i + 1] = tmp
        count += 1

if P[-1] == N:
    count += 1

print (count)

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

using namespace std;

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64; // 9e18
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

//const double PI = 3.141592653589793238463;
//const int MAXN = 1000500;
//const int MAXVALUE = 1000000500;
//const long double EPS = 1e-7;
const i64 INF = 1e18;
//i64 mod = 1e9 + 7;


i64 T, n, m, k;
//vector <vector<i64>> a;
//vector <i64> a;
//vector <i64> b;
//vector <i64> dp;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(16);


    //cin >> T;
    T = 1;

    for (i64 tt = 0; tt < T; ++tt) {

        i64 d, t, s;
        cin >> d >> t >> s;

        float x = float(d) / float(t);
        if (s >= x) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }

    }
    return 0;
}

Measured memory_bytes: 3100
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: chars,
        b: chars
    }
    for i in 0..n {
        print!("{}{}", a[i], b[i]);
    }
    println!("");
}


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

struct node {
	int parent;
	int depth;
	vector<int> children;
	string type;
	node(){
		parent = -1;
		depth = 0;
	}
};

node nodes[100001];

int deep(int i){
	if(nodes[i].parent == -1){
		return 0;
	}
	return deep(nodes[i].parent) + 1;	
}

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int id,k;
		cin>>id;
		cin>>k;
		for(int j=0;j<k;j++){
			//????????\??????????????\???
			int num;
			cin>>num;
			nodes[num].parent=id;
			nodes[id].children.push_back(num);
		}
	}
	
	for(int i=0;i<n;i++){
		nodes[i].depth = deep(i);
	}
	
	for(int i=0;i<n;i++){
		cout<<"node "<<i<<": ";
		cout<<"parent = "<<nodes[i].parent;
		cout<<", depth = "<<nodes[i].depth;
		
		string type;
		if(nodes[i].children.empty() && nodes[i].parent != -1){
			type ="leaf";
		}else if(nodes[i].parent == -1){
			type = "root";
		}else{
			type = "internal node";
		}
		cout<<", "<<type;
		
		cout<<", [";
		for(int k=0;k<nodes[i].children.size();k++){
			if(k>0){cout<<", ";}
			cout<<nodes[i].children[k];
		}
		cout<<"]"<<endl;
	}
	return 0;
}

Measured memory_bytes: 5900
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int LCM(int a, int b) { int g = gcd(a, b); return a / g * b; }
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    VI r(5); 
    int time = 0, mini = 10;
    rep(i,5){
        cin >> r[i];
        r[i] += 9;
        time += r[i]/10*10;
        mini = min(mini,r[i]%10);
    }
    cout << time + mini - 9 << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

cnt = [0] * (n)
for i in range(0, n - 1):
    if s[i:i+2] == 'AC':
        cnt[i + 1] = cnt[i] + 1
    else:
        cnt[i + 1] = cnt[i]

for i in range(q):
    ll = lr[i][0] - 1
    rr = lr[i][1] - 1
    print(cnt[rr] - cnt[ll])


Measured memory_bytes: 90396
function Main(input){
  input_text = input.split('\n');
  H = input_text[1].split(' ').map(n=>parseInt(n));
  S = 0;
  max = 0;
  H.forEach(n => {
    if (n >= max) {
      S++;
      max = n;
    }
  });
  console.log(S);
}

Main(require("fs").readFileSync("/dev/stdin","utf-8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    vector<int> a(n);
    for (int &x : a) {
        cin >> x;
    }
    ll sum = 2 * a[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        sum = 2ll * a[i] - sum;
    }
    vector<int> ans(n);
    ans[0] = sum / 2;
//    ans[n - 1] = 2 * a[n - 1] - ans[0];
    for (int i = 0; i < n - 1; i++) {
        ans[i + 1] = 2 * a[i] - ans[i];
    }
    for (int i = 0; i < n; i++) {
        cout << ans[i] << " \n"[i == n - 1];
    }
}


Measured memory_bytes: 2176
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	string s;

	cin >> s;

	for (int i = 0; i < s.size(); ++i) {
		if (s.at(i) != ',') cout << s.at(i);
		else cout << " ";
	}
	cout << endl;
	
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] s = sc.next().toCharArray();
		
        for (int i = 0; i < s.length; i++) {
            int x = s[i] + N;
            if('Z' < x) x -= 26;
            s[i] = (char)(x);
        }
        System.out.println(String.valueOf(s));
        //sc.close();		
	}
}


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

int main(){
    int x,n;
    cin >> x >> n;
    vector<int> flg(N,0);
    rep(i, n){
        int p;
        cin >> p;
        flg.at(p) = 1;
    }

    rep(i, max(N-x, x)){
        // cout << i << n-i << ' ' << flg.at(n-i) << ' ' << n+i << ' ' << flg.at(n+i) << endl;
        if(x-i>0){
            if(flg.at(x-i)==0){
                cout << x-i << endl;
                return 0;
            }
        }
        else if(x-i<=0){
            cout << x-i << endl;
            return 0;
        }

        if(x+i<N){
            if(flg.at(x+i)==0){
                cout << x+i << endl;
                return 0;
            }
        }
        else if(x+i>=N){
            cout << x+i << endl;
            return 0;
        }
    }
    return 0;

}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }
  cout << abs(alice - bob) << endl;
  return 0;
}


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

struct UnionFind {
  vector<int> par;
  UnionFind(int N): par(N) { rep(i, 0, N) par[i] = i; }
  int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); }
  void unite(int x, int y) { int rx = root(x); int ry = root(y); if (rx == ry) return; par[rx] = ry; }
  bool same(int x, int y) { return root(x) == root(y); }
};

int main() {
  // input
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);

  int p[n];
  rep(i, 0, n) cin >> p[i];

  // calculation
  int x, y;
  rep(i, 0, m) {
    cin >> x >> y;

    // ごにょごにょして
    uf.unite(x-1, y-1);
  }

  // p[i] == i の数を数える
  int res = 0;
  rep(i, 0, n) {
    if (uf.same(p[i]-1, i)) res++;
  }
  cout << res << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        System.out.println(a * b / gcd(a, b));

    }

    static long gcd (long a, long b) {
        if (b > a) return gcd(b, a);
        if (b == 0) return a;
        return gcd(b, a % b);
    }

}


Measured memory_bytes: 21844
A,B = list(map(int,input().split()))

for i in range(min(int(A / 0.08),int(B / 0.10) ),max(int((A+1)/0.08),int((B+1)/0.08))):
  # print(i)
  if int(i*0.08) == A and int(i*0.10) == B:
    print(i)
    break
else:
  print(-1)

Measured memory_bytes: 38256
#include <stdio.h>
int main(void)
{
  int n, m, i, tmp, c[51]={0};
  scanf("%d %d", &n, &m);

  for(i = 0; i < m; i++){
    scanf("%d", &tmp);
    c[tmp]++;
    scanf("%d", &tmp);
    c[tmp]++;
  }

  for(i = 1; i <= n; i++)
    printf("%d\n", c[i]);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

set<string> adj = {"AB","AD","BA","BC","BE","CB","CF","DA","DE","DG","EB","ED","EF","EH","FC","FE","FI","GD","GH","HE","HG","HI","IF","IH"};

int main() {
    string s;
    for (int i=0; i<1000; ++i) {
        cin >> s;
        bool ok = true;
        for (int i=1; i<(int)s.size(); ++i) {
            if ( ! adj.count(s.substr(i-1, 2))) {
                ok = false;
                break;
            }
        }
        if (ok) cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int n;
    string s;
    cin >> n >> s;
    int res = 0;
    int temp = 0;
    REP(i,n){
        if(s[i]=='I')temp++;
        else temp--;
        chmax(res, temp);
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc098b()
}

fun abc098b() {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    val answer = (1 until s.length).map {
        s.substring(0 until it).toList().intersect(s.substring(it until s.length).toList()).size
    }.max()

    println(answer)
}


Measured memory_bytes: 33948
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

int D;
vector<int> c(26);
vector<vector<int>> s;

int scoring(const vector<int>& t) {
    int v = 0;
    vector<int> last(26, -1);
    rep(i, D) {
        v += s[i][t[i]];
        last[t[i]] = i;
        rep(j, 26) {
            v -= c[j] * (i - last[j]);
        }
    }
    return v;
}

int diff_scoring(const vector<int>&t, int v, int to_d, int to_t) {
    vector<int> last(2, -1);
    rep(i, D) {
        if (t[i] == t[to_d]) v -= s[i][t[i]], last[0] = i;
        if (t[i] == to_t) v -= s[i][t[i]], last[1] = i;
        v += c[t[to_d]] * (i - last[0]);
        v += c[to_t] * (i - last[1]);
    }
    last.assign(2, -1);
    rep(i, D) {
        if (t[i] == t[to_d]) v += s[i][t[i]], last[0] = i;
        else if (i == to_d || t[i] == to_t) v += s[i][to_t], last[1] = i;
        v -= c[t[to_d]] * (i - last[0]);
        v -= c[to_t] * (i - last[1]);
    }
    return v;
}

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

    auto start = chrono::system_clock::now();
    
    cin >> D;
    rep(i, 26) cin >> c[i];
    s.resize(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];

    vector<int> t(D);

    rep(i, D) {
        t[i] = max_element(all(s[i])) - s[i].begin();
    }
    
    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> rand_d(0, D-1);
    uniform_int_distribution<> rand_t(0, 25);
    
    int v = scoring(t);
    
    while (true) {
        int to_d = rand_d(mt);
        int to_t = rand_t(mt);
        if (t[to_d] == to_t) continue;
        int nv = diff_scoring(t, v, to_d, to_t);
        if (v < nv) t[to_d] = to_t;
        auto end = chrono::system_clock::now();
        auto dur = end - start;
        auto msec = chrono::duration_cast<chrono::milliseconds>(dur).count();
        if (msec >= 1985) break;
    }
    
    rep(i, D) cout << t[i] + 1 << '\n';
}


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

#define ln                 endl
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 1e6;
int n, f2 = 2, a[nsz + 5];
string s;

int inline C(int n, int m) {
	return (n & m) == m;
}

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> s;
	loop (i, s.size()) {
		a[i + 1] = s[i] - '0';
	}
	int res = 0;
	cont (i, n) {
		a[i] == 2 && (f2 = 1);
	}
	if (f2 == 1) {
		cont (i, n) {
			if (a[i] & 1) {
				res ^= C(n - 1, i - 1);
			}
		}
	} else {
		cont (i, n) {
			a[i] = a[i] == 3 ? 1 : 0;
		}
		cont (i, n) {
			if (a[i] & 1) {
				res ^= C(n - 1, i - 1);
			}
		}
	}
	cout << f2 * res << ln;
}

Measured memory_bytes: 5276
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e18+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}




int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin>>a>>b;
    if(a>=10){
        cout<<b<<endl;
    }
    else {
        cout<<b+100*(10-a)<<endl;
    }
    return 0;
    }


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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int m,n,cnt=1,aa[220000];
pair<int,int> pp[220000];
string s,ss[220000];
char c;
queue<int> que;
signed main(){
    cin>>n>>m;
    cout<<n*m;
}

Measured memory_bytes: 10480
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
typedef long long ll;

int main(int argc, char const *argv[]) { 
    string N; cin >> N;
    int res = 0;
    REP(i, N.size()) {
        res += N[i] - '0';
    }
    if (res == 1) cout << 10 << '\n';
    else cout << res << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		int result = 0;
		for(int i = 0; i < s.length(); i=i+2){
		    boolean flg = true;
		    for(int j = 0; j < (s.length()-i-2)/2; j++){
		        if(s.charAt(j) != s.charAt((s.length()-i-2)/2 + j)) flg = false;
		    }
		    if(flg){
		        result = s.length()-i-2;
		        break;
		    }
		}
		
		// 出力
		System.out.println(result);
	}

}

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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b)-1; i >= (a); i--)
#define ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;



int main()
{
	//freopen("in.txt", "w", stdout);
	//ios::sync_with_stdio(false); cin.tie(0);

	double n, d, x;
	cin>>n>>d>>x;

	double res = 0;
	double val = d * 2 + (2 * n - 1) * (double) x;
	val /= 2;

	while(n)
	{
		res += val;
		val += val / n;
		n--;
	}

	printf("%.11f\n", res);


}




Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>




using namespace std;

int main()
{
     int a,b;
     cin >> a >> b;
     if (a == 1)a = 14;
     if (b == 1)b = 14;
     if(a > b) { 
        cout << "Alice" << endl;
     } else if(b > a) { 
        cout << "Bob" << endl;
     } else { 
        cout << "Draw" << endl;
     } 
     system ("pause");
      return 0;
}

Measured memory_bytes: 504
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = LI()
    s = sum(a)
    t = 1
    m = 2**(s//2+1) - 1
    for c in a:
        t |= t << c
    t &= m

    return s - (t.bit_length() - 1)


print(main())




Measured memory_bytes: 8164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
 int main() {
 	ll n,a,b;
 	cin >>n>>a>>b;
 	if ((n*a)>b){
 		cout << b;
 	}
 	else {
 		cout <<a*n;
 	}
 }

Measured memory_bytes: 384
using System;

class Program
{
    static void Main()
    {
        int S = int.Parse(Console.ReadLine());
        int h = S / 3600;
        int m = (S - (h * 3600)) / 60;
        int s = S - (h * 3600 + m * 60);

        if(S >= 0 && S <= 86400)
            Console.WriteLine("{0}:{1}:{2}", h, m, s);
    }
}

Measured memory_bytes: 9080
n = int(input())
A = list(map(int,input().split()))

dic = [False]*8

cnt = 0

for i in range(n):
  tmp = A[i] // 400
  if(tmp >= 8):
    cnt += 1
  else:
    dic[tmp] = True
if(sum(dic) == 0 and cnt > 0):
  print('1 ' + str(cnt))
else:
  print(str(sum(dic)) + ' ' + str(sum(dic) + cnt))


Measured memory_bytes: 3060
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args){
 
        Scanner scan = new Scanner(System.in);
 
        int n = scan.nextInt();
        SSSPath sp = new SSSPath(n);
 
        for (int i = 0; i < n; i++) {
            int u = scan.nextInt();
            int k = scan.nextInt();
            for (int j = 0; j < k; j++)
                sp.addPath(u, scan.nextInt(), scan.nextInt());
        }
        sp.setPath(0);
 
        for (int i = 0; i < n; i++)
            System.out.println(i + " " + sp.getResult(i));
 
        scan.close();
        System.exit(0);
    }
}
 
class SSSPath {
    int[][] cost;
    int[] reach;
 
    public SSSPath(int n) {
        reach = new int[n];
        for (int i = 0; i < n; i++)
            reach[i] = -1;
 
        cost = new int[n][n];
        for (int x = 0; x < n; x++)
            for (int y = 0; y < n; y++)
                cost[x][y] = -1;
    }
 
    public int getResult(int i) {
        return reach[i];
    }
 
    public void setPath(int from) {
        reach[from] = 0;
        setP(from);
    }
 
    private void setP(int from) {
        for (int to = 0; to < cost[from].length; to++)
            if (cost[from][to] > 0) {
                int d = reach[from] + cost[from][to];
                if (reach[to] == -1 || reach[to] > d) {
                    reach[to] = d;
                    setP(to);
                }
            }
    }
 
    public void addPath(int from, int to, int c) {
        cost[from][to] = c;
    }
 
}

Measured memory_bytes: 38568
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)


int main(){

    fast;
    ll n,d,i,j;
    cin>>n>>d;
    int cnt=0;
    d=d*d;
    for(i=0;i<n;i++)
    {
    	ll x,y;
    	cin>>x>>y;
    	if(x*x+y*y<=d)
    	{
    		cnt++;
		}
	}
	cout<<cnt;
    

}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    cout << (e-a<=k ? "Yay!" : ":(") << endl;
    return 0;
}

Measured memory_bytes: 256