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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define MAXX 100005

#define PI 3.14159265358979323846264338327950

#define ll signed long long int
int main()
{
	int a,b;
	cin>>a>>b;
	if (a>b)
	cout<<a+a-1;
	else if (a<b)
	cout<<b+b-1;
	else
	cout<<a+a;
}

Measured memory_bytes: 256
import java.util.*;

import javax.xml.crypto.Data;
public class Main{
	static int a[],n,i,j,ans[],cnt;
	private static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		for(int i = 1; i <= 9; ++i) {
			for(int n = 1; n <= 9; ++n) {
				System.out.println(i + "x" + n + "=" + i * n);
			}
		}
		
		
	}

}

Measured memory_bytes: 17300
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
#define MOD (1000000007ll)
#define l_ength size

int main(void){
	ll n,m;
	cin >> n >> m;
	if(n==1ll && m==1ll){
		cout << 1 << endl;
	}else if(n == 1ll){
		cout << (m-2) << endl;
	}else if(m == 1ll){
		cout << (n-2) << endl;
	}else{
		cout << ((n-2ll)*(m-2ll)) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric> // next_parmutation
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    int size = s.size();

    rep(bit, (1 << size - 1)){
        string str = "";
        rep(i,size){
            str += s.at(i);
            if(bit >> i&1){
                ans += stoll(str);
                str = "";
            }
        }
        ans += stoll(str);
        str = "";
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
class _0002
{
    public static void Main()
    {
        const int dataNum = 200;
        char[] splitChar = {' '};
        int[] a = new int[dataNum];
        int[] b = new int[dataNum];
        int k = 0;
        string str;
        while((str = Console.ReadLine()) != null){
            string[] nums = str.Split(splitChar);
            a[k] = int.Parse(nums[0]);
            b[k] = int.Parse(nums[1]);
            k++;
        }
        for (int i = 0; i < k; i++)
        {
            int sum = a[i] + b[i];
            Console.WriteLine(sum.ToString().Length);
        }
    }
}

Measured memory_bytes: 5620
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;

#define inRange(x,a,b) (a <= x && x <= b)
typedef long long ll;

int main(){
    vector<int> xaxis, yaxis;
    int n, k;
    cin >> n >> k;
    int x[n], y[n];
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        xaxis.push_back(x[i]);
        yaxis.push_back(y[i]);
    }
    sort(xaxis.begin(), xaxis.end());
    sort(yaxis.begin(), yaxis.end());

    ll ans = LLONG_MAX;
    for(int l = 0; l < n; l++){
        for(int r = l+1; r < n; r++){
            for(int d = 0; d < n; d++){
                for(int u = d+1; u < n; u++){
                    int cnt = 0;
                    for(int k = 0; k < n; k++){
                        if(inRange(x[k], xaxis[l], xaxis[r]) && inRange(y[k], yaxis[d], yaxis[u]))
                            cnt++;
                    }
                    if(cnt >= k){
                        ans = min(ans, ll(xaxis[r]-xaxis[l]) * (yaxis[u]-yaxis[d]));
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(void)
{
    int cc;

    cin >> cc;

    int H = cc / 60;
    cc -= 60*H;
    int t = H / 60;
    H -= t*60;

    cout << t <<":" << H << ":" << cc << endl;

   return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define int long long
using namespace std;


signed main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int c=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]+a[j]>a[k] && a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k]){
                    c++;
                }
            }
        }
    }
    cout<<c<<endl;
}


Measured memory_bytes: 3636
//Bismillahir Rahmanir Rahim
//In the name of Allah the Most Merciful
//Astagfirullahil laji Rabbi Minkulli Jamio
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
int i,j,k;
main()
{
  map<char,int> m;
  string s;
  cin>>s;
  for(i=0;i<s.length();i++)
  {
      m[s[i]]++;
  }
  int p=0;
  for(char c='a';c<='z';c++)
  {
      if(m[c]%2!=0)
      {
          p=1;
      }
  }
  if(p) cout<<"No"<<endl;
  else
  cout<<"Yes"<<endl;

}


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

int main(void){
    int n, a, c[20], cnt=0, tu=0;
    cin >> n;
    for(int i=0;i<20;++i) c[i]=0;
    for(int i=0;i<n;++i){
        cin >> a;
        if(c[(a/400)]==0){
            if(a < 3200){
                ++cnt;
                c[(a/400)] = 1;
            }
            else ++tu;
        }
    }
    cout << max(cnt, 1) << " " << cnt+tu << endl;
}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	priority_queue<int> pq;
	vvi c(n);
	rep(i, n) {
		int m;
		cin >> m;

		c[i].resize(m);
		rep(j, m) cin >> c[i][j];
	}

	ll ans = 0;
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < c[i].size(); ++j) {
			pq.push(c[i][j]);
		}
		ans += pq.top();
		pq.pop();
	}

	cout << ans << endl;
}


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

class Prime
{
	int i, iLimit;

public:
	bool isPrime(int a);
};

bool Prime::isPrime(int a)
{
	if (a == 1) return false;

	iLimit = (int)sqrt(a);
	for (i = 2; i <= iLimit; i++) {
		if (a % i == 0) break;
	}
	if (i == iLimit + 1) {
		return true;
	}
	else {
		return false;
	}
}

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

	bool elf;
	Prime objPrime;
	for (int i = x;; ++i) {
		elf = objPrime.isPrime(i);
		if (elf) {
			dunk(i);
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
	int i,n,d,count,N,D,X;
	count=0;
	scanf("%d", &N);
	scanf("%d %d",&D,&X);
	int int_arr[N];
	
	for (int i = 0; i < N; i++){
		scanf("%d", &int_arr[i]);

		for (int j = 1; j <= D; j += int_arr[i]){
		  count++;
		}
	}
	printf("%d \n",count+X );
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final int n = scanner.nextInt();
        final long[] array = new long[100_001];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            final int a = scanner.nextInt();
            array[a]++;
            sum += a;
        }

        final int q = scanner.nextInt();
        for (int i = 0; i < q; i++) {
            final int b = scanner.nextInt();
            final int c = scanner.nextInt();
            final long tmp = array[b];
            array[b] = 0;
            array[c] += tmp;
            sum = sum + tmp * (c - b);
            System.out.println(sum);
        }
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

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

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

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

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }
    }
}


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

#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
#define nrep(i,a,b) for(int i=int(a);i>=int(a);--i)
#define trv(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define watch(x) cout<<"\n"<<#x<<" is "<<x<<"\n"
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define ZERO(box) memset(box, 0, sizeof(box));
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define all(A) A.begin(),A.end()
#define chkbit(s, b) (s & (1<<b))
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
const int mod=1e9+7;
const int mxN = 1e5+5;

vvi g;
vi dist,visted;

void dfs(int src){
	visted[src]=1;

	for(auto to:g[src]){
		if(!visted[to]){
			dfs(to);
		}
		dist[src] = max(dist[src],dist[to]+1);
	}
}

void solve(){
	int n,m;
	cin>>n>>m;
	g = vvi(n+1);
	dist = vi(n+1,0);
	visted = vi(n+1,0);
	vi root(n+1,1);
	int x,y;
	rep(i,1,m){
		cin>>x>>y;
		g[x].pb(y);
		root[y]=0;
	}
	rep(i,1,n){
		if(root[i]){
			dfs(i);
		}
	}
	cout<<*max_element(all(dist));
}

int main(){
	solve();
}

Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <queue>
using namespace std;

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

double dp[305][305][305];
double prob[305][305][305];

int main(){
    int n; cin >> n;
    rep(j,305) rep(i,305) rep(k,305) dp[i][j][k] = 0.0;
    rep(j,305) rep(i,305) rep(k,305) prob[i][j][k] = 0.0;
    int s[]= {0,0,0}; 
    rep(i,n){
        int t; cin >> t;
        s[t-1]++;
    }
    prob[s[2]][s[1]][s[0]] = 1.0;
    
    rep(i,301) rep(j,301) rep(k,301){
        long long int s = i+j+k;
        double ss = (double)s;
        double sq = (double)(s*s);
        double smq = (double) ((s+1)*(s+1));
        if(j>0) dp[i+1][j-1][k] += ((double)(i+1) * (double)n / sq) + (((i+1) / ss) * dp[i][j][k]);
        if(k>0) dp[i][j+1][k-1] +=  ((double)(j+1) * (double)n / sq) + (((j+1) / ss) * dp[i][j][k]);
        dp[i][j][k+1] += ((double)(k+1) * (double)n / smq) +  (((k+1) / (ss+1.0)) * dp[i][j][k]);
    }
    printf("%.16lf\n", dp[s[2]][s[1]][s[0]]);
    return 0;
}

Measured memory_bytes: 443648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long d,t,s;
    cin>>d>>t>>s;
    float s1=(float)d/s;
    if(s1>t)
    {
        cout<<"No"<<endl;
    }
    else
        cout<<"Yes"<<endl;

}


Measured memory_bytes: 3548
// :)
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>

using namespace std;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int> pii32;
typedef pair<int64,int64> pii64;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

const int maxn = 2e5+10;
const int64 MO = 1e9+7;
const int64 IN = 1e9;

string s;
int g[maxn][30];
int dp[maxn], nxt[maxn];
int pos[30];
bool vis[maxn];

void dfs (int v) {
	vis[v] = true;
	dp[v] = maxn;
	for (int i = 0; i < 26; i++)
		if (g[v][i] + 1) {
			if (!vis[g[v][i]])
				dfs(g[v][i]);
			if (dp[v] > dp[g[v][i]] + 1) {
				dp[v] = dp[g[v][i]] + 1;
				nxt[v] = i;
			}
		} else {
			dp[v] = 1;
			nxt[v] = i;
			break;
		}
	
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	memset(pos, -1, sizeof pos);
	memset(g, -1, sizeof g);
	cin >> s;
	for (int i = sz(s) - 1; i >= 0; i--) {
		for (int t = 0; t < 26; t++)
			g[i][t] = pos[t];
		pos[s[i] - 'a'] = i;
	}
	int ans = -1;
	for (int i = 0; i < sz(s); i++)
		if (!vis[i])
			dfs(i);
	for (int i = 0; i < 26; i++)
		if (pos[i] + 1) {
			if (ans == -1 || dp[pos[i]] < dp[ans])
				ans = pos[i];
		}
		else
			return cout << (char)(i + 'a') << "\n", 0;
	cout << s[ans];
	while (1) {
		cout << (char)(nxt[ans] + 'a');
		if (g[ans][nxt[ans]] == -1)
			break;	
		ans = g[ans][nxt[ans]];
	} cout << "\n";
}


Measured memory_bytes: 26132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
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; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	int a,b;
	cin >> a >> b;
	cout << max(0,a-2*b) << endl;

  return 0;
}


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

int analyze (vector<int> times)
{
  vector<int> sumTimes(6);
  sumTimes.at(0) = times.at(0) + times.at(1);
  sumTimes.at(1) = times.at(0) + times.at(2);
  sumTimes.at(2) = times.at(1) + times.at(0);
  sumTimes.at(3) = times.at(1) + times.at(2);
  sumTimes.at(4) = times.at(2) + times.at(0);
  sumTimes.at(5) = times.at(2) + times.at(1);
  
  sort(sumTimes.begin(), sumTimes.end());
  return sumTimes.at(0);
}

int main() {
  vector<int> times(3);
  for (int i = 0; i < 3; i++)
	cin >> times.at(i);
  
  cout << analyze(times) << endl;
}


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

#define rep(i,n) for(i=0;i<(n);i++)
#define For(i,a,b) for(i=(a);i<(b);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const double PI=acos(-1.0);


int main(){
	int i,j,l;
	int n,k;
	int min;
	int ans=0;
	int c=0;
	vector<int> a;
	cin >> n >> k;
	a.resize(n);
	vector<int> b(n,0);
	rep(i,n) cin >> a[i];
	sort(all(a));
	rep(i,n){
		b[c]++;
		if(i!=n-1 && a[i]!=a[i+1]) c++;
	}
	//cout << c << endl;
	sort(b.begin(),b.begin()+c+1);
	//rep(i,c+1) cout << b[i] << endl;
	i=0;
	while(k<=c){
		ans+=b[i];
		i++;
		c--;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.14159265359

#define NIL -1

struct Node {
    int parent= NIL, left = NIL, right = NIL;
};
Node t[30];
int n, degree[30], depth[30], height[30], sibling[30];

void setDegree(int u){
    int d = 0;
    if(t[u].left != NIL) d++;
    if(t[u].right != NIL) d++;
    degree[u] = d;
}

void setSibling(int u){
    if(t[u].parent == NIL) sibling[u] = NIL;
    else{
        if(t[t[u].parent].left == u && t[t[u].parent].right != NIL) sibling[u] = t[t[u].parent].right;
        else if(t[t[u].parent].right == u && t[t[u].parent].left != NIL) sibling[u] = t[t[u].parent].left;
        else sibling[u] = NIL;
    }
}

void setDepth(int u,int d){
    if(u == NIL) return;
    depth[u] = d;
    if(t[u].left != NIL) setDepth(t[u].left, d+1);
    if(t[u].right != NIL) setDepth(t[u].right, d+1);
    return;
}

int setHeight(int u){
    int h1 = 0, h2 = 0;
    if(t[u].left != NIL) h1  =setHeight(t[u].left) + 1;
    if(t[u].right != NIL) h2 = setHeight(t[u].right) + 1;
    return height[u] = max(h1,h2);

}

void print(int u){
    cout << "node " << u << ": parent = " << t[u].parent << ", sibling = " << sibling[u];
    cout << ", degree = " << degree[u] << ", depth = " << depth[u] << ", height = " << height[u] << ", ";
    if(t[u].parent == NIL) cout << "root";
    else if(height[u] == 0) cout << "leaf";
    else cout << "internal node";
    cout << endl;
}

int main() {
    int id, left, right, root;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> id >> left >> right;
        t[id].left = left;
        t[id].right = right;
        if(left != NIL) t[left].parent = id;
        if(right != NIL) t[right].parent = id;
    }
    
    for(int i=0;i<n;i++){
        if(t[i].parent == NIL) root = i;
        setDegree(i);
        setSibling(i);
    }

    setHeight(root);
    setDepth(root, 0);
    
    for(int i=0;i<n;i++){
        print(i);
    }
    return 0;
}


Measured memory_bytes: 3100
import fractions

N, K = map(int, input().split())
A = list(map(int, input().split()))
B = []
for a1, a2 in zip(A, A[1:]):
    B.append(abs(a2-a1))

if K > max(A):
    print('IMPOSSIBLE')
    exit()
if K in A:
    print('POSSIBLE')
    exit()

g = B[0]
for b in B[1:]:
    g = fractions.gcd(g, b)

if (A[0] - K) % g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 90260
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
typedef vector<vector<int> > node;

bool terminate(node p) {
	if (p[0][0] == 0 && p[0][1] == 0) return true;
	if (p[1][0] == 0 && p[1][1] == 0) return true;
	return false;
}

int E(node p, int turn) {
	int o;
	if (turn > 0) o = 1;
	else o = 0;
	if (p[o][0] == 0 && p[o][1] == 0) return 1;
	return -1;
}



void make_move(node p, int turn, stack<node> &s) {
	int m, o;
	node tmp;

	if (turn > 0) { m = 0; o = 1; }
	else { m = 1; o = 0; }

	for (int i = 0; i <= 1; ++i) {
		for (int j = 0; j <= 1; ++j) {
			tmp = p;
			if (tmp[o][i] > 0 && tmp[m][j] > 0) {
				tmp[o][i] += tmp[m][j];
				if (tmp[o][i] >= 5) tmp[o][i] = 0;
				s.push(tmp);
			}
		}
	}
	return;
}

int f(node p, int turn) {
	stack<node> next;
	node np;
	if (terminate(p)) return E(p, turn);
	make_move(p, turn, next);
	while (!next.empty()) {
		np = next.top(); next.pop();
		int result = -f(np, -turn);
		if (result == 1) return 1;
	}
	return -1;
}

int main() {
	node p(2, vector<int>(2));

	cin >> p[0][0] >> p[0][1] >> p[1][0] >> p[1][1];

	if (f(p, 1) == 1) cout << "ISONO" << endl;
	else cout << "NAKAJIMA" << endl;
	return 0;
}

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


string divide[4] = {"dream", "dreamer", "erase", "eraser"};
string s;
bool dp[100000];
int main() {
    cin >> s;

    // 文字列のどこで切ることができるかを一文字づつ確認する
    dp[0] = 1;
    for(int i = 0 ; i < s.size() ; i++) {
        if( dp[i] == true ) {
            for(string tmp : divide) {
                string next = s.substr(i, tmp.size());
                if( next == tmp ) dp[i+next.size()] = true;
            }
        }
    }
    if( dp[s.size()] ) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

typedef long long int ll;
#define lp(a,b) for(int a=0;a<b;a++)
#define lp1(a,b) for(int a=1;a<=b;a++)
#define lp2(a,b) for(int a=2;a<=b;a++)
#define lp11(a,b) for(int a=1;a<b;a++)
#define pb push_back 
#define mp make_pair 

//-----------------------------------------------------------------------------------------------------------------------
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll a,b,c;
	cin >> a >> b >> c;
	cout << c << " ";
	cout << a << " ";
	cout << b;
}


Measured memory_bytes: 256
import numpy as np
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
d = np.zeros(N+1, dtype = 'int32')
t = 0
f = 0

for i in range(M):
    tmp = input().split()
    p = int(tmp[0])
    S = tmp[1]
    dp = d[p]
    if S == 'AC':
        if dp != -1:
            f += dp
            d[p] = -1
            t += 1
    elif dp != -1:
        d[p] += 1
print(t, f)


Measured memory_bytes: 12852
#include <iostream>

using namespace std;

bool arr[101]{};

int main() {
	for(int i = 0; i <= 100; i+=4) arr[i] = true;
	for(int i = 0; i <= 100; i++) {
		if(arr[i]){
			for(int j = 0; i+j<=100 && j<=21; j+=7) {
				arr[i+j] = true;
			}
		}
	}
	int a;
	cin >> a;
	cout << ((arr[a])?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

void solve(void){
    int x,a;
    cin >> x >> a;
    if(x < a) cout << 0 << endl;
    else cout << 10 << endl;

}

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

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

import math

ans = 0
for n in range(1, N+1):
    continue_num = max(math.ceil(math.log(K, 2) - math.log(n, 2)), 0)
    ans += (1/N) * (1/2)**continue_num
    
print(ans)

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

int main(){
  int a, b, c, d, count=0, i=1;
  cin >> a >> b >> c;
  while(1){
    d = c / i;
    if(d < a) break;
    if(c % i == 0){
      if(a <= d && d <= b) count += 1;
    }
    i += 1;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3096
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

  

int main() {
  long long wari = 1000000007;
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
  }
  else if (n == 2) {
    cout << 2 << endl;
  }
  else { 
    long long now;
    long long n10, n9, n8;
    n10 = 1000;
    n9 = (-2)*9*9*9;
    n8 = 512;
    now = n10 + n9 + n8;
    for (long long i = 4; i <n+1; i++) {
      n10 = (n10 * 10)%wari;
      n9 = (n9 * 9)%wari;
      n8 = (n8 * 8)%wari;
      now = n10 + n9 + n8;
      now = now%wari;
    }
    if (now < 0) {
       cout << now + wari << endl;
    }
    else {
      cout << now << endl;
    }
  }
  //cout << pow(10, 5) - 2*pow(9, 5) + pow(8, 5) << endl;
}
      
      
      
      
    
  
 



Measured memory_bytes: 3540
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		if ( s.charAt(0)!=s.charAt(1) || s.charAt(1)!=s.charAt(2) ) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define int long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>

map<int,int> mp;

signed main(){
	
	int a,b,c,d;cin>>a>>b>>c>>d;
	
	rep(i,c-a) cout << "R";
	rep(i,d-b) cout << "U";
	rep(i,c-a) cout << "L";
	rep(i,d-b) cout << "D";
	cout << "D";
	rep(i,c-a+1) cout << "R";
	rep(i,d-b+1) cout << "U";
	cout << "L";
	cout << "U";
	rep(i,c-a+1) cout << "L";
	rep(i,d-b+1) cout << "D";
	cout << "R";
	
}

//cout << ans << endl;

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

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

int main(){

  int n; cin>> n;
  using i64=long long;
  vector<i64> a(n);
  rep(i, n) cin>> a[i];

  vector<i64> sub(n+1, 0LL);
  rep(i, n) sub[i+1]=sub[i]+a[i];

  auto f=[&](i64 p, i64 q, i64 r, i64 s){
    i64 ret=max({p, q, r, s})-min({p, q, r, s});
    return ret;
  };

  i64 mn=1e18;
  for(int i=2; i+1<n; i++){
    i64 sl=sub[i], sr=sub[n]-sub[i];
    int j=(int)(upper_bound(sub.begin(), sub.end(), sl/2)-sub.begin());
    int k=(int)(upper_bound(sub.begin(), sub.end(), sub[i]+sr/2)-sub.begin());
    rep(t, 2)rep(u, 2) mn=min(mn, f(sub[j-t], sub[i]-sub[j-t], sub[k-u]-sub[i], sub[n]-sub[k-u]));
  }
  cout<< mn<< endl;
  return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
using namespace std;

const int N = 100500;

char buf[N];

int main() {
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);
    scanf("%s", buf);
    int ca = 0, cb = 0;
    for (int i = 0; i < n; i++) {
        if (buf[i] == 'c') {
            puts("No");
        } else if (buf[i] == 'a') {
            if (ca + cb < a + b) {
                ca++;
                puts("Yes");
            } else {
                puts("No");
            }
        } else if (buf[i] == 'b') {
            if (ca + cb < a + b && cb < b) {
                cb++;
                puts("Yes");
            } else {
                puts("No");
            }
        }
    }
}


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

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){

		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;

		double d = sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) );

		if( ra+rb < d )
			cout << 0 << endl;
		else if( d+rb < ra )
			cout << 2 << endl;
		else if( d+ra < rb )
			cout << -2 << endl;
		else
			cout << 1 << endl;

	}
	return 0;
}

Measured memory_bytes: 0
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	int N;
	int[]x;
	int[]y;
	int INF=Integer.MAX_VALUE/2;
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		x=new int[N];
		y=new int[N];
		Pair[] p1=new Pair[N];
		Pair[] p2=new Pair[N];
		
		ArrayList<Edge>[] list=new ArrayList[N];
		for(int i=0;i<N;i++){
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
			p1[i]=new Pair(i,x[i],y[i]);
			p2[i]=new Pair(i,y[i],x[i]);
			list[i]=new ArrayList<Edge>();
		}
		
		Arrays.sort(p1);
		Arrays.sort(p2);
		
		
		for(int i=0;i<N-1;i++){
				list[p1[i].id].add(new Edge(p1[i+1].id,p1[i+1].x-p1[i].x));
				list[p1[i+1].id].add(new Edge(p1[i].id,p1[i+1].x-p1[i].x));
				
				list[p2[i].id].add(new Edge(p2[i+1].id,p2[i+1].x-p2[i].x));
				list[p2[i+1].id].add(new Edge(p2[i].id,p2[i+1].x-p2[i].x));
		}
		
		//プリム法
		boolean[] used=new boolean[N];
		Queue<Edge> pq=new PriorityQueue<Edge>();
		pq.add(new Edge(0,0));
		int total=0;
		
		while(!pq.isEmpty()){
			Edge e=pq.poll();
			if(used[e.to]){
				continue;
			}
			used[e.to]=true;
			total+=e.cost;
			
			for(Edge e2: list[e.to]){
				pq.add(e2);
			}
		}
		System.out.println(total);
		
	}
	class Pair implements Comparable<Pair>{
		int id;
		int x;
		int y;
		
		Pair(int id,int x,int y){
			this.id=id;
			this.x=x;
			this.y=y;
		}
		
		@Override
		public int compareTo(Pair o){
			return this.x-o.x;
		}
	}
	
	class Edge implements Comparable<Edge>{
		int to;
		int cost;
		
		Edge(int to, int cost){
			this.to=to;
			this.cost=cost;
		}
		@Override
		public int compareTo(Edge e){
			return this.cost-e.cost;
		}
	}
}

Measured memory_bytes: 108624
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    chutiyaap;
    int n;cin>>n;
    int a[n+10],b[n+10],c[n+10];
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i];
    for(int i=1;i<n;i++)cin>>c[i];
    int res=0;
	for(int i=1;i<=n;i++)res+=b[a[i]];
	for(int i=1;i<n;i++)
	{
		if(a[i]==n)continue;
		if(a[i]==a[i+1]-1)res+=c[a[i]];
	}
	cout<<res;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int fab(int i)
{
	int k,a[10],s=0,flag=1;
	for(k=0;i!=0;k++)
	{
		a[k]=i%10;
		i/=10;
		s++;
	}
	for(k=0;k<=s/2;k++)
	{
		if(a[k]!=a[s-k-1])
			flag=0;
	}
	return flag;
}
int main()
{
	int a,b,i=0;
	scanf("%d%d",&a,&b);
	for(;a<=b;a++)
	{
		if(fab(a))
			i++;
	}
	printf("%d\n",i);
	return 0;
}

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

using namespace std;

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

// 46786 - 106

vector<int> fin;
vector<int> fup;
vector<vector<int>> edges;

int br = 0;
int tt = 0;

void dfs(int node, int parent = -1) {
    fin[node] = tt;
    fup[node] = tt;
    ++tt;
    for (auto out : edges[node]) {
        if (out == parent) {
            continue;
        }
        if (fin[out] != -1) {
            fup[node] = min(fup[node], fin[out]);
        } else {
            dfs(out, node);
            fup[node] = min(fup[node], fup[out]);
            if (fup[out] > fin[node]) {
                ++br;
            }
        }
    }
}


void oneCase() {
   int n, m;
   cin >> n >> m;
   edges.resize(n);
   for (int i = 0; i < m; ++i) {
       int a, b;
       cin >> a >> b;
       --a;
       --b;
       edges[a].pb(b);
       edges[b].pb(a);
   }
   fin.assign(n, -1);
   fup.assign(n, -1);
   dfs(0);

   cout << br << "\n";


}


int main() {
    int t = 1;
//    cin >> t;
    while (t--) {
       oneCase();
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;

ll ar[ms];


int main()
{
    idfc;

    int n;
    cin>>n;
    int i;
    for(i=1;i<=n;i++)cin>>ar[i];
    sort(ar+1,ar+n+1);

    ll ans=0;
    ll mul=2;
    int j=n;
    int p=1;
    for(i=2;i<=n;i++)
    {
        ans+=ar[j];
        p--;
        if(!p)
        {
            p=mul;
            j--;
        }
    }
    cout<<ans;


    return 0;
}

Measured memory_bytes: 5204
#include <bits/stdc++.h>
 using namespace std; 
  int main (){
      int n,m;
      cin >> n >> m;
      vector<int> a(m*2);
      int ans=0;
      vector<int> k(n*2);
      int A[100][199];
      for(int i=0;i<n;i++){
        cin >> k.at(i);
         
           for(int j=0;j<k.at(i);j++){
             cin >> A[i][j];
         
             a.at(A[i][j])++;
              
             if(a.at(A[i][j])==n){ 
                 ans++;
                 
             }

         }
        
      }
      cout << ans << endl;
      return 0;
  }

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    int T[N];
    for (int i = 0; i < N; i++) cin >> T[i];
    sort(T, T + N);

    vector<int> div;
    for (int i = 1; i * i <= T[N - 1]; i++) {
        if (T[N - 1] % i == 0) {
            div.push_back(i);
            div.push_back(T[N - 1] / i);
        }
    }
    sort(div.begin(), div.end());

    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        int d = *lower_bound(div.begin(), div.end(), T[i]);
        if (d != T[i]) {
            ans += d - T[i];
        }
    }

    cout << ans << endl;
}


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

class Main {
	public static void main(String[] args) throws IOException {
    	Scanner sc = new Scanner(System.in);
      	int a = Integer.parseInt(sc.next());
      	int b = Integer.parseInt(sc.next());
      	if ((a * b) % 2 == 0) { System.out.println("Even"); }
      	else { System.out.println("Odd"); }
    }
}

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

int comb(int x) {

    int ret = 1;

    ret *= x * (x - 1);

    ret /= 2;

    return ret;

}

int main() {

    int x, y;

    cin >> x >> y;

    int ans = 0;

    if(x > 1)
        ans += comb(x);

    if(y > 1)
        ans += comb(y);

    cout << ans << endl;    

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> P;
static const double EPS = 1e-6;
static const double PI = acos(-1.0);

inline double cross(const P& a, const P& b)
{
  return a.real()*b.imag() - b.real()*a.imag();
}

struct line
{
  P a, b;
  line() {}
  line(const P& x, const P& y) : a(x), b(y) {}
};

struct segment
{
  P a, b;
  segment(const P& x, const P& y) : a(x), b(y) {}
  inline bool intersects(const line& ln) const
  {
    return cross(ln.b - ln.a, a - ln.a) * cross(ln.b - ln.a, b - ln.a) < EPS;
  }

  inline P intersection(const line& ln) const
  {
    const P x = b - a;
    const P y = ln.b - ln.a;
    return a + x*(cross(y, ln.a - a))/cross(y, x);
  }

  inline bool parallel(const line& ln) const
  {
    return abs(cross(ln.b - ln.a, b - a)) < EPS;
  }
};

struct polygon
{
  vector<P> ps;
  polygon() {}
  polygon(const vector<P>& v) : ps(v) {}

  inline int size() const { return ps.size(); }
  inline void push_back(const P& p) { ps.push_back(p); }
  inline P& operator[](int i) { return ps[i]; }
  inline const P& operator[](int i) const { return ps[i]; }

  polygon cut(const line& ln) const
  {
    // cut out the left-side of the line
    const int N = ps.size();
    polygon ret;
    for (int i = 0; i < N; i++) {
      const segment seg(ps[i], ps[(i+1)%N]);
      if (cross(ln.b - ln.a, ps[i] - ln.a) < EPS) {
        // ps[i] is right-side of the line
        ret.push_back(ps[i]);
        if (!seg.parallel(ln) && seg.intersects(ln)) {
          const P p = seg.intersection(ln);
          if (abs(p - ps[i]) > EPS) {
            ret.push_back(p);
          }
        }
      } else if (!seg.parallel(ln) && seg.intersects(ln)) {
        ret.push_back(seg.intersection(ln));
      }
    }
    return ret;
  }
};

int main()
{
  int N;
  while (scanf("%d", &N) != EOF && N != 0) {
    polygon poly;
    for (int i = 0; i < N; i++) {
      int x, y;
      scanf("%d %d", &x, &y);
      poly.push_back(P(x, y));
    }

    polygon ans = poly;
    for (int i = 0; i < N; i++) {
      ans = ans.cut(line(poly[(i+1)%N], poly[i]));
    }
    printf("%d\n", !ans.ps.empty());
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int b[2005][2005];
int w[2005][2005];

int bsum2d(int y1,int x1,int y0,int x0){
    return b[y1][x1]-b[y1][x0]-b[y0][x1]+b[y0][x0];
}
int wsum2d(int y1,int x1,int y0,int x0){
    return w[y1][x1]-w[y1][x0]-w[y0][x1]+w[y0][x0];
}


int main(){
    int n,k;cin>>n>>k;
    int bnum,wnum;
    bnum=wnum=0;
    rep(i,n){
        int x,y;cin>>x>>y;
        char c;cin>>c;
        if(c=='B'){
            b[y%(2*k)+1][x%(2*k)+1]++;bnum++;
        }
        else{
            w[y%(2*k)+1][x%(2*k)+1]++;wnum++;
        }
    }
    rep(i,2*k+1) rep(j,2*k){
        b[i][j+1]+=b[i][j];
        w[i][j+1]+=w[i][j];
    }
    rep(i,2*k) rep(j,2*k+1){
        b[i+1][j]+=b[i][j];
        w[i+1][j]+=w[i][j];
    }
    int ans=0;
    rep(i,k){
        rep(j,k){
            int meetw=0;
            int badb=0;
            meetw+=wsum2d(i,j,0,0);
            meetw+=wsum2d(k+i,k+j,i,j);
            meetw+=wsum2d(i,2*k,0,k+j);
            meetw+=wsum2d(2*k,j,k+i,0);
            meetw+=wsum2d(2*k,2*k,k+i,k+j);
            badb+=bsum2d(i,j,0,0);
            badb+=bsum2d(k+i,k+j,i,j);
            badb+=bsum2d(i,2*k,0,k+j);
            badb+=bsum2d(2*k,j,k+i,0);
            badb+=bsum2d(2*k,2*k,k+i,k+j);
            chmax(ans,max(meetw+bnum-badb,badb+wnum-meetw));
        }
    }
    cout<<ans<<endl;
}





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

#define pb push_back
#define ppp pop_back
#define pii pair<int,int>
#define fi first
#define se second

const int N = 1e5 + 5;
const int p = 1e9 + 7;

vector<int> g[N];
ll dp[N][2];
bool used[N];

void mult(ll &a, ll b) {
	a = (a * b) % p;
}

void dfs(int v) {
	used[v] = 1;
	dp[v][0] = dp[v][1] = 1;
	for (int u : g[v]) {
		if (!used[u]) {
			dfs(u);
			mult(dp[v][0], dp[u][1]);
			mult(dp[v][1], (dp[u][0] + dp[u][1]) % p);
		}
	}
}		
		
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n;
	cin >> n;
	for (int i=1; i<=n; i++) used[i] = 0;
	for (int i=1; i<=n-1; i++) {
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}
	dfs(1);
	ll ans = (dp[1][0] + dp[1][1]) % p;
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 11520
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>

int fn(int x,int y,int z)
{
    return x*x+y*y+z*z+x*y+y*z+z*x;
}



int main(void)
{
    int n;
    cin>>n;
    
 
    for(int i=1;i<=n;i++)
    {
        bool f= false;
        int ans =0;
        for(int x=1;x*x<=n;x++)
        {
            if(f) break;

            for(int y=1;y<=x;y++)
            {
                if(f) break;
                for(int z=1;z<=y;z++)
                {
                    if(f) break;

                    
                    
      
                    int now =fn(x,y,z);

                    

                    if(now==i)
                    {
                        if(x==y&&y==z) ans++;
                        else if(x!=y&&y!=z&&z!=x) ans = ans +6;
                        else ans +=3;
                    }


                }
            }
        }

            
    

        cout<<ans<<endl;
    }



}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,k,s;
cin>>n>>k>>s;
long long a[n];
for(long long i=0;i<k;i++){
  a[i]=s;
}

if(s==1000000000){
  for(long long i=k;i<n;i++){
    a[i]=s-1;
  }
}
else{
  for(long long i=k;i<n;i++){
    a[i]=s+1;
  }
}
for(long long i=0;i<n;i++){
  if(i==n-1){
    cout<<a[i]<<endl;
  }
  else{
    cout<<a[i]<<' ';
  }
}

  return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};



int main()
{
    int n,w;
    ll w1,ans=0;
    cin>>n>>w;
    vector<ll> v[4];
    ll imos[4][110];
    m0(imos);
    
    for(int i = 0; i < n; i++)
    {
        int ww,vv;
        cin>>ww>>vv;
        if(i==0) 
        {
            w1=ww;
        }
        v[ww-w1].push_back(vv);
    }
    
    for(int i = 0; i < 4; i++)
    {
        sort(all(v[i]));
        reverse(all(v[i]));
    }
    
    for(int i = 0; i < 4; i++)
    {
        imos[i][0]=0;
        for(int j = 0; j < v[i].size(); j++)
        {
            imos[i][j+1] = imos[i][j]+v[i][j];
        }
        
    }
    

    
    ll tmp = 0;
    for(ll i = 0; i <= v[0].size(); i++)
    {
        for(ll j = 0; j <= v[1].size(); j++)
        {
            for(ll k = 0; k <= v[2].size(); k++)
            {
                for(ll l = 0; l <= v[3].size(); l++)
                {
                    if(w>=w1*i+(w1+1)*j+(w1+2)*k+(w1+3)*l)
                    {
                        ll tmp = imos[0][i]+imos[1][j]+imos[2][k]+imos[3][l];
                        ans=max(ans,tmp);
                    }                    
                }
                
            }            
        }
    }
    
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
package main
 
import ("fmt"
        "sort")
func main(){
var a,b int
  fmt.Scanf("%d %d",&a,&b)
  s:=[]int{
  a+b,
    a-b,
    a*b,
  }
  sort.Ints(s)
  fmt.Println(s[2])
 
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(H.begin(), H.end());

    auto f = [&](ll x) {
        ll damage = B * x;
        ll cnt = 0;
        ll add = A - B;
        rep(i, N) {
            ll h = H[i];
            h -= damage;
            if (h > 0) {
                cnt += (h + add - 1) / add;
            }
        }
        return cnt <= x;
    };

    ll ok = (MOD + B - 1) / B;
    ll ng = 0;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        if (f(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll a,b,x;cin>>a>>b>>x;
    if(a==0&&b==0){
        cout<<1<<endl;
        return 0;
    }
    if(a==0){
        cout<<b/x+1<<endl;
        return 0;
    }
    cout<<b/x-(a-1)/x<<endl;
    //cout<<-1/5<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





























Measured memory_bytes: 256