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

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int n = inp.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = inp.nextInt();
        }
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) {
                if (a[i] % 3 != 0 && a[i] % 5 != 0) {
                    System.out.println("DENIED");
                    return;
                }
            }
        }
        System.out.println("APPROVED");
    }
}

Measured memory_bytes: 21972
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(1, 3, 4), 4)

    def test_2(self):
        self.assertEqual(think(3, 2, 3), 5)


def solve():
    p, q, r = read()
    result = think(p, q, r)
    write(result)


def read():
    return read_int(3)


def read_int(n):
    return read_type(int, n)


def read_float(n):
    return read_type(float, n)


def read_type(t, n):
    return list(map(lambda x: t(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(p, q, r):
    return min(p + q, q + r, r + p)


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 5584
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

template <typename T>
void quit(T a)
{
    cout << a << endl;
    exit(0);
}

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 10010020030040056ll;
const int INF = 1001001001;
const double pi = acos(-1);

int main()
{
    string s;
    cin >> s;
    ll ans = 0;
    for (int i = 0; i < s.size(); i++)
    {
        ans += (s[i] - '0');
    }
    if (ans % 9 == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    int a = N%10;
    if(a == 2 || a == 4 || a == 5 || a == 7 || a == 9) cout << "hon" << endl;
    elif(a == 3) cout << "bon" << endl;
    else cout << "pon" << endl;
}

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

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

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;
}


int main(){
    long long a, b;
    cin >> a >> b;
    long long g;
    g = gcd(a, b);
    long long num = g;
    long long cnt = 0;

    for(long long i = 2; i*i <= g+1; i++){
        if(num % i != 0){
            continue;
        }

        bool first = true;
        while(num % i == 0){
            if(first == true){
                cnt++;
            }
            first = false;
            num /= i;
        }
    }

    if(num != 1){
        cnt++;
    }
    cnt++;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3580
a,b,c,d = gets.chomp.split(' ').map(&:to_i)
c_a = (a-1)/c
d_a = (a-1)/d
c_b = b/c
d_b = b/d
lcm = c.lcm(d)
lcm_a = (a-1)/lcm
lcm_b = b/lcm
puts b - a + 1 - (c_b - c_a ) - (d_b - d_a) + (lcm_b - lcm_a)

Measured memory_bytes: 14288
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		for(int i = 1; i < 100000; i++) {
			if((int)(i * 0.08) == A && (int)(i * 0.1) == B) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}


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

int main() {
	map<char,string> t;
	map<string,char> s;
	string inp,res,code;
	
	t[65]="00000";	t[66]="00001";	t[67]="00010";	t[68]="00011";
	t[69]="00100";	t[70]="00101";	t[71]="00110";	t[72]="00111";
	t[73]="01000";	t[74]="01001";	t[75]="01010";  t[76]="01011";
	t[77]="01100";	t[78]="01101";	t[79]="01110";	t[80]="01111";
	t[81]="10000";	t[82]="10001";	t[83]="10010";	t[84]="10011";	
	t[85]="10100";	t[86]="10101";	t[87]="10110";	t[88]="10111";
	t[89]="11000";	t[90]="11001";	t[32]="11010";	t[46]="11011";
	t[44]="11100";	t[45]="11101";	t[39]="11110";	t[63]="11111";
	
	s["101"]=' ';	s["000000"]='\'';	s["000011"]=',';	s["10010001"]='-';
	s["010001"]='.';	s["000001"]='?';	s["100101"]='A';	s["10011010"]='B';
	s["0101"]='C';	s["0001"]='D';	s["110"]='E';	s["01001"]='F';
	s["10011011"]='G';	s["010000"]='H';	s["0111"]='I';	s["10011000"]='J';
	s["0110"]='K';	s["00100"]='L';	s["10011001"]='M';	s["10011110"]='N';
	s["00101"]='O';	s["111"]='P';	s["10011111"]='Q';	s["1000"]='R';
	s["00110"]='S';	s["00111"]='T';	s["10011100"]='U';	s["10011101"]='V';
	s["000010"]='W';	s["10010010"]='X';	s["10010011"]='Y';	s["10010000"]='Z';
	
	while(getline(cin,inp)){
		string temp;
		int i,j;
		res="";
		code="";
		for(i=0;i<inp.length();++i){
			code += t[inp[i]];
		}
		for(i=0;i<code.length();++i){
			for(j=3;j<=8;++j){
				temp = code.substr(i,j);
				if(s.find(temp) == s.end())continue;
				res += s[temp];
				i+=j-1;
				break;
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int dp[100][10001];
vector<int> v;
int n;

int f(int i, int s) {
    if (i == n) return s%10 ? s : 0;
    int &r = dp[i][s];
    if (r != -1) return r;
    r = max(f(i+1, s+v[i]), f(i+1, s));
    return r;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    cin >> n;
    v.resize(n);
    for (auto &x : v) cin >> x;
    memset(dp, -1, sizeof(dp));
    cout << f(0, 0) << endl;
}


Measured memory_bytes: 4224
#include<iostream>
#include<algorithm>
using namespace std;
 
 
int main()
{
    int H, W;
    while (cin >> H >> W){
        if (H == 0 && W == 0){
            break;
        }
        for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <inttypes.h>

//int compare_int(const void *a, const void *b){//qsort 整数比較<
//	return *(int*)a - *(int*)b;
//}
//int compare_int2(const void *a, const void *b){//qsort 整数比較>
//	return *(int*)b - *(int*)a;
//}
//

//long long int combination(int n, int r)
//{
//	if (r == 0 || r == n)
//		return (1);
//	else if (r == 1)
//		return (n);
//	return (combination(n - 1, r - 1) + combination(n - 1, r));
//}

int main(void){
	int n;
	long long int nine=0,eigth=0,ten=0,ans=0;
	int i;

	scanf("%d",&n);
	if(n<2){
		printf("0");
		return 0;
	}else if(n==2){
		printf("2");
		return 0;
	}
	for(i=0;i<n;i++){
		if(i==0){
			nine=9;
			eigth=8;
			ten=10;
		}
		else{
			nine=nine*9%1000000007;
			eigth=eigth*8%1000000007;
			ten=ten*10%1000000007;
		}
	}
	ans=(ten+eigth-nine*2)%1000000007;
	if(ans<0){
		ans=1000000007+ans;
	}
	printf("%lld",ans);

	return 0;
}


Measured memory_bytes: 1732
///
// File:  d.go
// Author: ymiyamoto
//
// Created on Sat Jun 16 23:24:48 2018
//
package main

import (
	"fmt"
	"sort"
)

var N, M int

type cake struct {
	x, y, z int
}

func max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func main() {
	fmt.Scan(&N, &M)
	arr := make([]cake, N)
	for i := range arr {
		fmt.Scan(&arr[i].x, &arr[i].y, &arr[i].z)
	}

	var ans int64
	for i := 0; i < (1 << 4); i++ {
		s := [3]int{1, 1, 1}
		for j := uint8(0); j < 3; j++ {
			if i&(1<<j) != 0 {
				s[j] = -1
			}
		}

		a := make([]int, N)
		for j, c := range arr {

			a[j] = s[0]*c.x + s[1]*c.y + s[2]*c.z
		}
		sort.Ints(a)

		var count int64
		for i := 0; i < M; i++ {
			count += int64(a[len(a)-1-i])
		}
		ans = max(ans, count)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include<iostream>
using namespace std;
#include<queue>
#include <algorithm> 
#include<vector>
#include<unordered_map>
#include<string.h> 
#include<math.h>
#include <bits/stdc++.h> 
#define ll long long

#define  Int long long int 
Int mod ;

 
Int power(Int x,Int y,Int p){Int res=1;x=x%p;while(y>0){if(y&1){res=(res*x)%p;} y=y>>1;x=(x*x)%p;}return res;}
Int gcd(Int x,Int y){if(x==0){return y;}return gcd(y%x,x);}//o(log(min(a,b)))
Int fac[1000001];
Int modInverse(Int a,Int p){return power(a,p-2,p);}//used with feemat little

/// nCrModPFermat(Int n,Int r,Int p){if(r==0){return 1;}/* Fill factorial array so that we can find all factorial of r, n*/ return (fac[n]* modInverse(fac[r], p) % p * modInverse(fac[n-r], p) % p) % p;}
ll arr[100004];
ll dp[100004];
int main()
{	
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(ll i=2;i<n;i++)
	{
		dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]));
	}
	cout<<dp[n-1]<<endl;

}



Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        long sum = 0;
        int tmpGcd = 0;
        for (int i = 1; i <= K; i++){
            for (int j = 1; j <= K; j++){
                for (int k = 1; k <= K; k++){
                    tmpGcd = gcd(i, j);
                    sum += gcd(tmpGcd, k);
                }
            }
        }
        System.out.println(sum);

    }

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

Measured memory_bytes: 35656
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int N;
    cin >> N;
    vector<int> vc( N );
    for( auto &x : vc )
    {
        cin >> x;
    }
    int cnt{};
    while( true )
    {
        vector<int> visited( N );
        REP( j, N )
        {
            if( vc[ j ] % 2 == 0 )
            {
                visited[ j ] = 1;
            }
        }
        if( count( ALL( visited ), 1 ) == N )
        {
            cnt++;
            REP( k, N )
            {
                vc[ k ] = vc[ k ] / 2;
            }
        }
        else
        {
            break;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int H,W,i,j;
  while(1){
    scanf("%d %d",&H,&W);
    if(H == 0 && W == 0) break;
    
	for(i = 0; i < H; i++){
      for(j = 0; j < W; j++){
        printf("#");
	  }
	  printf("\n");
	}
	printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
process.stdin.resume();
process.stdin.setEncoding('utf8');

var input = '';
process.stdin.on('data', (chunk) => {
  input += chunk;
});
process.stdin.on('end', () => {
  main(input.split(/\r?\n/));
});

var main = (lines) => {
  var cs = lines[0].split(/ /);
  if(cs[0] === cs[1]) {
    if(cs[1] === cs[2]) {
      console.log('No');
    }
    else {
      console.log('Yes');
    }
  }
  else {
    if(cs[1] === cs[2]) {
      console.log('Yes');
    }
    else {
      if(cs[0] === cs[2]) {
        console.log('Yes');
      }
      else {
        console.log('No');
      }
    }
  }
}

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

int main(){
  int A, B;
  cin >> A >> B;
  int ans=-1;
  for(int i=1; i<=10000; i++){
    if(i*8/100==A && i*10/100==B){
      ans=i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	ll a, b;
	cin >> a >> b;
	cout << a * b;
}


Measured memory_bytes: 3668
N, M = map(int, input().split())
PY = [list(map(int, input().split())) for i in range(M)]
for i in range(M):
    PY[i].append(int(i))
PY.sort(key=lambda x: (x[0], x[1]))
ID = [[] for i in range(M)]
k = 1
for i in range(M):
    ID[i].append(str(PY[i][0]).zfill(6))
    ID[i].append(str(k).zfill(6))
    ID[i].append(PY[i][2])
    if i+1 == M:
        break
    if PY[i+1][0] > PY[i][0]:
        k = 1
    else:
        k += 1
ID.sort(key=lambda x: (x[2]))
for i in range(M):
    print(ID[i][0] + ID[i][1])


Measured memory_bytes: 50880
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    string s;
    cin>>s;
    string ans="AC";
    int a = s.size();
    int cnt=0;
    if(s[0]!='A') ans="WA";
    REP(i,a){
        if(isupper(s[i+1])){
            if(i+1==1||i+1==a-1||s[i+1] !='C'){
            ans = "WA";
            }
            cnt++;
        }
    }
    if(cnt!=1)ans="WA";
    cout<<ans<<endl;
}

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

public class Main {

    static int cnt = 0;

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter pw = new PrintWriter(System.out);

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

        mergeSort(A, 0, n);
        for (int i = 0; i < n-1; i++) {
            pw.print(A[i] + " ");
        }
        pw.println(A[n-1]);
        pw.println(cnt);
        pw.flush();
    }

    static void merge(int[] A, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;

        int[] L = new int[n1+1];
        int[] R = new int[n2+1];
        for (int i = 0; i < n1; i++) {
            L[i] = A[left + i];
        }
        for (int i = 0; i < n2; i++) {
            R[i] = A[mid + i];
        }
        L[n1] = Integer.MAX_VALUE;
        R[n2] = Integer.MAX_VALUE;

        int i = 0, j = 0;
        for (int k = left; k < right; k++) {
            if (L[i] <= R[j])
                A[k] = L[i++];
            else
                A[k] = R[j++];
            cnt++;
        }
    }

    static void mergeSort(int[] A, int left, int right) {
        if (left+1 < right) {
            int mid = (left + right) / 2;
            mergeSort(A, left, mid);
            mergeSort(A, mid, right);
            merge(A, left, mid, right);
        }
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

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


Measured memory_bytes: 133472
n, k = map(int, input().split())
a = list(map(int, input().split()))
num = [0]*(n+1)
for c in a :
    num[c] += 1

num.sort(reverse=True)
ans = 0

for c in num[k:] :
    if c == 0 :
        break
    ans += c

print(ans)

Measured memory_bytes: 25748
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    int n;
    cin>>n;
    int a[n],b[n];
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    int ans;
    if(n%2==1){
        ans=b[n/2]-a[n/2]+1;
    }
    else{
        ans=b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1;
    }
    cout<<ans<<endl;
}


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

using namespace std;
#define ll long long

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}

#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

int N, M;
vector<int> y;

void init()
{
	cin >> N >> M;
	for (int i = 1; i * i <= M; i++) {
		if (M % i == 0) {
			y.PB(i);
			if (i * i != M) y.PB(M / i);
		}
	}
	sort(all(y), greater<int>());
}

void solve()
{
	for (int x : y) {
		if (M / x >= N) {
			cout << x << endl;;
			return;
		}
	}
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int a[50][50];
int root[50][50];
int min(int a,int b){
  if(a<b){
    return a;
  }else{
    return b;
  }
}
int solve(int m,int n){
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      if(i==0&&j==0){
	root[i][j]=0;
      }else if(i==0){
	root[i][j]=root[i][j-1]+a[i][j];
      }else if(j==0){
	root[i][j]=root[i-1][j]+a[i][j];
      }else{
      root[i][j]=min(root[i-1][j]+a[i][j],root[i][j-1]+a[i][j]);
      }
    }     
  }
  return root[m-1][n-1];
}
  
int main(){
  int h,w;
  scanf("%d%d",&h,&w);
  char buf[w+1];
  for(int i=0;i<h;i++){
    cin>>buf;
    for(int j=0;j<w;j++){
      a[i][j]=buf[j]-'0';
    }
  }
  printf("%d\n",solve(h,w));
}

Measured memory_bytes: 3232
#include<iostream>
#include<stdio.h>
using namespace std;
int n,h[1777771];
char q[10],s[15];

int stoi(char c){
  if(c=='A')return 1;
  if(c=='G')return 2;
  if(c=='T')return 3;
  return 4;
}

int find(){
  int key=0;
  for(int i=0;s[i]!='\0';i++)key=key*4+stoi(s[i]);
  return key;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    scanf("%s %s",q,s);
    int key=find();
    if(q[0]=='i'){
      h[key%1777771]=1;
    }else{
      printf(h[key%1777771]?"yes\n":"no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 8640
INITIAL = 2 ** 31 - 1

class SegTreeMin:

    def __init__(self, V):
        # 元配列Vをセグメント木で表現する
        self.sz = len(V)
        N = 1
        while N < self.sz:
            N *= 2
        # ノードを初期化
        self.N = N
        self.node = [INITIAL] * (2 * self.N - 1)
        # ノードの最下段に元配列の値を挿入する
        for i in range(self.sz):
            self.node[i + self.N - 1] = V[i]
        # すべての段に値を挿入する
        for i in range(self.N-2,0,-1):
            self.node[i] = min(self.node[2*i+1], self.node[2*i+2])

    def update(self, x, val):
        '''
        x番目の要素をvalに更新する
        '''
        # 最下段のノードにアクセスする
        x += (self.N - 1)
        self.node[x] = val

        # 最下段のノードを更新したら、親を更新していく
        while x > 0:
            x = (x - 1) // 2
            self.node[x] = min(self.node[2*x+1], self.node[2*x+2])

    def get_min(self, a, b, k=0, l=0, r=-1):
        '''
        区間[a, b)の最小値をこたえる => 要求区間
        k := 自分がいるノードのインデックス
        [l,r)はノードがカバーする区間 => 対象区間
        '''
        # 最初に呼び出されたときのノードがカバーする区間は[0,N)
        if r < 0:
            r = self.N
        
        # 要求区間と対象区間が交わらない => 2147483647を返す
        if r <= a or l >= b:
            return INITIAL
        
        # 完全にカバーする場合
        if l >= a and r <= b:
            return self.node[k]

        # 一部分カバーする場合は子も探索する
        # 左側の子をvl 右側の子を vrとしている
        vl = self.get_min(a, b, 2*k+1, l, (l+r)//2)
        vr = self.get_min(a, b, 2*k+2, (l+r)//2, r)
        return min(vl, vr)

def main():
    n, q = map(int, input().split())
    V = [INITIAL] * n
    seg = SegTreeMin(V)

    for _ in range(q):
        com, x, y = map(int, input().split())
        if com:
            y += 1
            print(seg.get_min(x,y))
        else:
            seg.update(x,y)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9496
#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long int
int32_t main(){
    int i,n,ans=1,k,j,cnt=0;
    cin>>n;
    int a[19];
    a[0]=1;
    int b[n];
    for(i=0;i<n;i++){
        cin>>b[i];
        if(!b[i])cnt++;
    }
    for(i=1;i<=18;i++){
        a[i]=a[i-1]*10;
    }
    if(cnt){cout<<"0";return 0;}
    for(i=0;i<n;i++){
        //cin>>k;
        k=b[i];
      for(j=0;j<=18;j++){
          if(ans>a[j]&&k>=a[18-j]){cout<<"-1";return 0;}
      }
      ans*=k;
      if(ans>a[18]){cout<<"-1";return 0;}
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 4424
import sys

def get_array():
	l=list(map(int, input().split()))
	return l
def main():
	l=get_array()
	print(l.index(0)+1)













#sys.stdin = open('input.py', 'r')
#sys.stdout = open('output.py', 'w') 
if __name__ == '__main__':
    main()


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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

void init(){
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const int N = 1e3+5;

int main()
{
	init();
	string str;
	cin >> str;
	int ans = 0, siz = sz(str);
	lp(i, siz/2)
		if(str[i] != str[siz-1-i])
			++ans;
	cout << ans;

	return 0;
}


Measured memory_bytes: 256
x = input()
x = '000'+x
z = x[:-2]
y = x[-2:]
s = 0
z = int(z)
y = int(y)
L = []
for i in range(1,21):
    s +=5
    if s>=y and z>=i:
        print(1)
        exit()
if z>=20:
    print(1)
    exit()
print(0)

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

int main(){
  int N;
  cin >> N;
  vector<int> R(8);
  int O=0;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    if(a>=3200) O++;
    else R.at(a/400)++;
  }
  int ans=0;
  for(int i=0; i<8; i++){
    if(R.at(i)!=0) ans++;
  }
  cout << max(ans,1) << ' ' << ans+O << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 2*1e6;

int Heap[MAX+1];
int H;
void insert(int i)
{
	if(i==1)return;
	if(Heap[i]>Heap[i/2])
	{
		swap(Heap[i],Heap[i/2]);
		insert(i/2);
	}
}

void extract(int i)
{
	
	Heap[i] = Heap[H];
	Heap[H]=INT_MIN;
	H--;
	if(H==0)return ;
	while(H>i)
	{
		int l = i*2;
		int r = l+1;
		int largest;
		if(Heap[l]>Heap[i])largest = l;
		else largest = i;
		if(Heap[largest]<Heap[r])largest = r;
		//cout<<Heap[largest]<<endl;
		if(largest==i)break;
		else
		{
			//cout<<Heap[i]<<endl;
			swap(Heap[i],Heap[largest]);
			i = largest;
		}	
	}
	//cout<<';'<<endl;
}

int main()
{
	while(true)
	{
		
		string s;
		cin >> s;
		if(s=="insert")
		{
			H++;
			Heap[H] = INT_MIN;
			
			int x;
			cin >> x;
			Heap[H] = x;
			insert(H);
		}
		else if(s=="extract")
		{
			cout<<Heap[1]<<endl;
			extract(1);
		}
		else break;
	
	}
	return 0;
}


Measured memory_bytes: 6968
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 3001;

int n, s, dp[N][N], mod = 998244353;
vector <int> a;

int solve(int idx, int sum){
    if(sum > s) return 0;
    if(idx == n) return sum == s;
    int &ret = dp[idx][sum];
    if(ret != -1) return ret;
    ret = 2 * solve(idx + 1, sum);
    if(ret >= mod) ret -= mod;
    ret += solve(idx + 1, sum + a[idx]);
    if(ret >= mod) ret -= mod;
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n >> s;
    a.resize(n);
    for(auto &i : a) cin >> i;
    cout << solve(0, 0) << endl;
}


Measured memory_bytes: 38936
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>
#include <iostream>
#define ll long long int
#define all(x) x.begin(),x.end()

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,n) for (ll i=a ; i<n ;i+=1)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
# define N 100005LL
# define cout1(x) cout<<x<<"\n";
# define  deb(x) cout<<#x<<" "<<x<<"\n";
#define  vii vector<pa>;
using namespace std;

v visited(N);
vector<ll> ans={-1};
v level(N);
v ind(N);
ll sz[N];




// void dfs(ll node, ll par){
    
//     visited[node]=1;
//     if (node==1)level[1]=0;
//     else level[node] = level[par]+1;
//     ans.pb(node);
//     for(auto x:graph[node]){
//         if (!visited[x]){
//             dfs(x,node);
//             sz[node]+=sz[x];

//         }
       
//     }
//      ++sz[node];
    
// }
// map<ll,ll> cnt;
// ll answer(ll ans,ll x){
//     cout<<ans<<" "<<x<<endl;
//     if (cnt[ans%x]==0)return ans;
//     else if (cnt[ans%x==1] && ans>x)return ans;
//     else{
//         cnt[ans%x]-=1;
//         cnt[ans]+=1;
//         answer(ans+1,x);
//     }



// }

int main(){
    ll n;
    cin>>n;
    v arr(n);
    f(i,n)cin>>arr[i];
    v pre(n);
    pre[n-1]=arr[n-1];
    for(ll i=n-2;i>0;i--){
        pre[i]=pre[i+1]+arr[i];

    }
    ll ans=0; 
    f(i,n-1){
        ans+=(pre[i+1]*arr[i]);
    }
    cout1(ans);

}
  
    
    

        


Measured memory_bytes: 5448
#include<bits/stdc++.h>
using namespace std;
char s1[15],s2[15],s3[15];
int main()
{
   while(scanf("%s %s %s",s1,s2,s3)==3)
   {
      char a=s1[0]-'a'+'A';
      char b=s2[0]-'a'+'A';
      char c=s3[0]-'a'+'A';
      printf("%c%c%c\n",a,b,c);
   }
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=110;
int n,k,c[maxn],t[maxn],minn=1<<30,mini;
int main(){
    scanf("%d%d",&n,&k);
    for(register int i=1;i<=n;i++){
        scanf("%d%d",&c[i],&t[i]);
        if((t[i]<=k)&&(c[i]<minn)){
            minn=c[i];mini=i;
        }
    }
    if(mini) printf("%d\n",minn);
    else printf("TLE\n");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>
using namespace std;
#define MOD 1000000007
#define PI 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define each(i, v) for (auto i : v)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
#define fi first
#define se second
#define setp(x) setprecision(x)
#define mset(m, v) memset(m, v, sizeof(m))
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }

//static const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define int ll

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



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

int main(){
  int n;

  cin >> n;

  for(int i = 0; i < n; i++){
    string s;
    cin >> s;
    if(s.find("Y")!=-1){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;




}


Measured memory_bytes: 256
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=1e5+10, lg=17, mod=1e9+7, inf=1e18;

ll n,m,q[maxn],tt;
vector<ll> g[maxn];
bool mk[maxn];
void fff(ll v){
	mk[v]=1, q[++tt]=v;
	for(auto u:g[v])if(!mk[u]){ fff(u); break; }
}

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

	cin>>n>>m;
	while(m--){
		ll v,u; cin>>v>>u;
		g[v].pb(u), g[u].pb(v);
	}
	fff(1);
	reverse(q+1,q+tt+1);
	tt--;
	fff(1);
	cout<<tt<<endl;
	for(int i=1;i<=tt;i++) cout<<q[i]<<' ';
	
	return 0;
}


















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

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

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

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  int n;
  cin >> n;

  int max = sqrt(n)+1;

  rep(i,n) {
    int ans = 0;
    for(int x = 1; x <= max; x++)
      for(int y = x; y <= max; y++)
        for(int z = y; z <= max; z++) {
          if (x*x+y*y+z*z+x*y+y*z+z*x==i+1) {
            if (x==y&&y==z) ans++;
            else if (x==y||y==z||z==x) ans += 3;
            else ans += 6;
          }
        }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    llint n;
    cin>>n;
    vector<llint> v(n,0ll),s(n+1,0);
    
    REP(i,n){
        cin >> v[i];
        s[i + 1] = s[i] + v[i];
    }
    vector<vector<llint>> dp(n, vector<llint>(n + 1, linf));
    REP(i,n){
        dp[i][i + 1] =0;
    }
    llint r;
    
    FOR(length,2,n+1){
        REP(l,n-length+1){
            r = l + length;
            FOR(mid,l+1,r){
                dp[l][r] = min(dp[l][r], dp[l][mid]+dp[mid][r]+s[r]-s[l]);
            }
        }
    }
    cout << dp[0][n] << endl;

    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];

int main(){
  ll N,K;
  cin >> N >>K ;
  ll A[210000] ;
  cinf(N,A) ;
  ll num[210000] = {0} ;
  rep(i,N)
    num[A[i]] ++ ;
  ll sum=0;
  ll ans=0;
  for(int i=1;i<=N;i++){
    if(num[i])
      sum ++;
  }
  if(sum <= K)
    cout << 0 << endl;
  else{
    sort(num,num + N+1) ;
    int j =0;  
    for(int l=1;l<=N;l++){
      if(num[l] !=0){
        ans += num[l] ;
        j ++;
      }
      if(j >= sum -K)
        break;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1);
}


Measured memory_bytes: 256
h,w = map(int,input().split())
ls = []
side = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(h):
  ls.append(list(input()))
for i in range(h):
  ans2 = ""
  for j in range(w):
    ans = 0
    if ls[i][j] == "#":
      ans2 += "#"
    else:
      for k in range(8):
        if i+side[k][0] < 0 or j+side[k][1] < 0 or h <=i+side[k][0] or w <= j+side[k][1]:
          continue
        else:
          ans += (1 if ls[i+side[k][0]][j+side[k][1]] == "#" else 0)
      ans2 += str(ans)
  print(ans2)


Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	double a,b,d;
	double p = acos(-1);
	cin >> a >> b >> d;
	double S = a * b * sin(d * p / 180) / 2;
	double L = sqrt(a * a + b * b - 2 * a * b * cos(d * p / 180)) + a + b;
	double h = b * sin(d * p / 180);
	cout << fixed << setprecision(20) << S << " " << L << " " << h << endl;
	return 0;
} 


Measured memory_bytes: 3568
#include<stdio.h>
int main(void)
{
  int x,y,i,j,flag=0;

  scanf("%d %d",&x,&y);

  for(i=0;i<=x;i++){
      if(i+3*(x-i)==y-x){
        flag=1;
      }
  }

  if(flag==1){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

return 0;
}


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

int main(){
  int ans=0;
  string s;
  cin>>s;
  for(int i=0;i<=3;i++){
    if(s[i]=='+')
      ans++;
    if(s[i]=='-')
      ans--;
  }
  cout<<ans<<endl;
}

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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        m:usize,
        mut xm:[i64;m],  
    }
    xm.sort();
    if n >= m {
        println!("0");
        return;
    }
    let mut diff:Vec<_> = xm.windows(2).map(|x|x[1] - x[0]).collect();
    diff.sort();
    diff.reverse();
    let ans = if n - 1 > diff.len() {
        0
    } else {
        diff.iter().skip(n-1).sum::<i64>()
    };
    println!("{}",ans);
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	ll H, ans = 0, add = 1;

	cin >> H;

	ans += add;
	while (H > 1) {
		H /= 2;
		add *= 2;
		ans += add;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

const int DICE_SIZE = 6;
int const CmdCount = 6;
int const RotateLen = 4;

//?????????
//??±?\????????????¢???????????¨?????§?????????
class dice {
  //?????????,?????¢,??±??¢,?\???¢,?????¢,?????¢?????°???
  int values[DICE_SIZE];
public:
  dice ();
  virtual ~dice ();
  int &operator[](int i){
    assert(0 <= i && i < DICE_SIZE);
    return values[i];
  };
  void docmd(string str);
  void docmd(char c);
  void setTopAndFront(int top,int front);
  void input(void);
  int right(void){return values[2];};
  int top(void){return values[0];};
  int front(void){return values[1];};
private:

  int indexs[CmdCount][RotateLen];
  char *cmdChar;
  string *toTopCmd;
  string *toFrontCmd;
  void move_forward(int *indexs);
  int find_value(int num);
};
void dice::setTopAndFront(int top, int front){
  int idxTop = find_value(top);
  docmd(toTopCmd[idxTop]);
  int idxFront = find_value(front);
  docmd(toFrontCmd[idxFront]);
}
int dice::find_value(int num){
  for(int i = 0; i < DICE_SIZE; i++){
    if(values[i] == num){
      return i;
    }
  }
  assert(false);
}
dice::dice(){
  int westindex[RotateLen] = {1, 3, 6, 4};
  int northindex[RotateLen] = {1, 2, 6, 5};
  int leftindex[RotateLen] = {4, 2, 3, 5};
  cmdChar = new char[CmdCount]{'W', 'E', 'N', 'S','L','R'};
  for(int i = 0; i < RotateLen; i++){
    indexs[0][i] = westindex[i] - 1;//W
    indexs[1][i] = westindex[RotateLen - i - 1] - 1;//E
    indexs[2][i] = northindex[i] - 1;//N
    indexs[3][i] = northindex[RotateLen - i - 1] - 1;//S
    indexs[4][i] = leftindex[i] - 1;//L
    indexs[5][i] = leftindex[RotateLen - i - 1] - 1;//R
  }
  toTopCmd = new string[DICE_SIZE]{"","N","W","E","S","NN"};
  toFrontCmd = new string[DICE_SIZE]{"S","","L","R","LL","N"};
}
dice::~dice(){
  delete [] cmdChar;
  delete [] toTopCmd;
  delete [] toFrontCmd;
}

void dice::docmd(string str){
  for(int i = 0; i < str.length(); i++){
  //  cout << "docmd(str[i])" << str[i] << endl;
    docmd(str[i]);
  }
}

void dice::docmd(char c){
  for(int i = 0; i < CmdCount; i++){
    if (c == cmdChar[i]){
    //  cout << cmdChar[i] << endl;
      move_forward(indexs[i]);
      return;
    }
  }
  assert(false);//????????¨???????????????
}
void dice::move_forward(int *indexs){
  int temp = values[indexs[0]];
  values[indexs[0]] = values[indexs[1]];
  values[indexs[1]] = values[indexs[2]];
  values[indexs[2]] = values[indexs[3]];
  values[indexs[3]] = temp;
}
void dice::input(void){
  for(int i=0; i < DICE_SIZE; i++){
    int n;
    cin >> n;
    values[i] = n;
  }
}
int main(int argc, char const *argv[]) {
  dice d;
  d.input();
  int count;
  cin >> count;
  for(int i = 0; i < count ;i++){
    int top,front;
    cin >> top >> front;
    d.setTopAndFront(top,front);
    cout << d.right() << endl;
  }
  return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

int main() {
    using vi = vector<int>;
    
    string s,t;
    cin >> s >> t;
    rep(i,s.length()){
        if(s.at(i) != t.at(i)){
            cout << "No" << endl;
            exit(0);
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3632
use std::io::{BufRead, Write};
use std::io;
use std::cmp;

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let mut cnts = [0usize; 9];
    let _: usize = s.trim().parse().unwrap();
    s.clear();
    input.read_line(&mut s).unwrap();
    let a: Vec<usize> = s.split_whitespace().map(|s| s.parse().unwrap()).collect();
    for i in a {
        cnts[cmp::min(i / 400, 8)] += 1;
    }
    let least = cnts[0..8].iter().filter(|&&x| x != 0).count();
    writeln!(output, "{} {}", cmp::max(least, 1), least + cnts[8]).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }
    #[test]
    fn case1() {
        test("4
2100 2500 2700 2700\n",
             "2 2\n");
    }
    #[test]
    fn case2() {
        test("5
1100 1900 2800 3200 3200\n",
             "3 5\n");
    }
    #[test]
    fn case3() {
        test("20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n",
             "1 1\n");
    }
}



Measured memory_bytes: 4352