akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
    int W,H,N;
    cin>>W>>H>>N;
    int x,y;
    cin>>x>>y;
    int ans = 0;
    rep(i, N-1){
        //cout <<x<<" "<<y<<endl;
        int nx,ny;
        cin>>nx>>ny;
        if((x<nx&&y>ny)||(x>nx&&y<ny)){
            ans +=abs(nx-x)+abs(ny-y);
        }else{
            int tmp;
            tmp =max(abs(nx-x),abs(ny-y));
            ans +=tmp;
        }
        x =nx;
        y =ny;
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
int main(void)
{
    int n,i;
    char s[101],t[101];
    scanf("%d",&n);
    for(i=0;i<=n;i++)
        scanf("%c",&s[i]);
    s[i]='\0';
    for(i=0;i<=n;i++)
        scanf("%c",&t[i]);
    t[i]='\0';
    i=0;
    while(s[i]!='\0'){
            printf("%c%c", s[i], t[i]);
            i++;

    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 300005
#define MOD 998244353
#define oo 1000000000000000007LL
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int power(int x, int n) {
    if (n == 0) return 1;
    if (n&1) return (1LL*x*power(x, n-1))%MOD;
    int p = power(x, n/2);
    return (1LL*p*p)%MOD;
}

int n, a, b, cnt[maxN], fact[maxN], invFact[maxN];
ll k;

int C(int n, int k) {
    return ((1LL*fact[n]*invFact[k])%MOD * 1LL*invFact[n-k])%MOD;
}

int main () {
    cin >> n >> a >> b >> k;

    fact[0] = invFact[0] = 1;
    fto(i, 1, n) {
        fact[i] = (1LL*fact[i-1]*i)%MOD;
        invFact[i] = power(fact[i], MOD-2);
    }

    int ans = 0;
    fto(cntA, 0, n) {
        ll cntB = k-1LL*cntA*a;
        if (cntB < 0 || cntB%b != 0) continue;
        cntB /= b;
        if (cntB <= n) {
//            printf("%d %d\n", cntA, cntB);
            ans = (ans + 1LL*C(n, cntA)*C(n, cntB))%MOD;
        }
    }

    cout << ans;


    return 0;
}


Measured memory_bytes: 2560
import itertools
inf=float("inf")
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n):
    a[i]+=a[i-1]
a.append(0)
dp=[[0]*n for i in range(n)]
for l in range(1,n):
    for right in range(l,n):
        left=right-l
        num=inf
        for mid in range(left,right):
            num=min(num,dp[left][mid]+dp[mid+1][right])
        dp[left][right]=num+a[right]-a[left-1]
print(dp[0][n-1])

Measured memory_bytes: 45188
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define SIZE 500005
#define ALP 27
#define BT 22

using namespace std;

int to[SIZE][BT];
int dp[SIZE][ALP];
int nxt[SIZE][ALP];
char str[SIZE];

int main()
{
	int n;
	scanf("%s",&str);
	n=strlen(str);
	memset(dp,-1,sizeof(dp));
	memset(nxt,-1,sizeof(nxt));
	for(int i=n-1;i>=0;i--)
	{
		int c=str[i]-'a';
		dp[i][c]=i;
		for(int j=c+1;j<ALP;j++)
		{
			if(dp[i][j-1]==n-1||dp[i][j-1]==-1) break;
			int to=dp[i][j-1]+1;
			if(nxt[to][j-1]==-1) break;
			to=nxt[to][j-1];
			if(dp[to][j-1]!=-1) dp[i][j]=dp[to][j-1];
		}
		to[i][0]=dp[i][ALP-1]+(dp[i][ALP-1]==-1?0:1);
		for(int j=c;j<ALP;j++) nxt[i][j]=i;
		if(to[i][0]!=-1&&to[i][0]!=n)
		{
			for(int j=0;j<c;j++) nxt[i][j]=nxt[to[i][0]][j];
		}
		//printf("%d\n",to[i][0]);
		/*
		if(i>=6)
		{
			printf("%d %d %d\n",dp[i][ALP-3],dp[i][ALP-2],dp[i][ALP-1]);
			printf("* %d %d %d\n",nxt[i][ALP-3],nxt[i][ALP-2],nxt[i][ALP-1]);
		}*/
		//puts("");
	}
	//for(int i=0;i<n;i++) printf("%d ",to[i][0]);
	for(int i=0;i+1<BT;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(to[j][i]==-1||to[j][i]==n) to[j][i+1]=-1;
			else to[j][i+1]=to[to[j][i]][i];
		}
	}
	int Q;
	scanf("%d",&Q);
	for(int i=0;i<Q;i++)
	{
		int l,r;
		scanf("%d %d",&l,&r);l--,r--;
		int now=l;
		for(int j=BT-1;j>=0;j--)
		{
			if(to[now][j]==-1||to[now][j]>r+1) continue;
			now=to[now][j];
			if(now==n) break;
		}
		//for(int j=0;j<BT;j++) printf("%d ",to[0][j]);puts("");
		//printf("%d\n",now);
		if(now==r+1) puts("Yes");
		else puts("No");
	}
	return 0;
}


Measured memory_bytes: 149504
/***
	chauhan176's code

	DO WHATEVER IT TAKES!!!
	Nothing happens , nothing happens and then everything happens.
	But the thing is nothing happens in air:)-
***/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long int
#define fi first
#define se second
#define mod 1000000007
#define maxn 200005
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define stringio cin.ignore(256, '\n')  //to take string input after taking integer inputs
#define go_t int t;cin>>t;while(t--)
#define go_pt int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef pair<int,int>pii;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
string s[maxn];
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    //freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output.txt", "w", stdout);
    #endif

    fastio;
    int n;
    cin>>n;
    map<string,ll>mpp;
    map<string,ll>::iterator it;
    for(int i=1;i<=n;i++)
    {
        cin>>s[i];
        sort(all(s[i]));
        mpp[s[i]]++;
    }
    ll ans=0;
    for(it=mpp.begin();it!=mpp.end();it++)
    {
        //cout<<it->fi<<" "<<it->se<<endl;
        ll val = it->se;
        ans+=(val*(val-1))/2;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 17408
n = gets.to_i

graph = []
lines = []

1.upto(n - 1).inject([]) do
  a, b = gets.split.map(&:to_i)
  graph[a - 1] ||= []
  graph[b - 1] ||= []
  graph[a - 1] << b - 1
  graph[b - 1] << a - 1
  lines << [a - 1, b - 1]
end

k = 0
queue = [0]
line_colors = {}
used = [true]
colors = []

while node = queue.shift do
  if k < graph[node].size
    k = graph[node].size
  end
  
  color = 1
  graph[node].each do |child|
    next if used[child]
    if colors[node] == color
      color += 1
    end

    colors[child] = color
    line_colors[[node, child]] = color

    queue << child
    used[child] = true
    color += 1
  end
end

puts k

lines.each do |l|
  puts line_colors[l]
end


Measured memory_bytes: 34276
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define endl "\n"
#define pi 3.14159265358979323846264338327950288
#define MOD 1000000007
#define INF -100000000000000
#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lld long double
using namespace __gnu_pbds;
int main()
{
    fast;
    string s;
    cin>>s;ll int i,c=0;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='R')
            c++;
    }
    if(c==3)
        cout<<3<<endl;
    else if(c==1)
        cout<<1<<endl;
    else if(c==0)
        cout<<0<<endl;
    else if(s[0]=='R' && s[2]=='R')
        cout<<1<<endl;
    else
        cout<<2<<endl;
}

Measured memory_bytes: 3644
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.util.function.DoubleToLongFunction;

import javax.naming.InitialContext;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		long ans = 1;
		long not = 1;
		int N = sc.nextInt();
		for(int i = 0; i < N; i++){
			ans *= 3;
			if(sc.nextInt() % 2 == 0){
				not *= 2;
			}
		}
		ans -= not;
		System.out.println(ans);
	}
}



class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21204
import numpy as np

n,m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
d = 2**18

f = np.zeros(d,dtype=int)
for i in a:
    f[i]+=1

tf = np.fft.rfft(f)
f = np.fft.irfft(tf*tf)
f = [int(i+0.5) for i in f]

ans=0
for i in range(len(f)-1,0,-1):
    if f[i]<=m:
        ans+=i*f[i]
        m-=f[i]
    elif f[i]>m:
        ans+=i*m
        break
print(ans)

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

int main() {
  long long H;
  cin >> H;
  long long C=H;
  long long c=0;
  long long ans=1;
  for(long long i=0;i<10000000000000;i++){
    H=C/2;
    if(H>=1){
      c++;
      C=H;
    }
    else{
      break;
    }
  }
  for(long long i=0;i<c;i++){
    ans*=2;
  }
  cout<<ans*2-1<<endl;
}


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

using namespace std;

#define DICETOP 0
#define DICEFRONT 1
#define DICERIGHT 2
#define DICELEFT 3
#define DICEBACK 4
#define DICEBOTTOM 5

class Dice {
private:
	int *face;
public:
	Dice( int top, int front, int right, int left, int back, int bottom ) {
		face = new int[6];
		face[DICETOP] = top;
		face[DICEFRONT] = front;
		face[DICERIGHT] = right;
		face[DICELEFT] = left;
		face[DICEBACK] = back;
		face[DICEBOTTOM] = bottom;
	}
	~Dice( ) {
		delete [ ] face;
	}
	void setDice( int top, int front, int right, int left, int back, int bottom ) {
		if( 0 < sizeof( face )/sizeof( face[0] ) ) {
			face[DICETOP] = top;
			face[DICEFRONT] = front;
			face[DICERIGHT] = right;
			face[DICELEFT] = left;
			face[DICEBACK] = back;
			face[DICEBOTTOM] = bottom;
		}
		return;
	}
	void roll( string cmd ) {
		int t;
		for( int i=0; i<cmd.length(); i++ ) {
			if( 'E' == cmd[i] ) {
				t = face[DICETOP];
				face[DICETOP] = face[DICELEFT];
				face[DICELEFT] = face[DICEBOTTOM];
				face[DICEBOTTOM] = face[DICERIGHT];
				face[DICERIGHT] = t;
			} else if( 'N' == cmd[i] ) {
				t = face[DICETOP];
				face[DICETOP] = face[DICEFRONT];
				face[DICEFRONT] = face[DICEBOTTOM];
				face[DICEBOTTOM] = face[DICEBACK];
				face[DICEBACK] = t;
			} else if( 'S' == cmd[i] ) {
				t = face[DICETOP];
				face[DICETOP] = face[DICEBACK];
				face[DICEBACK] = face[DICEBOTTOM];
				face[DICEBOTTOM] = face[DICEFRONT];
				face[DICEFRONT] = t;
			} else if( 'W' == cmd[i] ) {
				t = face[DICETOP];
				face[DICETOP] = face[DICERIGHT];
				face[DICERIGHT] = face[DICEBOTTOM];
				face[DICEBOTTOM] = face[DICELEFT];
				face[DICELEFT] = t;
			} else if( 'M' == cmd[i] ) {
				t = face[DICEBACK];
				face[DICEBACK] = face[DICERIGHT];
				face[DICERIGHT] = face[DICEFRONT];
				face[DICEFRONT] = face[DICELEFT];
				face[DICELEFT] = t;
			}
		}
		return;
	}
	int getFace( int diceface ) {
		return face[ diceface ];
	}
};

int main( )
{
	int t, f, r, l, ba, bo;
	cin>>t>>f>>r>>l>>ba>>bo;
	Dice *dice = new Dice( t, f, r, l, ba, bo );

	cin>>t>>f>>r>>l>>ba>>bo;
	Dice *dice2 = new Dice( t, f, r, l, ba, bo );
	
	int i, cnt;
	cnt = 0;
	while( cnt <= DICEBOTTOM ) {
		switch( cnt ) {
			case DICETOP:
					cnt++;
				break;
			case DICEFRONT:
					dice2->roll( "N" );
					cnt++;
				break;
			case DICERIGHT:
					dice2->roll( "W" );
					cnt++;
				break;
			case DICELEFT:
					dice2->roll( "E" );
					cnt++;
				break;
			case DICEBACK:
					dice2->roll( "S" );
					cnt++;
				break;
			case DICEBOTTOM:
					dice2->roll( "SS" );
					cnt++;
				break;
			}
			if( dice2->getFace( DICETOP ) == dice->getFace( DICETOP ) ) {
				for( i=0; i<3; i++ ) {
					if( dice2->getFace( DICEFRONT ) == dice->getFace( DICEFRONT ) ) { break; }
					dice2->roll( "M" );
				}
				for( i=0; i<6; i++ ) {
					if( dice2->getFace( i ) != dice->getFace( i ) ) { break; }
				}
				if( 6 == i ) { break; }
			}
			dice2->setDice( t, f, r, l, ba, bo );
	}
	if( 6 == i ) { 
		cout<<"Yes"<<endl;	
	} else {
		cout<<"No"<<endl;
	}

	delete dice;
	delete dice2;
	
	return 0;
}

Measured memory_bytes: 1204
#include<iostream>
using namespace std;
int main(){
unsigned long long n;
cin>>n;
unsigned long long a[n];
a[0]=2;
a[1]=1;
for(int i=2;i<=n;i++)
{
    a[i]=a[i-1]+a[i-2];
}
cout<<a[n]<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 16;
int x[maxn][maxn], y[maxn][maxn], a[maxn];
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		for(int j = 0; j < a[i]; j++){
			cin >> x[i][j] >> y[i][j];
			x[i][j]--;
		}
	}
	int ans = 0;
	for(int i = 1; i < 1<<n; i++){
		bool ok = true;
		for(int j = 0; j < n; j++){
			if((i>>j)&1){
				for(int k = 0; k < a[j]; k++){
					if(((i>>x[j][k])&1) != y[j][k]){
						ok = false;
					}
				}
			}
		}
		if(ok) ans = max(ans, __builtin_popcount(i));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (b%a == 0)
	{
		cout << a + b << endl;
	}
	else
	{
		cout << b - a << endl;
	}
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  int h, w;
  cin >> h >> w;
  vector<vector<string>> v(h, vector<string>(w, "@"));

  int res = 0;
  char c = 'A';
  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
    {
      cin >> v[i][j];
      if(v[i][j] == "snuke")
      {
        res = i;
        c += j;
      }
    }
  }

  cout << c << res+1 << endl;


}

Measured memory_bytes: 256
n, m = map(int, input().split())

m2 = m

A = [list(map(int,input().split())) for i in range(n)]

b=[]
while m2 > 0:
  b_data = int(input())
  b.append(b_data)
  m2 = m2-1

  
for i in range(0,n):
  c = 0
  for j in range(0,m):
    c = c + (A[i][j] * b[j])
  print(c)


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

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

    vector<char> c(n);
    int red=0;

    rep(i,n){
        cin >> c[i];
        if(c[i]=='R') red ++;
    }

    int ans=0;
    for(int i=0; i<red; i++){
        //redzoneにwhiteがあったらans++
        if(c[i]=='W'){
            ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

class Main {
    static Node root = null;
    static StringBuilder sb = new StringBuilder("");

    public static void main (String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int m = Integer.parseInt(br.readLine());
        String input;

        for (int i = 0; i < m; i++) {
            input = br.readLine();
            if (input.charAt(0) == 'i') {
                insert(new Node(Integer.parseInt(input.substring(7))));
            } else if (input.charAt(0) == 'f') {
                if (find(Integer.parseInt(input.substring(5)))) {
                    sb.append("yes\n");
                } else {
                    sb.append("no\n");
                }
            } else {
                print();
            }
        }
        System.out.print(sb);
    }

    public static void insert(Node node) {
        Node parent = null;
        Node child = root;
        while (child != null) {
            parent = child;
            if (node.key < child.key) {
                child = child.left;
            } else {
                child = child.right;
            }
        }

        if (parent == null) {
            root = node;
        } else if (node.key < parent.key) {
            parent.left = node;
        } else {
            parent.right = node;
        }
    }

    public static boolean find(int key) {
        Node node = root;
        while (node != null) {
            if (key == node.key) {
                return true;
            } else if (key < node.key) {
                node = node.left;
            } else {
                node = node.right;
            }
        }
        return false;
    }

    public static void print() {
        printInorder(root);
        sb.append("\n");
        printPreorder(root);
        sb.append("\n");
    }

    public static void printPreorder(Node node) {
        if (node == null) return;
        sb.append(" ").append(node.key);
        printPreorder(node.left);
        printPreorder(node.right);
    }

    public static void printInorder(Node node) {
        if (node == null) return;
        printInorder(node.left);
        sb.append(" ").append(node.key);
        printInorder(node.right);
    }
}

class Node {
    public int key;
    public Node left;
    public Node right;

    public Node(int key) {
        this.key = key;
        left = right = null;
    }
}

Measured memory_bytes: 102256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    while (true) {
        string s, t;
        cin >> s;
        if (s[0] == '.') break;
        cin >> t;
        vector<string> odd1, even1, odd2, even2;
        string add = "";
        bool oe = false;
        for (int i = 0; i < (int)s.size(); i++) {
            if (s[i] == '"')  {
                if (oe) {
                    even1.emplace_back(add);
                }
                else {
                    odd1.emplace_back(add);
                }
                oe = !oe;
                add = "";
            }
            else {
                add = add + s[i];
                if (i == (int)s.size() - 1) {
                    if (oe) {
                        even1.emplace_back(add);
                    }
                    else {
                        odd1.emplace_back(add);
                    }
                    oe = !oe;
                    add = "";
                }
            }
        }
        oe = false;
        add = "";
        for (int i = 0; i < (int)t.size(); i++) {
            if (t[i] == '"')  {
                if (oe) {
                    even2.emplace_back(add);
                }
                else {
                    odd2.emplace_back(add);
                }
                oe = !oe;
                add = "";
            }
            else {
                add = add + t[i];
                if (i == (int)t.size() - 1) {
                    if (oe) {
                        even2.emplace_back(add);
                    }
                    else {
                        odd2.emplace_back(add);
                    }
                    oe = !oe;
                    add = "";
                }
            }
        }
        if (odd1.size() != odd2.size() || even1.size() != even2.size()) {
            dump("DIFFERENT");
            continue;
        }
        bool x = false;
        for (int i = 0; i < (int)odd1.size(); i++) {
            if (odd1[i] != odd2[i]) x = true;
        }
        if (x) {
            dump("DIFFERENT");
            continue;
        }
        int cnt = 0;
        for (int i = 0; i < (int)even1.size(); i++) {
            if (even1[i] != even2[i]) cnt++;
        }
         if (cnt == 0) {
        dump("IDENTICAL");
    }
    else if (cnt == 1) {
        dump("CLOSE");
    }
    else {
        dump("DIFFERENT");
    }
    }
    return 0;
} 


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

long long min(long long a,long long b){
  if(a < b){
    return a;
  }
  return b;
}

long long max(long long a,long long b){
  if(a > b){
    return a;
  }
  return b;
}

int binary_search(const long long *sum,const int ll,const int rr){
  long long median = (sum[rr]-sum[ll-1])/2;
  int left = ll;
  int right = rr;
  while(right-left > 1){
    int middle = (left+right)/2;
    if(sum[middle]-sum[ll-1] <= median){
      left = middle;
    }else{
      right = middle;
    }
  }

  long long x = llabs(sum[left]-sum[ll-1]-(sum[rr]-sum[left]));
  long long y = llabs(sum[right]-sum[ll-1]-(sum[rr]-sum[right]));
  return x < y ? left:right;
}


int main(void){
  int N;
  scanf("%d",&N);

  int A[N+1];
  long long sum[N+1];
  for(int i = 1;i <= N;i++){
    scanf("%d",&A[i]);
  }
  sum[0] = 0;
  for(int i = 1;i <= N;i++){
    sum[i] = sum[i-1]+A[i];
  }

  long long ans = sum[N];
  long long P,Q,R,S;
  for(int i = 2;i < N;i++){
    int left = binary_search(sum,1,i);
    int right = binary_search(sum,i+1,N);
    P = sum[left]-sum[0];
    Q = sum[i]-sum[left];
    R = sum[right]-sum[i];
    S = sum[N]-sum[right];
    ans = min(ans,max(P,max(Q,max(R,S)))-min(P,min(Q,(min(R,S)))));
  }

  printf("%lld\n",ans);

  return 0;
}

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

int main()
{
	int H, W, x = 0, y = 1;

	while (1) {
		cin >> H >> W;

		if (H == 0 && W == 0)
			break;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (j % 2 == x) {
					cout << '#';
				}
				else {
					cout << '.';
				}
			}
			swap(x, y);
			cout << endl;
		}
		x = 0, y = 1;
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3084
s = input()
n = len(s)
s = [ord(c)-ord('a') for c in s]
h = [0] * (n+1)
for i in range(1,n+1):
  h[i] = h[i-1] ^ (1<<s[i-1])
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]
for i in range(n):
  tmp = float("inf")
  for j in bits:
    try:
      tmp = min(dp[h[i+1]^j] + 1,tmp)
    except:
      pass
  try:
    e = dp[h[i+1]]
  except:
    e = float("inf")
  dp[h[i+1]] = min(tmp,e)
print(dp[h[n]] if dp[h[n]] != 0 else 1)

Measured memory_bytes: 72460
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;
int main() {
    int N, D; 
    cin >> N >> D;
    
    vector<vector<int>> X(N, vector<int>(D));

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < D; j++) {
            cin >> X[i][j];
        }
    }

    int ans = 0;

    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            int norm = 0;

            for (int k = 0; k < D; k++) {
                int diff = abs(X[i][k] - X[j][k]);
                norm += diff * diff;
            }

            bool flag = false;

            for (int k = 0; k <= norm; k++) {
                if (k * k == norm) {
                    flag = true;
                }
            }

            if (flag){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
fun main(args : Array<String>) {
  val n = readLine()
  val b =  readLine()!!.split(" ").map{ it.toInt() }
  val a = Array(b.size + 1, {0})
  a[0] = b[0]
  for(i in 1 until b.size){
    a[i] = b[i - 1]
    if(b[i] < a[i]){
      a[i] = b[i]
    }
  }
  a[a.size-1] = b[b.size-1]
  var sum=0
  for(i in 0 until a.size){
    sum+=a[i]
  }
  println(sum)
}

Measured memory_bytes: 37672
import bisect
from collections import deque

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

buf = deque()
for a in A:
    i = bisect.bisect_right(buf, a-1)-1
    if i < 0:
        buf.appendleft(a)
    else:
        buf[i] = a
print(len(buf))

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, a;
  cin >> N ;
  a=1;
  string k;
  cin >> k;
  llvec b(N+1, 0);
  rep(i, N)cin >> b[i+1];
  llvec v(N+1, 0);  
  ll cnt=1;
  v[a]=0;
  llvec cnt2word;
  cnt2word.push_back(a);
  while(v[a]==0){
    v[a]=cnt;
    cnt2word.push_back(b[a]);
    a = b[a];
    cnt++;
  }
  //DUMP(i, cnt2word);cout << endl;
  ll T = cnt - v[a];
  if(k.size()<9){
    if(stoi(k)<=v[a]){
      cout << cnt2word[stoi(k)]<<endl;
      return 0;
    }
  }
  reverse(ALL(k));
  ll mods=-(v[a]);
  rep(i, k.size()){
    mods=mod(mods + mod( (k[i] - '0')*modpow(10, i, T), T),T);
  }
  cout << cnt2word[mods+(v[a])]<<endl;
  
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  double ans = 0,a;
  for( int i = 0; i < N; i++){
    cin >> a;
    ans += 1 / a;
  }
  ans = 1 / ans;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

ll mod = 1e9 + 7;


int main(){
	int n,m;
	priority_queue<int, vector<ll>> a;

	cin >> n >> m;
	for(int i=0;i<n;i++){
		ll t;
		cin >> t;
		a.push(t);
	}	

	for(int i=0;i<m;i++){
		ll t = a.top();
		a.pop();
		t /= 2;
		a.push(t);
	}
	

	ll ans = 0;
	for (int i=0; i<n; i++){
		ans += a.top();
		a.pop();
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1400
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;
int a[maxn], b[maxn], c[maxn];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    f1(i,n) cin>>a[i];
    f1(i,n) cin>>b[i];
    f1(i,n-1) cin>>c[i];
    ll tot = 0;
    f1(i,n)
    {
        int x = a[i];
        tot+=b[x];
        if(i>1 && a[i-1]+1==a[i]) tot+=c[x-1];
    }
    cout << tot;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;

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

    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];

    int ans = 0, lmax;
    rep(i, n - 2) {
        for(int j = i + 1; j < n; ++j) {
            for(int k = j + 1; k < n; ++k) {
                lmax = max(max(l[i], l[j]), l[k]);
                if(2 * lmax - l[i] - l[j] - l[k] < 0 && l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) ans++;
            }
        }
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=1e5+10;
string S,T;
int main()
{
    cin>>S>>T;
    if(T.substr(0,S.length())==S)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int SZ = (1 << 18);

struct starry_sky_tree {
    int all[SZ * 2], ma[SZ * 2];

    void init() {
        memset(all, 0, sizeof(all));
        memset(ma, 0, sizeof(ma));
    }

    void add(int a, int b, int x, int k = 0, int l = 0, int r = SZ) {
        if (b <= l || r <= a) return ;
        if (a <= l && r <= b) {
            all[k] += x; return ; 
        }

        add(a, b, x, k * 2 + 1, l, (l + r) / 2);
        add(a, b, x, k * 2 + 2, (l + r) / 2, r);
        ma[k] = max(ma[k * 2 + 1] + all[k * 2 + 1], ma[k * 2 + 2] + all[k * 2 + 2]);
    }

    int get() { return ma[0] + all[0]; }
} seg;

int N, M;

int main() {
	cin >> N >> M;
	seg.init();

	vector<pii> vec;

	rep(i, N) {
		int l, r;
		cin >> l >> r;
		vec.eb(l, r);
	}

	for (int i = 1; i <= M + 1; ++i) {
		seg.add(i, i + 1, i);
	}

	sort(ALL(vec));

	int t = 0;

	for (auto& p : vec) {
		seg.add(1, p.se + 1, 1);

		int x = seg.get() - M - p.fi - 1;
		t = max(t, x);
	}

	cout << max(t, N - M) << endl;

    return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int a;

string s;

int main(void) {
  // Here your code !
  scanf("%d", &a);

  cin >> s;

  if (a >= 3200) {
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#N = int(input())
H,W = [int(i) for i in input().split()]
s = [[j for j in input().split()] for i in range(H)]

for h in range(H):
    for w in range(W):
        if s[h][w] == "snuke":
            row = chr(ord('A')+w)
            print(row+str(h+1))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

ll modpow(ll a,ll n,ll m){
    ll res=1;
    while(n){
        if(n&1)res=res*a%m;
        a=a*a%m;
        n>>=1;
    }
    return res;
}

const int MAX=510000;

vll finv(MAX);
vll inv(MAX);

void combinit(ll m){
    finv[0]=1;finv[1]=1;
    inv[1]=1;
    rep2(i,2,MAX){
        inv[i]=m-inv[m%i]*(m/i)%m;
        finv[i]=finv[i-1]*inv[i]%m;
    }
}

ll combi2(ll n,ll k){
    ll res=0;ll tmp=(ll)1;
    while(res<k){
        tmp*=n;
        tmp%=inf;
        n--;
        res++;
    }
    return tmp;
}

ll combi(ll n,ll k,ll m){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return (combi2(n,k)*finv[k])%m;
}

int main(){
    ll n,a,b;cin>>n>>a>>b;
    combinit(inf);
    ll tmp=modpow((ll)2,n,inf)-combi(n,a,inf)-combi(n,b,inf)-(ll)1;
    while(tmp<0)tmp+=inf;
    cout<<tmp<<endl;
}

Measured memory_bytes: 8192
//#include<bits/stdc++.h>
#include<cstdio>
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 Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

void pakuri_sort(int N, int A[]) {
	const int b = 8;
	int tmp[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	int A[100000];
	rep(i, N) A[i] = getint();
	pakuri_sort(N, A);

	int x = 0, y = 0;
	int mae = 0;
	for (int i = N - 1; i >= 0; i--) {
		if (mae == A[i]) {
			if (!x) x = mae;
			else {
				y = mae;
				break;
			}
			mae = 0;
		}
		else mae = A[i];
	}
	printf("%lld", (ll)x * y);

	Would you please return 0;
}

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

int main(){
    string str;
    cin >> str;
    int N=atoi(str.c_str());
    int sum=0;

    for(int i=0;i<str.length();i++){
        sum += str[i]-48;
    }

    cout << ((N%sum==0)?"Yes":"No") << endl;



    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int r;

  scanf("%d", &r);

  if (r < 1200) {
    printf("ABC\n");
  }else if (r < 2800) {
    printf("ARC\n");
  }else {
    printf("AGC\n");
  }

  return 0;
}

Measured memory_bytes: 128
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T& v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  int n;in(n);
  vector<ll> A(n);
  loop(i,0,n) in(A[i]);
  ll ans = 0;
  loop(i,0,n-2) {
    loop(j,i+1,n-1) {
      loop(k,j+1,n) {
        if (A[i] == A[j] or A[j] == A[k] or A[k] == A[i]) continue;
        if (A[i] + A[j] > A[k] and A[j] + A[k] > A[i] and A[k] + A[i] > A[j]) {
          // print(vector{ i, j, k})
          ans++;
        }
      }
    }
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 3628
n,y = map(int,input().split())
s=[-1,-1,-1]
if n*10000<y:
    pass
elif n*10000==y:
    s=[n,0,0]
else:
    m=1
    x_0=n*10000
    while m<=n:
        for i in range(m+1):
            x= x_0-9000*(m-i)-5000*i
            if x == y:
                s=[n-m,i,m-i]
                break
        if x==y:
            break
        m=m+1
print(*s)
                

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#define max(a,b) ((a > b) ? a : b)
#define min(a,b) ((a < b) ? a : b)
#define abs(a) ((a < 0) ? -a : a)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

int main() {
	int res = 0;
	int a = ri();
	int b = ri();
	int aa = a+b;
	int bb = a-b;
	int cc = a*b;
	
	res = max(aa, bb);
	res = max(res, cc);
	
	printf("%d", res);
	
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#define INF 1000000007
using namespace std;
const double pai = 3.141592653589;

int main(void){
    double r;
    cin >> r;
    cout << fixed << pai * r * r  << ' ' << 2 * pai * r << endl;
    return 0;
}


Measured memory_bytes: 3292
//
// Created by Yoshiki Shino on 2018/07/01.
//

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N = 3;

    vector<int> A;

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

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

    int result = 0;

    result += A[1] - A[0];
    result += A[2] - A[1];

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define prsp(v) loop(i,0,v.size())cout<<v[i],sp;nl;
#define prpsp(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S<<" , ";nl;
#define prnl(v) loop(i,0,v.size())cout<<v[i],nl;nl;
#define prpnl(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S,nl;nl;
#define MOD 1000000007
#define mod(n) (((n%MOD)+MOD)%MOD)
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll m,k;
    cin>>m>>k;
    ll mx = pow(2,m)-1;

    if( m == 1 )
    {
        if( k == 0 )
            cout<<"0 0 1 1";
        else
            cout<<-1;
    }
    else
    {
        if( k > mx )
        {
            cout<<-1;
        }
        else
        {
            vector<int>ans;
            for(int i=0;i<=mx;i++)
            {
                if( i == k )
                    continue;
                ans.pb(i);
            }
            ans.pb(k);
            for(int i=mx;i>=0;i--)
            {
                if( i == k )
                    continue;
                ans.pb(i);
            }
            ans.pb(k);
            for(int i=0;i<ans.size();i++)
            {
                cout<<ans[i]<<" ";
            }
        }
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using P = pair<int,int>;

int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

int main(){
    int h,w;
    cin>>h>>w;
    int si,sj;
    cin>>si>>sj;
    int ti,tj;
    cin>>ti>>tj;
    --si; --sj; --ti; --tj;
    vector<string> s(h);
    rep(i,h) cin>>s[i];

    const int INF = 1e9;
    vector< vector<int> > dist(h,vector<int>(w,INF));
    deque<P> q;
    dist[si][sj] = 0;
    q.push_back(make_pair(si,sj));
    while(!q.empty()){
        int i = q.front().first;
        int j= q.front().second;
        q.pop_front();
        int d = dist[i][j];
        rep(v,4){
            int ni = i+dy[v]; int nj = j+dx[v];
            if(ni<0 || ni>=h || nj<0 || nj>=w) continue;
            if(s[ni][nj]=='#') continue;
            if(dist[ni][nj]<=d) continue;
            dist[ni][nj] = d;
            q.push_front(make_pair(ni,nj));
        }
        for(int ei=-2;ei<=2;ei++){
            for(int ej=-2;ej<=2;ej++){
                int ni = i+ei; int nj = j+ej;
                if(ni<0 || ni>=h || nj<0 || nj>=w) continue;
                if(s[ni][nj]=='#') continue;
                if(dist[ni][nj]<=d+1) continue;
                dist[ni][nj] = d+1;
                q.push_back(make_pair(ni,nj));
            }
        }
    }
    int ans = dist[ti][tj];
    if(ans==INF) ans = -1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9576
#[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! {
        k: u64
    }

    let n = 50;
    let mut a = (0..n).map(|x| x + k / n) .collect::<Vec<_>>();
    for i in 0..((k%n) as usize) {
        a[i] += n;
        for j in 0..n as usize {
            if i != j {
                a[j] -= 1;
            }
        }
    }
    println!("{}", n);
    println!("{}", join(&a, " "));
}

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

Measured memory_bytes: 4352