akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			String[] split = str.split(" ",0);
			int a = Integer.parseInt(split[0]);
			int b = Integer.parseInt(split[1]);
			int c = Integer.parseInt(split[2]);

			if (a < b && b < c) {
				System.out.println("Yes");
			} else { 
				System.out.println("No");
			}
		} catch (Exception e) {
			System.out.println("??¨??????");
		}
	}
}

Measured memory_bytes: 24336
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int n;
vector<int> A, C;
void solve();
int ans = 0;

int main() {
  cin >> n;
  A.resize(n);
  C.resize(n - 1);
  rep(i, n) {
    cin >> A[i];
    // make A 0-indexed
    A[i]--;
  }
  rep(i, n) {
    int b;
    cin >> b;
    ans += b;
  }
  rep(i, n - 1) { cin >> C[i]; }

  solve();
}

void solve() {
  rep(i, n - 1) {
    if (A[i] + 1 == A[i + 1]) {
      int menu = A[i];
      ans += C[menu];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N,X = (int(x) for x in input().split())

b_num_arr = [1]
p_num_arr = [1]
for i in range(1, 51):
    b_num_arr.append(b_num_arr[-1]*2+3)
    p_num_arr.append(p_num_arr[-1]*2+1)


def burger_eat(n, x):
    if x == 0:
        return 0
    if n == 0:
        return 1
    x -= 1
    if x < b_num_arr[n-1]:
        return burger_eat(n-1, x)
    pre_eat = p_num_arr[n-1]
    x -= b_num_arr[n-1]
    if x == 0:
        return pre_eat
    x -= 1
    pre_eat += 1
    return pre_eat + burger_eat(n-1, x)

ans = burger_eat(N, X)

print(ans)


Measured memory_bytes: 3064
n,m=map(int,input().split())
x=list(map(int,input().split()))
x=sorted(x)
a=[]
ans=0
if m==1:
    print(0)
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    a=sorted(a)
    for i in range(m-n):
        ans+=a[i]
    print(ans)

Measured memory_bytes: 13968
#include <iostream>
using namespace std;
#include <stdlib.h>
#include <math.h>

int main (void){
	char s[3];
	int x=0;
	cin >> s;
	for(int i=0;i<=2;i++) if(s[i]=='1') x++;
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define md 1000000007
#define itn int
#define pb push_back
#define mp make_pair
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define all(x) x.begin(),x.end()
#define x first	
#define lb lower_bound
#define ub upper_bound
#define y second
#define sz(x) (int)x.size()
#define inf 1e9
#define endl '\n'
#define cuot cout
#define dbs long double
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cerr<<*it<<" ";cerr<<endl;
#define linf 1e18
#define reset(x) memset(x,0,sizeof(x))
#define rep(i,a,b) for(int i=a;i<b;i++)
#define eps 1e-12
#define randomize srand(chrono::steady_clock::now().time_since_epoch().count());
	

void fastio(){	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
 
 
void solve(){
	ll k;cin>>k;
	ll a,b;cin>>a>>b;
	ll x = (a+k-1)/k;
	x*=k;
	if(x>b){
		cout<<"NG"<<endl;
	}
	else
		cout<<"OK"<<endl;
}
 
int main(){
	fastio();
	#ifndef ONLINE_JUDGE 
  
    // For getting input from input.txt file 
    freopen("in.txt", "r", stdin); 
  
    // Printing the Output to output.txt file 
    freopen("out.txt", "w", stdout); 
  
	#endif 
	int t;	
	t=1;
	//cin>>t;
	for(int i=1;i<=t;i++){	
		// cout<<"Case #"<<i<<": ";
		solve();
	}	
	return 0;
}	

Measured memory_bytes: 3668
package main

import "fmt"

const mod = 2019

func main() {
	var l, r int
	fmt.Scan(&l, &r)

	min := 2020 * 2020
	for i := l; i <= r; i++ {
		for j := i + 1; j <= r; j++ {
			if v := (i % mod) * (j % mod) % mod; v == 0 {
				fmt.Println(0)
				return
			} else if v < min {
				min = v
			}
		}
	}
	fmt.Println(min)
}


Measured memory_bytes: 512
///A drunk man will find his way home, but a drunk bird may get lost forever...i
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair <int, int> pii;
#define pb push_back
#define pf push_front
#define f first
#define s second
#define sz(x) (int)x.size()
#define smin(x , y) x = min(x , y)
//const int mx = 1000 * 100 + 5;
int32_t main(){		
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	cout << (a * b) / __gcd(a , b) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,cn=0;cin>>n;
vector<int> arr;
for(int i=0;i<n;i++){
        cin>>a;
    arr.push_back(a);
}
vector<int>mini;
for(int i=1;i<n;i++){
    if(arr[i]<=arr[i-1])
        cn++;
    else{
        mini.push_back(cn);
        cn=0;
    }
}
mini.push_back(cn);
sort(mini.begin(),mini.end());
cout<<mini[mini.size()-1];
}


Measured memory_bytes: 1400
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
        }

        System.out.println(solve(N, A, B) ? YES : NO);
    }

    private static boolean solve(int N, int[] A, int[] B) {
        Job[] job = new Job[N];
        for (int i=0; i<N; i++) {
            job[i] = new Job(A[i], B[i]);
        }

        Arrays.sort(job, new Comparator<Job>() {
            public int compare(Job o1, Job o2) {
                return o1.B - o2.B;
            }
        });

        int time = 0;
        for (int i=0; i<N; i++) {
            if (time <= job[i].B - job[i].A) {
                time += job[i].A;
            } else {
                return false;
            }
        }

        return true;
    }

    public static class Job {
        public int A;
        public int B;
        public Job(int a, int b) {
            this.A = a;
            this.B = b;
        }
    }
}

Measured memory_bytes: 96260
N = int(input())
D = {"AC":0,"WA":0,"TLE":0,"RE":0}
for n in range(N):
    D[input()] += 1
print("AC x "+str(D["AC"]))
print("WA x "+str(D["WA"]))
print("TLE x "+str(D["TLE"]))
print("RE x "+str(D["RE"]))

Measured memory_bytes: 9196
//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g PROGRAM -o OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
    if (!y)
        return x;
    return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;


inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

vector<string> split(char d,string s)
{
    stringstream ss(s);
    string t;
    vector<string> words;
    while(getline(ss,t,d))
    {
        words.pb(t);
    }

    return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
    auto start = chrono::high_resolution_clock::now();
#endif
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;
    if(n>=400 && n<=599)
        cout << "8";
    else if(n>=600 && n<=799)
        cout << "7";
    else if(n>=800 && n<=999)
        cout << "6";
    else if(n>=1000 && n<=1199)
        cout << "5";
    else if(n>=1200 && n<=1399)
        cout << "4";
    else if(n>=1400 && n<=1599)
        cout << "3";
    else if(n>=1600 && n<=1799)
        cout << "2";
    else
        cout << '1';

#ifdef LOCAL
    auto end = chrono::high_resolution_clock::now();
    double time_taken =
        chrono::duration_cast<chrono::nanoseconds>(end - start).count();

    time_taken *= 1e-9;

    cerr << "\nTime taken by program is : " << fixed
         << time_taken << setprecision(9);
    cerr << " sec" << endl;
#endif
    return 0;
}


Measured memory_bytes: 3672
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int k = Integer.parseInt(sa[1]);
		br.close();

		long cnt = 0;
		for (int i = 1; i <= 11; i++) {
			for (int j = 1; j <= 5; j++) {
				int sum = 0;
				int base = 7 * i + j - 7;
				for (int x = 0; x < 3; x++) {
					for (int y = 0; y < 3; y++) {
						sum += base + 7 * x + y;
					}
				}
				if (sum % 11 == k) {
					cnt++;
				}
			}
		}
		n -= 2;
		long ans = n / 11 * cnt;
		n %= 11;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= 5; j++) {
				int sum = 0;
				int base = 7 * i + j - 7;
				for (int x = 0; x < 3; x++) {
					for (int y = 0; y < 3; y++) {
						sum += base + 7 * x + y;
					}
				}
				if (sum % 11 == k) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n;
map<int, int> mp;

int main() {
	cin >> n;
	inc(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	
	int ans = 0;
	dec1(i, 30) {
		RFOR(it, mp) {
			int v = it -> FI, w = (1 << i) - v;
			if(! inID(v, 1 << (i - 1), 1 << i)) { continue; }
			assert(w <= v);
			int x = (v == w ? mp[v] / 2 : min(mp[v], mp[w]));
			ans += x;
			mp[w] -= x;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 64256
import java.util.Scanner;

public class Main{
    public static void main(String[] Args){
        Scanner sc=new Scanner(System.in);
        for(int i=1;;i++){
            int x=sc.nextInt();
            if(x==0){
                break;
            }
            System.out.println("Case "+ i +": "+ x);
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> ans(n);
    rep(i,n) ans[a[i]-1] = i+1;
    rep(i,n){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
using namespace std;
#define inRange(x,a,b) (a <= x && x <= b)

int main(){
    int d, n;
    cin >> d >> n;
    vector<int> t(d);
    for(int i = 0; i < d; i++)  cin >> t[i];
    vector<int> a(n), b(n), c(n);
    for(int i = 0; i < n; i++)  cin >> a[i] >> b[i] >> c[i];
    vector<vector<int>> dp(d, vector<int>(n, 0));
    for(int i = 0; i < d-1; i++){
        for(int j = 0; j < n; j++){
            if(!inRange(t[i], a[j], b[j]))  continue;
            for(int k = 0; k < n; k++){
                if(!inRange(t[i+1],a[k],b[k]))  continue;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + abs(c[j]-c[k]));
            }
        }
    }
    int ans = 0;
    for(int k = 0; k < n; k++)  ans = max(ans, dp[d-1][k]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b) swap(a, b);
    if(a > c) swap(a, c);
    if(b > c) swap(b, c);
    if(a == b && b != c || a != b && b == c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int n, q, x, y;
int main() {
  scanf("%d%d", &n, &q);
  while (q--) {
    scanf("%d%d", &x, &y);
    if (n == 1) {
      printf("%d\n", x < y ? x : y);
      continue;
    }
    --x;
    --y;
    while (x != y) {
      if (x > y) x = (x - 1) / n;
      else y = (y - 1) / n;
    }
    printf("%d\n", x + 1);
  }
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define ftype  long double
#define endl '\n'
#define pr pair<ll,ll>
#define debug(x) cout<<#x<<" "<<x<<endl;
using namespace std;
ll vis1[100001]={0};
ll vis2[100001]={0};
ll vis3[100001]={0};
ll dp[100001]={0};

void bfs(ll ca,vector <ll> adj[]){
	queue <ll> cur;
	dp[ca]=0;
	cur.push(ca);
	vis3[ca]=1;
	while(!cur.empty()){
		ll c=cur.front();
		
			vector <ll> ass,ass2;
			for(auto j:adj[c])if(vis1[j]!=1){vis1[j]=1;ass.PB(j);}	
			for(auto p:ass){
				for(auto j:adj[p])
				if(vis2[j]!=1){vis2[j]=1;ass2.PB(j);}
			}		
			for(auto p:ass2){
				for(auto j:adj[p]){
					if(vis3[j]!=1){vis3[j]=1;cur.push(j);dp[j]=dp[c]+1;}
				}
			}
		cur.pop();	
		
	}
	
	
	
} 
void masterstroke(){
	ll n,k;cin>>n>>k;
	
	ll ze=sqrt(n);
	// 1 ze
	ll st[ze+1];
	ll old=ze;
	for(ll i=ze;i>=1;i--){
		st[i]=n/i-old;
		old=n/i;
	}
	ll dppre[k+1][ze+1]={0};
	ll dpnx[k+1][ze+2]={0};
	dppre[1][ze+1]=0;
	for(ll i=1;i<=ze;i++){dppre[1][i]=i;}
	for(ll i=ze;i>=1;i--){dpnx[1][i]=(dpnx[1][i+1]+st[i])%pri;}
	
	for(ll i=2;i<=k;i++){
		dppre[i][0]=0;
		for(ll j=1;j<=ze;j++){
		dppre[i][j]=dpnx[i-1][j];
		dppre[i][j]=(dppre[i][j]+dppre[i-1][ze])%pri;
		dppre[i][j]=(dppre[i][j]+dppre[i][j-1])%pri;
		}
		dpnx[i][ze+1]=0;
		for(ll j=ze;j>=1;j--)
	   {
	   dpnx[i][j]=(dppre[i-1][j]*st[j])%pri;	
	   dpnx[i][j]=(dpnx[i][j]+dpnx[i][j+1])%pri;
	   }
		
	}
	cout<<(dppre[k][ze]+dpnx[k][1])%pri<<endl;
	
	
}
int main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 ll t=1;//cin>>t;
	 for(ll i=0;i<t;i++)masterstroke();
}

Measured memory_bytes: 49920
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
typedef long long ll;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

vector<int> dp;
int N;
int calc(int n){
    ll res1,res2;
    dp[n-1]!=-1 ? res1 = dp[n-1] : res1 = calc(n-1);
    dp[n-2]!=-1 ? res2 = dp[n-2] : res2 = calc(n-2);
    return dp[n]=res1 + res2;
}
signed main () {
    scanf("%d",&N);
    dp.assign(N+1,-1);
    dp[0]=1;dp[1]=1;
    if(N-1<1){
        printf("1\n");
        return 0;
    }
    calc(N);
    printf("%d\n",dp[N]);
}


Measured memory_bytes: 3240
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }

    class Program
    {
        static void Main(string[] args) => B();

        static void B()
        {
            var s = Read();
            for (int i = s.Length-1; i > 1; i--)
            {
                if (s.Slice(0, i).Count() % 2 != 0) continue;
                var a = s.Slice(0, i);
                if (a.Slice(0, a.Length / 2) == a.Slice(a.Length / 2))
                {
                    Console.WriteLine(a.Length);
                    return;
                }
            }
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static IList<string> ReadSplit() => Read().Split().ToList();
        static IList<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
    }
}

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

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> mem(n,0);
    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int a;
            cin >> a;
            a--;
            mem[a]++;
        }
    }
    int ans = 0;
    rep(i,n){
        if(mem[i] == 0) ans++;
    }
    dunk(ans);
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(x) for(int i=last[x];i;i=e[i].next)
using namespace std;
inline ll read(){
    ll f=1,x=0;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//******head by yjjr******
const int mod=1e9+7,maxn=2e5+6;
int fac[maxn],inv[maxn],bit[maxn],B,W,sw[maxn],sb[maxn];
inline int C(int n,int k){return 1ll*fac[n]*inv[k]%mod*inv[n-k]%mod;}
inline int qpow(int x,int y){
    int re=1;
    while(y){
        if(y&1)re=(1ll*re*x)%mod;
        x=(1ll*x*x)%mod,y>>=1;
    }
    return re;
}
int main(){
    B=read(),W=read();
    fac[0]=bit[0]=inv[0]=fac[1]=inv[1]=1;
    rep(i,2,B+W)fac[i]=1ll*fac[i-1]*i%mod;
    rep(i,2,B+W)inv[i]=qpow(fac[i],mod-2);
    rep(i,1,B+W)bit[i]=1ll*bit[i-1]*inv[2]%mod;

    rep(i,W,B+W-1)sw[i]=1ll*bit[i]*C(i-1,i-W)%mod;
    rep(i,B,B+W-1)sb[i]=1ll*bit[i]*C(i-1,i-B)%mod;
    
    rep(i,1,B+W)sw[i]=(sw[i]+sw[i-1])%mod,sb[i]=(sb[i]+sb[i-1])%mod;
    rep(i,1,B+W){
        int w=(sw[i-1]+1ll*((mod+1-sw[i-1]-sb[i-1])%mod+mod)%mod*(i==B+W?1:inv[2])%mod)%mod;
        printf("%d\n",w);
    }
    return 0;
}

Measured memory_bytes: 6144
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

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

    int N;
    cin >> N;

    int len = 1;
    bool found = false;
    while (len*(len+1) / 2 <= N) {
        if (len*(len+1) / 2 == N) {
            found = true;
            break;
        }
        len++;
    }

    if (!found) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    cout << len + 1 << endl;

    vector<vector<int>> ans(len+1);

    int cur = 1;
    REP(i, len) {
        FOR(j, i+1, len) {
            ans[i].push_back(cur);
            ans[j].push_back(cur);
            cur++;
        }
    }
    REP(i, len+1) {
        cout << ans[i].size() << " ";
        REP(j, ans[i].size()) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}


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

#define MOD 1000000007

int main() {
  ll a;
  double b;
  cin >> a >> b;
  string b_str = to_string(b);

  int _b = 0;
  _b += 100 * (int)(b_str[0] - '0');
  _b += 10 * (int)(b_str[2] - '0');
  _b += (int)(b_str[3] - '0');

  ll ans = a * _b;

  ans /= 100;

  cout << ans << endl;
}


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

using namespace std;
int n, m, cnt, k;

int main(){
	int n; cin >> n;
	bool color[8] = { 0 };
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		int s; cin >> s;
		s /= 400;
		if (s < 8) color[s] = true;
		else cnt++;
	}
	int cnt_c = 0;
	for (int i = 0; i < 8; ++i) if (color[i]) cnt_c++;
	cout << max(1, cnt_c) << " " << cnt_c + cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
#define N 200012
int n,a[N],las=0;bool vis[N];long long ans=0;
int main(){
	scanf("%d",&n);int i,l,r,lef;bool fl=true;
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i=r+1)
	{
		l=r=i;while((r<n)&&(a[r+1]==(a[r]+1)))++r;
		lef=l-a[l];if(lef<=las){printf("-1");fl=false;break;}
		ans+=r-lef;las=lef;
	}if(fl)printf("%lld",ans);return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
    int L, R, d;
    cin >> L >> R >> d;
    int i, cnt = 0;
    for (i = L; i <= R; i++)
    {
        if (i % d == 0)
        {
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define str string
int main(){
    int A=0,B=0,N;
    str S;
    cin>>N>>S;
    for(int i=0;i<N;i++){
        if(S.at(i)=='R') A+=1;
        else B+=1;
    }
    if(A>B)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
from collections import deque

def main():
    n = input()
    A = deque(map(int,raw_input().split()))
    q = input()
    M = map(int,raw_input().split())

    p = rec([0],A)

    for m in M:
        if m in p:
            print "yes"
        else:
            print "no"

def rec(a,A):
    if len(A) == 0:
        return a
    else:
        y = A.popleft()
        a = a+[x+y for x in a]
        return rec(a,A)

if __name__ == "__main__":
    main()

Measured memory_bytes: 48896
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i mode acc =
        if i = n then acc else
            match mode with
            | 0 -> if a.(i) <  a.(i - 1) then loop (i + 1) (-1) acc else
                   if a.(i) >  a.(i - 1) then loop (i + 1) (+1) acc else
                                              loop (i + 1) mode acc
            | 1 -> if a.(i) >= a.(i - 1) then loop (i + 1) mode acc else
                                              loop (i + 1) 0 (acc + 1)
            | _ -> if a.(i) <= a.(i - 1) then loop (i + 1) mode acc else
                                              loop (i + 1) 0 (acc + 1)
    in
    loop 1 0 1 |> Printf.printf "%d\n"
)

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

#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#endif


const int MAXN = 100;
//#define int long long
const int INF = 1e9;

signed main()
{
    #ifdef FILEIO
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    int ans = 0;
    vector<vector<int>> g(n);
    vector<int>h(n);
    for (int i =0 ; i < n; i++) cin >> h[i];

    for (int i = 0; i < m; i++){
      int a, b;
      cin >> a >> b;
a--, b--;
      g[a].eb(b);
      g[b].eb(a);

    }

    for (int i = 0; i < n; i++){
      int f = 1;
      for (auto j : g[i]){
        if (h[i] <= h[j]) f = 0;
      }
      ans += f;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 8776
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let ab = Array.to_list @@ Array.init n @@ fun _ -> Scanf.sscanf (read_line ()) "%d %d" @@ fun a b -> (a, b)
let ab = List.sort (fun (a, b) (c, d) -> (c + d) - (a + b)) ab

type next = T | A

let rec loop sum_t sum_a next rest = match (next, rest) with
  | (_, []) -> sum_t - sum_a
  | (T, (a, _) :: xs) -> loop (sum_t + a) sum_a A xs
  | (A, (_, b) :: xs) -> loop sum_t (sum_a + b) T xs

let () = Printf.printf "%d\n" @@ loop 0 0 T ab

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

// Returns sum of arr[0..index]. This function assumes
// that the array is preprocessed and partial sums of
// array elements are stored in BITree[].
long long getSum(long long BITree[], long long index)
{
    long long sum = 0; // Initialize result

    // Traverse ancestors of BITree[index]
    while (index > 0)
    {
        // Add current element of BITree to sum
        sum += BITree[index];

        // Move index to parent node in getSum View
        index -= index & (-index);
    }
    return sum;
}

// Updates a node in Binary Index Tree (BITree) at given index
// in BITree.  The given value 'val' is added to BITree[i] and
// all of its ancestors in tree.
void updateBIT(long long BITree[], long long n, long long index, long long val)
{
    // Traverse all ancestors and add 'val'
    while (index <= n)
    {
       // Add 'val' to current node of BI Tree
       BITree[index] += val;

       // Update index to that of parent in update View
       index += index & (-index);
    }
}

// Returns inversion count arr[0..n-1]
long long getInvCount(long long arr[], long long n)
{
    long long invcount = 0; // Initialize result

    // Find maximum element in arr[]
    long long maxElement = 0;
    for (long long i=0; i<n; i++)
        if (maxElement < arr[i])
            maxElement = arr[i];

    // Create a BIT with size equal to maxElement+1 (Extra
    // one is used so that elements can be directly be
    // used as index)
    long long BIT[maxElement+1];
    for (long long i=1; i<=maxElement; i++)
        BIT[i] = 0;

    // Traverse all elements from right.
    for (long long i=n-1; i>=0; i--)
    {
        // Get count of elements smaller than arr[i]
        invcount += getSum(BIT, arr[i]-1);

        // Add current element to BIT
        updateBIT(BIT, maxElement, arr[i], 1);
    }

    return invcount;
}
long long a[100009];
long long f[100009];
long long X[100009];
long long s[100009];
main(){
    long long n;
    cin >> n;
    for(long long i = 1; i <= n; i++)
        cin >> a[i];
    long long lo = 0, hi = 1e9;
    while(lo  < hi){
        long long mid = (lo + hi)/2;
        for(long long i = 1; i <= n; i++)
            if(a[i] <= mid) f[i] = 0;
        else f[i] =  1;
        for(long long i = 1; i <= n; i++)
            s[i] = s[i-1] + f[i];
        for(long long i = 0; i <= n; i++){
            X[i] = 2*s[i] -i+n+1;
        }
        long long H = getInvCount(X, n+1);
        if(H >= (n*(n+1)/2)/2+1) hi = mid;
        else lo = mid + 1;

    }
    cout<<lo<<endl;
}


Measured memory_bytes: 4992
N=int(input())
S=[input() for i in range(N)]
ans=0
for k in range(N):
    flag=1
    for i in range(N):
        for j in range(N):
            if S[(i+k)%N][j]!=S[(j+k)%N][i]:
                flag=0
                break
        if flag==0:
            break
    if flag==1:
        ans+=N
print(ans)


Measured memory_bytes: 41584
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

    int a[31]={0};
    int b;
    for(int i=1;i<=28;i++){
        cin>>b;
        a[b]=1;
    }
    for(int i=1;i<=30;i++){
        if(a[i]==0)cout<<i<<endl;
    }


	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    bool f=true;
    if(A<C && C<B){
        f=false;
    }
    if(B<C && C<A){
        f=false;
    }
    if(f) cout << "No" << endl;
    else  cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
n,y = gets.split.map(&:to_i)
y /= 1000

# a + b + c = n
# 10a + 5b + c = y
(0..y/5).each do |j|
    (0..y/10).each do |i|
        c = y - (10 * i + 5 * j )
        # p( [i,j,c])
        break if c < 0
        if i + j + c == n
            puts [i,j,c] * " "
            exit
        end
    end
end

puts "-1 -1 -1"

Measured memory_bytes: 1788
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    h, w = list(map(int, input().rstrip('\n').split()))
    s = [list(str(input().rstrip('\n'))) for _ in range(h)]
    ql = [[0, 0, 0]]
    ql = collections.deque(ql)
    fq = collections.defaultdict(list)
    fq[0, 0]
    mt = 10 ** 10
    while True:
        if len(ql) != 0:
            cost, xv, yv = ql.popleft()
            if xv == h - 1 and yv == w - 1:
                mt = min(mt, cost)
            for xv, yv in [[xv + 1, yv], [xv - 1, yv], [xv, yv + 1], [xv, yv - 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if (xv, yv) not in fq and s[xv][yv] != "#":
                        ql.append([cost + 1, xv, yv])
                        fq[xv, yv]
        else:
            break
    if mt == 10 ** 10:
        print(-1)
    else:
        cnt = 0
        for i in range(h):
            cnt += s[i].count("#")
        print(h * w - cnt - (mt + 1))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 40944
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>

using namespace std;

#define INF 1000000000
#define EPS 1e-9
#define PI (atan(1.0) * 4.0)

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

#define MAX_M 16
#define MAX_N 20000

int N, M;
int C[MAX_M];
int x[MAX_N];

ll dp[MAX_N+1][256];

vector<int> ans_list;

int main(){

	while (true){

		cin >> N >> M;

		if (N == 0 && M == 0)
			break;

		for (int i = 0; i < M; i++){
			cin >> C[i];
		}

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

		for (int i = 0; i < N + 1; i++){
			for (int j = 0; j <= 255; j++){
				dp[i][j] = INF;
			}
		}

		dp[0][128] = 0;

		for (int i = 0; i < N; i++){
			for (int j = 0; j <= 255; j++){
				for (int m = 0; m < M; m++){
					if (j + C[m] < 0){
						dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + (0 - x[i])*(0 - x[i]));
					}
					else if (j + C[m] > 255){
						dp[i + 1][255] = min(dp[i + 1][255], dp[i][j] + (255 - x[i])*(255 - x[i]));
					}
					else
						dp[i + 1][j + C[m]] = min(dp[i + 1][j + C[m]], dp[i][j] + (j + C[m] - x[i])*(j + C[m] - x[i]));
				}
			}
		}

		ll ans = INF;
		for (int i = 0; i <= 255; i++){
			ans = min(ans, dp[N][i]);
		}

		ans_list.push_back(ans);

	}

	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 41296
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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 (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	ll n;
	cin >> n;
	vector<ll> a(n);
	map<ll, ll> aa;
	rep(i, n)
	{
		cin >> a[i];
		aa[a[i] - i - 1]++;
	}

	ll ans = 0;
	rep(i, n)
	{
		ans += aa[-1 * (a[i] + i + 1)];
	}
	cout << ans << endl;


	return 0;
}

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

int main () {
  int n, a;
  cin >> n >> a;
  vector<int> b(n);
  for(int i = 0; i < n; ++i) {
    cin >> b.at(i);
  }
  sort(b.begin(), b.end());

  int count = 0;
  int sum = 0;
  for(int i = 0; i < n; ++i) {
    sum += b.at(i);
    if (sum > a) {
      break;
    }
    if (i == n-1 and sum != a){
      break;
    }
    count++;
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint A, B; cin >> A >> B;
    if (A <= 9 and B <= 9) {
        cout << A * B << "\n";
    } else {
        cout << -1 << "\n";
    }
}

Measured memory_bytes: 256
import copy
N, M, Q = map(int, input().split())
li = []
for i in range(Q):
    li.append(list(map(int, input().split())))

def point(hai):
    hai.reverse()
    point = 0
    for i in range(Q):
        if hai[li[i][1]-1] - hai[li[i][0]-1] == li[i][2]:
            point += li[i][3]

    return point


def tansa(hai):
    global maxnum
    if len(hai) == 0:
        maxnum2 = M
    else:
        maxnum2 = hai[-1]
    for i in range(1, maxnum2+1):
        haicpy = copy.copy(hai)
        hai.append(i)
        if len(hai) == N:
            num = point(copy.copy(hai))
            if maxnum < num:
                maxnum = num
        else:
            tansa(copy.copy(hai))
        hai = haicpy


maxnum = 0
hai = []
tansa(hai)
print(maxnum)

Measured memory_bytes: 77896
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  char s[MAX];
  scanf("%s", s);
  int ans;
  if (strcmp(s, "SAT") == 0) ans = 6;
  else if (strcmp(s, "SUN") == 0) ans = 0;
  else if (strcmp(s, "MON") == 0) ans = 1;
  else if (strcmp(s, "TUE") == 0) ans = 2;
  else if (strcmp(s, "WED") == 0) ans = 3;
  else if (strcmp(s, "THU") == 0) ans = 4;
  else if (strcmp(s, "FRI") == 0) ans = 5;

  printf("%d\n", 7 - ans);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        int l = S.length();
        String[] s = new String[l-2];
        int[] sn = new int[l-2];
        int min = 753;

        for(int i=0; i<l-2; i++){
            s[i] = S.substring(i, i+3);
            sn[i] = Integer.parseInt(s[i]);
            min = Math.min(min, Math.abs(sn[i]-753));
        }
        System.out.println(min);

    }
}

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

using namespace std;

#define endl '\n'

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

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;

#define BLACK '#'
#define WHITE '.'

void end(int answer){
	cout << answer << endl;
	exit(0);
}

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

#ifdef MARX
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif

	int n;

	while (cin >> n){
		vector<string> M(n);

		int tcol = 0, trow = 0;

		for (int i = 0; i < n; ++i){
			cin >> M[i];
		}

		bool isblack = false;

		for (int i = 0; i < n; ++i){
			bool col = false, row = false;
	
			for (int j = 0; j < n; ++j){
				if (M[i][j] == WHITE) row = true;
				else isblack = true;
				if (M[j][i] == WHITE) col = true;
			}

			tcol += col, trow += row;
		}

		if (!isblack){
			cout << -1 << endl;
			continue;
		}

		int answer = oo;

		for (int i = 0; i < n; ++i){

			int total = 0;
			bool some = 0;

			for (int j = 0; j < n; ++j){
				if (M[i][j] == WHITE) total++;
				if (M[j][i] == BLACK) some = true;
			}

			answer = min(answer, total + tcol + 1 - some);
		}

		cout << answer << endl;
	}

	return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    string s;
    cin >> s;
    map<char, bool> dic;
    for(auto c : s) {
        dic[c] = true;
    }
    REP(i, 26) {
        if(!dic['a' + i]) {
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}



Measured memory_bytes: 512
#include<stdio.h>
using namespace std;

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    int d = a / b;
    int r = a % b;
    double f = (a * 1.0) / (b * 1.0);
    printf("%d %d %f\n",d,r,f);
    return 0;
}


Measured memory_bytes: 2740
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

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

int main(){
    string s;
    ll n;
    cin >> n >> s;
    ll x = 0, a = INT_MIN;
    for(ll i=0 ; i<n ; i++){
        if(s[i] == 'I'){
            x++;
        } else {
            x--;
        }
        a = max(a, x);
    }
    a = max(a, 0ll);
    cout << a;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	public static String joinInt(int[] a, String separator) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			if (i > 0) {
				sb.append(separator);
			}
			sb.append(a[i]);
		}
		return sb.toString();		
	}

	static int[] nextIntArray(Scanner sc, int N) {
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long sum = 0;
		PriorityQueue<Integer> q = new PriorityQueue<>();
		for (int i = 0; i < N; i++) {
			int A = sc.nextInt();
			q.add(-A);
			sum += A;
		}
		for (int i = 0; i < M; i++) {
			int A = -q.poll();
			int A2 = A / 2;
			// System.out.println(sum + " " + (A - A2));
			sum -= (A - A2);
			q.add(-A2);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 60588