akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.TreeMap;

public class Main {

	int N,W;
	int[] w,v;

	TreeMap<Integer,Integer>[] map;

	public int dfs(int n,int weight){

		if(n == N)return 0;

		if(map[n].containsKey(weight)){
			return map[n].get(weight);
		}

		int ret = 0;

		if(weight+w[n] <= W)ret = Math.max(ret,dfs(n+1,weight+w[n]) + v[n]);
		ret = Math.max(ret,dfs(n+1,weight));


		map[n].put(weight,ret);
		return ret;
	}

	@SuppressWarnings("unchecked")
	public void solve() {
		N = nextInt();
		W = nextInt();

		w = new int[N];
		v = new int[N];

		for(int i = 0;i < N;i++){
			w[i] = nextInt();
			v[i] = nextInt();
		}

		map = new TreeMap[N];
		for(int i = 0;i < N;i++){
			map[i] = new TreeMap<Integer,Integer>();
		}

		out.println(dfs(0,0));
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

Measured memory_bytes: 33256
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e3+10;
int r,c;
int dp[N][N];
bool numWays(){
	for(int j=0;j<c;j++){
		if(dp[0][j]==-1){
			break;
		}
		dp[0][j]=1;
	}
	for(int i=0;i<r;i++){
		if(dp[i][0]==-1)
			break;
		dp[i][0]=1;
	}

	if(dp[0][0]==-1 or dp[r-1][c-1]==-1){
		return 0;
	}

	for(int i=1;i<r;i++){
		for(int j=1;j<c;j++){
			if(dp[i][j]==-1)
				continue;

			if(dp[i][j-1]!=-1)
				dp[i][j]=dp[i][j-1];


			if(dp[i-1][j]!=-1){
				dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
			}
		}
	}

	return dp[r-1][c-1];

}
void raushan_kumar(){
	cin>>r>>c;
	char a[r][c];
	fo0(i,r){
		fo0(j,c){
			cin>>a[i][j];
		}
	}
	mset(dp,0);
	fo0(i,r){
		fo0(j,c){
			if(a[i][j]=='#'){
				dp[i][j]=-1;
			}
		}
	}
	
	if(numWays()){
		cout<<dp[r-1][c-1];
	}
	else{
		cout<<0;
	}
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

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

#define MOD 1000000007
#define INF 1000000001

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}


int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; ++i) {
        cin >> h[i];
    }

    vector<int> dp(N);
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i < N; ++i) {
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[N-1] << endl;

    return 0;
}


Measured memory_bytes: 1024
A, B, C = map(int, input().split())
X = sorted([A, B, C])
ans = X[2]-X[1]
if (X[2]+X[0]+X[2]-X[1]) % 2 != 0:
    ans += 1
    ans += (X[2]+1-(X[0]+X[2]-X[1])) / 2
else:
    ans += (X[2]-(X[0]+X[2]-X[1])) / 2
print(int(ans))


Measured memory_bytes: 39252
import java.util.*;
import java.math.BigDecimal;
import java.math.MathContext;
public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final int a = sc.nextInt();
        final int b = sc.nextInt();
        final int c = sc.nextInt();
        sc.close();

        int scale = 50;
        BigDecimal ad = sqrt(new BigDecimal(a), scale);
        BigDecimal bd = sqrt(new BigDecimal(b), scale);
        BigDecimal cd = sqrt(new BigDecimal(c), scale);
        if (cd.compareTo(ad.add(bd)) == 1) {
            System.out.println("Yes");
        } else
            System.out.println("No");
    }

    public static BigDecimal sqrt(BigDecimal a, int scale){
        BigDecimal x = new BigDecimal(
                Math.sqrt(a.doubleValue()), MathContext.DECIMAL64);
        if(scale < 17) return x;

        BigDecimal b2 = new BigDecimal(2);
        for(int tempScale = 16; tempScale < scale; tempScale *= 2){
            x = x.subtract(
                    x.multiply(x).subtract(a).divide(
                    x.multiply(b2), scale, BigDecimal.ROUND_HALF_EVEN));
        }
        return x;
    }
}

Measured memory_bytes: 23892
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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


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

    vector<int> p(n);

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

    int maximum = 0;
    int maximumindex = 0;
    for(int i = 0; i < n; i++){
        if(maximum < p[i]){
            maximum = p[i];
            maximumindex = i;
        }
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        if(i == maximumindex){
            ans += maximum / 2;
        } else {
            ans += p[i];
        }
    }

    cout << ans << endl;
    
}



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

int main(void) {
  long long a, b, c;
  cin >> a >> b >> c;
  if (c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;

void main() {
    int n = readln.chomp.to!int;
    auto a = readln.split.to!(int[]);

    a.sort!"a > b"();

    int res;

    foreach (i ; 0 .. n) {
        res += (-1)^^(i) * a[i];
    }

    writeln(res);
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

struct Queue(T) {
    private {
        size_t cap, head, tail;
        T[] data;
    }

    this (size_t n) in {
        assert(n > 0, "The capacity of a queue must be a positive integer.");
    } body {
        cap = n + 1;
        data = new T[](cap);
    }

    void clear() {
        head = tail = 0;
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return head == (tail + 1) % cap;
    }

    size_t length() {
        return head <= tail ? tail - head : cap - head + tail;
    }

    T front() in {
        assert(!empty, "The queue is empty.");
    } body {
        return data[head];
    }

    void removeFront() in {
        assert(!empty, "The queue is empty.");
    } body {
        (++head) %= cap;
    }

    alias popFront = removeFront;

    void insertBack(T x) in {
        assert(!full, "The queue is full.");
    } body {
        data[tail++] = x;
        tail %= cap;
    }

    alias insert = insertBack;

    T[] array() {
        return head <= tail ? data[head .. tail].dup : data[head .. $] ~ data[0 .. tail];
    }

    string toString() {
        import std.format : format;

        if (head <= tail) {
            return format("[%(%s, %)]", data[head .. tail]);
        }
        else {
            return format("[%(%s, %)", data[head .. $]) ~ format(", %(%s, %)]", data[0 .. tail]);
        }
    }
}

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

int main() {
  int n, k;
  cin >> n >> k;
  
  string s;
  cin >> s;
  
  if (s.at(k-1) == 'A') s.at(k-1) = 'a';
  else if (s.at(k-1) == 'B') s.at(k-1) = 'b';
  else s.at(k-1) = 'c';
  
  cout << s << endl;
  
}

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

using namespace std;

#define INT_MAX 2147483647

long gcd(long m, long n);
long lcm(long m, long n);

int main(void) {

	int ans = 0;
	int n;
	cin >> n;
	vector<int> v;

	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(v.begin(), v.end());
	ans = v[n / 2] - v[n / 2 - 1];


	cout << ans << endl;
	return 0;

}

//std::string result = s.substr(2, 3);  // 2番目から3要素だけ抜き出した部分文字列を取得する

//最大公倍数
long gcd(long m, long n)
{
	long temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
long lcm(long m, long n)
{
	return m * n / gcd(m, n);
}


Measured memory_bytes: 1020
#include <iostream>

using namespace std;

int main()
{
    int x, max, n;
    cin >> n;
    char buf[n];
    cin >> buf;

    x = max = 0;
    for (auto c: buf) {
        if (c == 'I') {
            x++;
        } else {
            x--;
        }
        if (x > max)
            max = x;
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	static long MOD = 2 << 29;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int[] a = new int[3];
		for(int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		int count = 1;
		if(a[0] != a[1]) count++;
		if(a[1] != a[2]) count++;
		
		System.out.println(count);
	}
	
	
	
	
}
 
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        if (!hasNext()) throw new NoSuchElementException();
        int n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

Measured memory_bytes: 8148
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

int main() {
  ull a, b, c, d, e;
  //cin >> a >> b >> c >> d >> e;
  vector<ull> abcde;
  each(i, 5) {
    ull tmp;
    cin >> tmp;
    abcde.push(tmp);
  }

  sort(abcde.begin(), abcde.end(), [](ull x, ull y) {
      if (x%10 == 0 || y%10 == 0) {
        return true;
      } else {
        return (x%10) > (y%10);
      }
    });

  ull result = 0;
  each(i, 5) {
    if (i == 4) {
      result += abcde[4];
    } else {
      if (abcde[i] % 10 == 0) {
        result += abcde[i];
      } else {
        result += (abcde[i] + (10 - abcde[i] % 10));
      }
    }
  }

  cout << result << endl;

  return 0;
}


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

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;

ll pow(int a, int n)
{
	if (n == 0)
	{
		return 1;
	}

	if (n % 2 == 0)
	{
		return (pow(a, n / 2)* pow(a, n / 2) % mod);
	}
	else {
		return ((pow(a, n / 2)* pow(a, n / 2) % mod) * a % mod);
	}
}

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

	ll A[100000];
	map<ll, int> mp;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		mp[A[i]]++;
	}

	int P = N / 2;
	bool isValid = true;
	if (N % 2 == 0)
	{
		if (mp.size() != P) {
			isValid = false;
		}
		for (map<ll, int>::iterator it = mp.begin(); it != mp.end(); it++)
		{
			if (it->second != 2)
			{
				isValid = false;
			}
		}
	}
	else {
		if (mp.size() != P + 1) {
			isValid = false;
		}
		for (map<ll, int>::iterator it = mp.begin(); it != mp.end(); it++)
		{
			if (it->first == 0)
			{
				if (it->second != 1)
				{
					isValid = false;
				}
			}
			else {
				if (it->second != 2)
				{
					isValid = false;
				}
			}
		}
	}

	if (!isValid)
	{
		cout << 0 << endl;
	}
	else {
		cout << pow(2, P) % mod << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<pair<int, int> > reds(N), blues(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &reds[i].first, &reds[i].second);
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &blues[i].first, &blues[i].second);
  }
  sort(blues.begin(), blues.end());
  vector<int> used(N, 0);
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int bx = blues[i].first, by = blues[i].second;
    int diff = INF, ix = -1;
    for (int j = 0; j < N; ++j) {
      int rx = reds[j].first, ry = reds[j].second;
      if (used[j]) { continue; }
      if (not (rx < bx and ry < by)) { continue; }
      if (by - ry < diff) {
        diff = by - ry;
        ix = j;
      }
    }
    if (ix != -1) {
      ++ans;
      used[ix] = 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    string S;
    cin >>S;
    S[3]='8';
    cout << S << endl;


    return 0;
    

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll unsigned long long
#define pp pair<int,int>
#define ppn pair<pp,int>
#define F first
#define S second
#define N 1000005
#define mod 1000000007


using namespace std;



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


    int n;
    ll d;
    cin>>n>>d;
    ll x,y,k;
    int ans = 0;
   for(int i=0; i<n; i++){
    cin>>x>>y;
    k = x*x+y*y;
    //k=sqrt(k);
    if(k<=d*d)ans++;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3648
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static String[] Array = new String[3];
	static String line;
	static int number;
	static double height, weight;
	 
	public static void main(String[] args) {
		while(read()){
			slove();
		}
	}

	static boolean read(){
		if(!sc.hasNext()){
			return false;
		}else{
			line = sc.nextLine();
			Array = line.split(",");
			number = Integer.parseInt(Array[0]);
			weight = Double.parseDouble(Array[1]);
			height = Double.parseDouble(Array[2]);
			return true;
		}
	}
	
	static void slove(){
		double BMI = 0.0;
	//	System.out.println(number);
		//System.out.println(weight);
		//System.out.println(height);
		BMI = weight/(height*height);
		if(BMI >= 25.0){
			System.out.println(number);
		}
		
	}
}

Measured memory_bytes: 12000
module Main where

import Control.Applicative
import Control.Monad
import Data.List

isPalindrom :: Int -> Bool
isPalindrom n = xs == (reverse xs)
  where
    xs = show n

main :: IO ()
main = do
    [a, b] <- fmap read . words <$> getLine
    print $ length $ filter isPalindrom [a .. b]

Measured memory_bytes: 1020
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Bits
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let bitVec = VU.create $ do
            vec <- VUM.replicate 60 (0 :: Int)
            forM_ as $ \a -> do
                forM_ [0..59] $ \i -> do
                    when (testBit a i) $ VUM.modify vec succ i
            return vec
    print . fst $ VU.foldl' (\(s,i) k -> (modN ((powerMod 2 i) `mulMod` k `mulMod` (n-k) `plusMod` s), i+1)) (0,0) bitVec

moduloN :: Int
moduloN = 10 ^ 9 + 7

modN = flip mod moduloN

plusMod x y = modN $ x + y

minusMod x y | x < y = moduloN + x - y
             | otherwise = x - y

mulMod x y = modN $ x * y

powerMod x 0 = 1
powerMod x y
    | even y = mulMod t t
    | otherwise = mulMod x $ mulMod t t
    where
        t = powerMod x $ div y 2

Measured memory_bytes: 19336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,a[200010],s=0,b=0,c=0;
  cin>>n;
  Fr(i,n){cin>>a[i];a[i]-=i;}
  sort(a+1,a+n+1);
  Fr(i,n) b+=abs(a[i]-a[n/2]);
  Fr(i,n) c+=abs(a[i]-a[n/2+1]);
  cout<<min(b,c)<<endl;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int t = sc.nextInt();
      int a = sc.nextInt();
      double[] h = new double[n];
      for(int i=0;i<n;i++){
        h[i] = sc.nextInt();
      }
      int kokonishirowotateyou = 0;
      double gosa = 10000;
      for(int i=0;i<n;i++){
        h[i] = t-(h[i]*0.006);
        h[i] = Math.abs(h[i]-a);
        if(gosa>h[i]){
          kokonishirowotateyou = i;
          gosa = h[i];
        }
      }
      System.out.println(kokonishirowotateyou+1);
    }
}

Measured memory_bytes: 24020
import java.util.Scanner;
    
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        String str = scanner.nextLine();
        String strArr[] = str.split(" ");
        
        for(int i=0;i<=n-1;i++){
            int v = Integer.parseInt(strArr[i]);
            int j = i - 1;
            while(j >= 0 && Integer.parseInt(strArr[j]) > v){
                strArr[j+1] = strArr[j];
                j--;
            }
            strArr[j+1] = String.valueOf(v);
            System.out.print(strArr[0]);
            for(int k = 1; k < n ;k++){
                System.out.print(" "+strArr[k]);
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 33020
#include <stdio.h>

int main() {
  long n, a;
  long cnt[200001] = {0};

  scanf("%ld", &n);
  for (int i = 1; i < n; i++) {
    scanf("%ld", &a);
    cnt[a] = cnt[a] + 1;
  }

  for (int i = 1; i <= n; i++) {
    printf("%ld\n", cnt[i]);
  }

  return 0;
}

Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x,y,ans=0;
  cin>>a>>b>>c>>x>>y;
  if(a+b>c*2){
    ans+=min(x,y)*c*2;
    if(x>y){
      if(a>c*2){
	ans+=(x-y)*c*2;
      }
      else ans+=(x-y)*a;
    }
    else if(x<y){
      if(b>c*2){
	ans+=(y-x)*c*2;
      }
      else ans+=(y-x)*b;
    }
  }
  else{
    ans=x*a+y*b;
  }
  cout<<ans<<endl;
  return(0);
}


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

using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

string s;

int main() {
    std::cin >> s;
    for (int i = 0; i < s.length()-1; i++) {
        if(s[i] == s[s.length() - 2 - i]){
            continue;
        }else{
            std::cout << -1 << std::endl;
            return 0;
        }
    }
    if(s[s.length()-1]=='1' || s[0]=='0' ){
        std::cout << -1 << std::endl;
        return 0;
    }
    
    ll parent = -1;
    for (int i = 1; i <= s.length()-1; i++) {
        if(parent>i){
            std::cout << i<<" "<<parent << std::endl;
        }else{
            for (int j = i+1; j <= s.length(); j++) {
                if(s[j-1]=='1' || j == s.length()){
                    parent = j;
                    break;
                }
            }
            std::cout << i<<" "<<parent << std::endl;
        }
    }
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<math.h>

int main(void){

  int A=0;
  int P=0;
  int Maxpie=0;
  int piece=0;
  int pie=0;

  scanf("%d",&A);
  scanf("%d",&P);

  piece = A*3.0 + P;

  if(piece % 2 == 0){
    Maxpie = piece / 2;
  }

  else if(piece % 2 == 1){
    Maxpie = (piece - 1) / 2;
  }

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

  return 0;
}


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

using namespace std;

#define F 		first
#define S 		second
#define ll 		long long
#define ld 		long double
#define pii		pair<int, int>
#define vi 		vector<int>
#define mii 	map<int, int>
#define umii 	unordered_map<int, int>
#define pb		push_back
#define mk		make_pair
#define ask(x) 	cerr << #x << " = " << x << "\n";
#define INF 	1000000007
#define hell 	998244353

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

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	ll n, a[200005];
	ll k;
	umii mp;

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

	// for (int i = 0; i < n; ++i)
	// 	cout << a[i] << ' ';
	// cout << '\n';

	ll c = 0LL, i = 0LL, f, x = 0LL, s;
	while (true) {
		if (mp.find(i) != mp.end()) {
			c = x - mp[i];
			f = mp[i];
			s = i;
			break;
		}
		mp[i] = x++;
		i = a[i];
	}
	// ask(c);
	if (k <= f) {
		i = 0;
		while (k--) {
			i = a[i];
		}
	}
	else {
		k -= f;
		k = k % c;
		i = s;
		while (k--) {
			i = a[i];
		}
	}
	cout << i + 1LL;

	return 0;
}

Measured memory_bytes: 12784
/*/Saya-Javelin/*/
#include <cstdio>
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
#define Fo freopen ("file.in", "r", stdin), freopen ("file.out", "w", stdout)
#define Fc fclose (stdin), fclose (stdout)
#define iln inline
#define rgt register
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Abs(a) ((a)>0?(a):-(a))
#define Swap(a,b) (a)^=(b)^=(a)^=(b)
#define Sqr(x) ((x)*(x))
//#define int long long
#define ll long long
#define ld double

const int S=1000000;
char RRR[S];
char *SSR, *UR;

iln char fgc () {
	if (SSR==UR) UR=(SSR=RRR)+fread (RRR, 1, S, stdin);
	return *SSR++;
}

//#define gc rrr=fgc()
#define gc rrr=getchar()
iln void read (int &ur) {
	int ssr=1; char rrr; ur=0;
	while (gc, rrr>'9' || rrr<'0')
	if (rrr=='-') ssr=-1;
	while (rrr>='0' && rrr<='9')
	ur=ur*10+rrr-'0', gc;
	return (void) (ur*=ssr);
}
#undef gc

iln void write (int ur) {
	if (ur<0) putchar ('-'), ur*=-1;
	if (ur>=10) write (ur/10);
	return (void) putchar (ur%10+'0');
}

iln void wtn (int ur) {
	write (ur);
	return (void) putchar ('\n');
}

iln void wts (int ur) {
	write (ur);
	return (void) putchar (' ');
}

int n, in;
int a[100001];
int ans=0, k=0;
bool wei[33]={0};

signed main (void) {
	read (n);
	for (rgt int i=1; i<=n; ++i) {
		read (a[i]); ans^=a[i];
		for (rgt int j=0; j<=30; ++j) {
			if (a[i]&(1<<j)) {
				wei[j]=1; 
				break;
			}
		}
	}
	for (rgt int i=30; i>=0; --i) {
		if (ans&(1<<i)) {
			if (!wei[i]) return wtn (-1), 0;
			ans^=(1<<(i+1))-1;
			k++;
		}
	}
	wtn (k);
}

Measured memory_bytes: 512
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(H):
    dp = np.zeros_like(H)
    dp[1] = abs(H[1] - H[0])
    for n in range(2, len(H)):
        x = dp[n - 1] + abs(H[n - 1] - H[n])
        y = dp[n - 2] + abs(H[n - 2] - H[n])
        dp[n] = min(x, y)
    return dp[-1]

signature = '(i8[:],)'
if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', signature)(main)
    cc.compile()

from my_module import main

H = np.array(read().split(), np.int64)[1:]

print(main(H))

Measured memory_bytes: 32888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=1e9;
int h[100005];
int main(void)
{
    int N;
    cin >> N;
    bool ok=true;
    int mx=0;
    for(int i=0;i<N;i++)
    {
        cin >> h[i];
    }
    for(int i=0;i<N;i++)
    {
        mx=max(mx,h[i]);
        if(mx-h[i]>=2) ok=false;
    }
    if(ok)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
import math

N = int(input())
s = 0

i = 1
j = 1
k = 1

while i <= N:
	j = i + 1
	while j <= N:
		k = j + 1
		l = math.gcd(i,j)
		while k <= N:
			s = s + math.gcd(l,k)*6
			k = k + 1
		s = s + math.gcd(i,j)*6
		j = j + 1
	s = s + math.gcd(i,i)
	i = i + 1

print(s)

Measured memory_bytes: 9192
n,m=map(int,input().split())
import math
if abs(n-m)>1:
  print(0)
  exit(0)
mod=10**9+7
ans=1
k=math.factorial(n)%mod
l=math.factorial(m)%mod
if n==m:
  ans=2
print(ans*(k*l)%mod)

Measured memory_bytes: 4104
'''
https://atcoder.jp/contests/abc128/tasks/abc128_c
'''
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque

    #mod = 1000000007

    n, m = map(int, input().split())
    switch_list = [list(map(int, input().split())) for _ in range(m)]
    p = list(map(int, input().split()))
    ret = 0
    for j in range(2**n):
        cnt = 0
        for i in range(m):
            total = 0
            for k in switch_list[i][1:]:
                if j & 2**(k-1):
                    total += 1
            if total%2 == p[i]:
                cnt += 1
            else:
                break
        if cnt == m:
            ret += 1
    print(ret)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

ll MODP = 998244353;


int main(){
  int H,W,K;
  cin >> H >> W >> K;
  char m[H][W];
  rep(i,H)rep(j,W){
    cin >> m[i][j];
  }
  int ans = 0;
  int h = 1,w = 1;
  rep(i,H)h *= 2;
  rep(i,W)w *= 2;

  rep(i,h)rep(j,w){
    int cnt = 0;
    rep(k,H){
      if((i >> k)&1){
        continue;
      }else{
        rep(l,W){
          if((j >> l)&1){
            continue;
          }else{
            if(m[k][l] == '#')cnt++;
          }
        }
      }
    }
    if(cnt == K)ans++;
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  ll ans = 0;
  rep(i, n){
    int a, b; cin >> a >> b;
    ans += b-a+1;
  }
  cout << ans << endl;
  system("pause");
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

ll a[55] , a2[55] , n;

bool check()
{
    for(int i=1; i<n; i++)
        if (a[i+1] < a[i]) return 0;
    return 1;
}

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

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

    if (check()) return cout << "YES\n" , 0;

    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            swap(a[i],a[j]);
            for(int k=1; k<=n; k++)
                a2[k] = a[k];
            if (check())
                return cout << "YES\n" , 0;
            swap(a[i],a[j]);
        }
    }


    cout << "NO\n";

    return 0;
}

Measured memory_bytes: 256
Stay_Days    = gets.to_i
Short_Days   = gets.to_i
Short_Charge = gets.to_i
Long_Charge  = gets.to_i

charge = 0
charge += Short_Charge * (Stay_Days <= Short_Days ? Stay_Days : Short_Days)
charge += Long_Charge  * (Short_Days < Stay_Days ? Stay_Days - Short_Days : 0)

puts charge


Measured memory_bytes: 1788
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		int[] h = new int[n];
		for(int i=0;i<n;i++) {
			h[i] = in.nextInt();
		}
		for(int i=0;i<n;i++) {
			a[i] = Integer.MAX_VALUE;
		}
		a[0] = 0;
		for(int i=0;i<n;i++) {
			if(i<n-1)a[i+1] = Math.min(a[i+1], a[i]+Math.abs(h[i]-h[i+1]));
			if(i<n-2)a[i+2] = Math.min(a[i+2], a[i]+Math.abs(h[i]-h[i+2]));
		}
		System.out.println(a[n-1]);
	}
}

Measured memory_bytes: 49184
#include <iostream>
#include <cmath>
#define rep(i, n)for(int i=0; i<n; i++)
using namespace std;
using ll = long long;

ll f(ll x){
    ll xDigit=0;
    while(x){
        xDigit++;
        x /= 10;
    }
    return xDigit;
}

int main(){
    ll n;
    cin >> n;
    for(ll i=sqrt(n); i<=n; i--){
        if(n%i==0){
            int j = n/i;
            cout << f(j) << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

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

    int n,k,cnt=0;cin>>n>>k;
    rep(i,n){
        int t;cin>>t;
        if(t>=k) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):
    print(min(A,B),max(0,A+B-N))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;

            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                char[] rev = input.ToCharArray();
                Array.Reverse(rev);

                if (input == new string(rev)) count++;
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 9076
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define gc getchar
#define pc putchar
#define st static
#define cs const

inline
ll getint(){
    re ll num=0;
    re char c=gc();
    while(!isdigit(c))c=gc();
    while(isdigit(c))num=(num<<1)+(num<<3)+(c^48),c=gc();
    return num;
}

int n,a[300005];

inline
bool check(int l,int r){
    int maxn=0,minn=n+1;
    for(int re i=l;i<=r;++i){
        maxn=max(maxn,a[i]);
        minn=min(minn,a[i]);
    }
    if(maxn!=r||minn!=l)return false;
    int submaxn=0;
    maxn=0;
    for(int re i=l;i<=r;i+=2){
        if(maxn<a[i])maxn=a[i];
        else if(submaxn<a[i])submaxn=a[i];
        else return false;
    }
    return true;
}

int main(){
    n=getint();
    for(int re i=1;i<=n;++i){
        a[i]=getint();
    }
    for(int re i=1;i<=n;++i){
        if(a[i]==i)continue;
        int p;
        for(p=i;p<=n-2;p+=2){
            if(a[p+1]!=p+1||a[p+2]==p+2)break;
        }
        if(!check(i,p)){
            puts("No");
            return 0;
        }
        i=p;
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 1408
K,S=map(int, input().split())
ans = 0
x = S//3+1
for i in range(x):
  y = (S-i)//2+1
  for j in range(i, y):
    k = S - i - j
    if k > K:
      continue
    if i == j == k:
      ans += 1
    elif i == j or j == k:
      ans += 3
    else:
      ans += 6
print(ans)

Measured memory_bytes: 9148
from itertools import combinations
import numpy as np
        #買う本
N, M, X = map(int, input().split())
items   = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32)
all_book= [i for i in range(N)]  
out     = 10**18
flag    =False
#for c in itertools.product([False, True], repeat=N):
for num in range(1,N+1): #1冊からN冊まで
    for t in combinations(all_book,num): #参考書を買う組合せ、全列挙
        book_buy        =np.array(t,dtype=int) 
        understand_now  = items[book_buy] 
        tmp             = np.sum(understand_now, axis=0)
        if np.all(tmp[1:] >= X):
            out = min(out, tmp[0])
            flag =True
if flag ==True:
    print(out)
else:
    print(-1)

Measured memory_bytes: 27348
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
    int X;
    cin>>X;
    for (ll i = -200; i < 200; i++){
        for (ll j = -200; j < 200; j++){
            if(pow(i,5)-pow(j,5)==X){
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

#define pll pair<ll,ll>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl
#define sz(a) int((a).size())
#define endl '\n' // remove for interactive

const int INF = 1e9;
const ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

const int N = 1e6+10;
int spf[N];
int d[N];





void solve()
{
    
    for(int i=2;i<=1e6;i++)if(!spf[i])
		for(int j=i;j<=1e6;j+=i)if(!spf[j])spf[j]=i;
    
    REP(i, 1, 1e6) {
        int mult = 1;
        int tr = i;
        while(tr != 1) {
            int sel = spf[tr];
            int cnt = 0;
            while(tr % sel == 0) {cnt++; tr /= sel;}
            mult = 1LL*mult*(cnt+1);
        }
        d[i] = mult;
    }
    // watch(d[4]);
    int n; cin>>n;
    ll ans = 0;
    // watch(d[4]);
    REP(i, 1, n-1) {
        int tr = n-i;
        ans += d[tr];
    }
    cout<<ans;
}

int main()
{
    // clock_t start, end;
    // start = clock();
    ios_base::sync_with_stdio(0); //cant use scanf, printf
    cin.tie(0);cout.tie(0); // no longer auto flush cout before each cin, remove for interactive
    int t = 1;
    // cin>>t;
    REP(i, 1, t)
    {
        solve();
        
    }
    // end = clock();
    // double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    // watch(time_taken);
    ll x = INF; x++;
    return 0;
    
}



/*before sub
TEST: 0(1 by 1 too), 1, equal, -ve, bounds(random and ez)
ERR/WA: loop vars, out of bounds, endl, finish taking inputs, large doubles, larger INF, corr mod, t, early/late mod
RE: double dec, integer overflow(ll or 1LL mult)
*/





Measured memory_bytes: 11460
// Author : Mohamed sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
int main()
{
	string x;
	cin >> x;
	int sum = 0;
	for (int i = 0; i < SZ(x); i++)
	{
		sum += x[i] - '0';
	}
	cout << (sum % 9? "No\n" : "Yes\n");
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define maxN 200007
using namespace std;
int main() {
  fastio;
  ll n = 0;
  cin >> n;
  vector<ll>ar(n), dp(n, INF);
  for (ll i = 0; i < n; ++i)
    cin >> ar[i];
  dp[0] = 0;
  for (ll i = 0; i < n; ++i) {
    if (i + 1 < n)
      dp[i + 1] = min(dp[i + 1], dp[i] + abs(ar[i + 1] - ar[i]));
    if (i + 2 < n)
      dp[i + 2] = min(dp[i + 2], dp[i] + abs(ar[i + 2] - ar[i]));
  }
  cout << dp[n - 1];
}

Measured memory_bytes: 4776
/*
g++ -std=c++11 -o2 -Wall ABC101D.cpp -o ./out/ABC101D.out
./out/ABC101D.out
*/

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

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define tr(c, i) for (iter(c) != (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define mp make_pair

typedef long long ll;

ll sum(ll n)
{
  ll s = 0;
  while (n > 0)
  {
    s += n % 10;
    n /= 10;
  }
  return s;
}

int main(){
//    freopen("./input/input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll k;
    cin >> k;
    ll n = 1, d = 1;
    cout << 1 << endl;
    for (ll i = 1; i < k; ++i)
    {
      if (sum(n + d) * (n + d * 10) < sum(n + d * 10) * (n + d))
        d *= 10;
      n += d;
      cout << n << endl;
    }

    return 0;
}


Measured memory_bytes: 256
function Main(input) {
    var sum  = function(arr) {
        var sum = 0;
        arr.forEach(function(elm) {
            sum += elm;
        });
        return sum;
    };
    var C = 1e+9 + 7;
    var C2 = 1e+5;
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    var N = parseInt(input[0][0], 10);
    var K = parseInt(input[0][1], 10);

    var vec_ruijoR = Array.from({length: Math.ceil(K)}, () => 0);
    var tmp;
    for (var i = 1; i <= K; i++){
        tmp = (K / i | 0);
        i = (K / tmp | 0);
        vec_ruijoR[i -1] = oldProduct = fastRuijoR(i, N, C, C2);
    }
    var vec_countPattern = Array.from({length: K}, () => 0);
    var limit;
    var ans = 0;
    for (var x = K; x >= 1; x --){
        limit = (K / x | 0);
        tmp = vec_ruijoR[limit - 1];
        for (var j = 2; j <= limit; j ++){
            tmp -= vec_countPattern[x * j - 1];
        }
        tmp = mod(tmp, C);
        ans += kakeruR(x, tmp, C, C2);
        // console.log("xa", x, ans);
        ans %= C;
        vec_countPattern[x - 1] = tmp;
    }
    console.log(ans);
}

function kakeruR(a, b, C, C2){
    var tmpQ, tmpR, ans;
    tmpQ =  (b / C2 | 0);
    tmpR =  b - (tmpQ * C2);
    ans = (a * tmpQ % C) * C2 % C + (a * tmpR);
    ans %= C;
    return ans;
}

function fastRuijoR(a, b, C, C2){
    var ans = 1;
    var binary = b.toString(2);
    var l = binary.length;
    var tmp = a;
    for (var i = 0; i < l; i++){
        if (binary.substr((i + 1) * -1, 1) == '1') ans = kakeruR(ans, tmp, C, C2);
    tmp = kakeruR(tmp, tmp, C, C2);
    }
    return ans;
}

function mod(i, j) {
    return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 

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


public class Main{

     public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<Integer> list = new ArrayList<>();
        
        for(int i=0;i<2*n;i++)
        list.add(scanner.nextInt());
        
        Collections.sort(list);
        int sum=0;
        for(int i=0;i<2*n;i=i+2)
        sum+=list.get(i);
        
      
        System.out.println(sum);
        //for(int i=0;i<n;i++);
        //int n = scanner.nextInt();
        //String n = scanner.next();
        //System.out.println("");
     }
}

Measured memory_bytes: 36188
#import time

def main():
    K = int(input())
    S = input()
    if len(S) <= K:
        return S
    else:
        return S[:K] + "..."

if __name__ == '__main__':
    #start = time.time()
    print(main())
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

Measured memory_bytes: 9096
#include <stdio.h>

int main() {
	int a, b;

	scanf("%d%d", &a, &b);
	printf(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 ? "Possible\n" : "Impossible\n");
	return 0;
}


Measured memory_bytes: 128
A, B = map(int, input().split())
a , c = 0, 0
ans = 0

if B > A:
  c = B
  B = A
  A = c
 
for i in range(1, B+1):
  a = A * i
  if ans != 0:
    break
  if a % B == 0:
    ans = a
    break
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
set<int> s;
map<int,int> mp;
int n;
int main() {
    cin>>n;
    for(int i=0;i<n;i++) {
        int x;
        cin>>x;
        s.insert(x);
        mp[x]++;
    }
    int ans=0;
    for(set<int>::iterator it=s.begin();it!=s.end();it++) {
        if(mp[*it]<*it) ans+=mp[*it];
        else if(mp[*it]>*it) ans+=mp[*it]-*it;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n,k,ans=1;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		if(ans*2>ans+k)ans=ans+k;
		else ans=ans*2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3540