akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll number1, ll number2)
{
    return number1 * number2 / gcd(number1, number2);
}
template <class T>
bool contain(const std::string &s, const T &v)
{
    // contain(to_string(N), '3')
    return s.find(v) != std::string::npos;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
        return c - '0';
    return 0;
}
using namespace std;

void transpose(vector<vector<char>> &b)
{
    if (b.size() == 0)
        return;

    vector<vector<char>> trans_vec(b[0].size(), vector<char>());

    for (int i = 0; i < b.size(); i++)
    {
        for (int j = 0; j < b[i].size(); j++)
        {
            trans_vec[j].push_back(b[i][j]);
        }
    }

    b = trans_vec; // <--- reassign here
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;

    vector<ll> a(n), b(n), c(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    rep(i, n)
    {
        cin >> b[i];
    }
    rep(i, n - 1)
    {
        cin >> c[i];
    }
    ll ans = 0;
    rep(i, n)
    {
        ans += b[a[i] - 1];
        if (i != n)
        {
            if (a[i] + 1 == a[i + 1])
            {
                ans += c[a[i] - 1];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

string s;
long long n;
bool c, f;

int main() {
	cin >> s;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'C') {
			c = true;
			continue;

		}

		if (c && s[i] == 'F')
			f = true;
	}
	if (c && f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;


int main(){
  vector<int> sqd(501);
  sqd[0] = 0;
  for(int i = 1; i < 501; i++){
    sqd[i] = i * i;
  }
  int a, b;
  cin >> a >> b;
  int t = 0;
  if(b != 0){
    t = a * (int)pow(10,(int)log10(b) + 1) + b;
  }else{
    t = a * 10 + b;
  }
  int f = 0;
  for(int i = 500; i >= 1 ; i--){
    if(sqd[i] == t){
      f = 1;
      break;
    }else if(sqd[i] < t) break;
  }
  if(f) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
using namespace std;

vector<int> v(7368792);

int erast(int m,int n){
	for(int i=m;i<=7368791;i++){
		v[i] = 1;
	}
	int cnt = 0;
	for(int i=m;i<=7368791;i++){
		if(v[i]){
			if(cnt==n) return i;
			cnt++;
			for(int j=0;i*(j+2)<=7368791;j++){
				v[i*(j+2)]=0;
			}
		}
	}
}

int N,M;
int main(){
	while(cin >> M >> N && M>0){
		cout << erast(M,N) << endl;
	}
}


Measured memory_bytes: 31428
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, long long d, std::vector<long long> x, std::vector<long long> y){
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        cnt += x[i] * x[i] + y[i] * y[i] <= d * d;
    }
    cout << cnt << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long D;
    scanf("%lld",&D);
    std::vector<long long> X(N);
    std::vector<long long> Y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&Y[i]);
    }
    solve(N, D, std::move(X), std::move(Y));
    return 0;
}


Measured memory_bytes: 6352
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>

using namespace std;

int main() {
    int a;
    vector<int> vec;

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

    sort(vec.begin(), vec.end(), greater<int>());

    for (int i=0; i < vec.size(); i++) {
        cout << vec[i];
        if (i != vec.size() - 1) cout << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1216
N, Y = map(int, input().split())
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 0 <= z and 10000*x + 5000*y + 1000*z == Y:
            print(x,y,z)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 9012
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#define DEBUG

int main()
{
    int a, b;
    //read
    scanf("%d %d", &a, &b);

    //solve
    int ans = 1;
    int sum = a;
    while (true)
    {
        if(b == 1)
        {
            ans = 0;
            break;
        }
        if(sum >= b)
        {
            goto OUT;
        }
        if(sum < b)
        {
            sum += a - 1;
        }
        ans++;
    }
    
    //write
    OUT:
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 128
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int A, B, C;
	std::cin >> A >> B >> C;
	if (A == B && B != C)
		std::cout << "Yes\n";
	else if (B == C && C != A)
		std::cout << "Yes\n";
	else if (C == A && A != B)
		std::cout << "Yes\n";
	else
		std::cout << "No\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

const int maxx = 100000 + 10;
struct Node {
	int key;
	Node *prev, *next;
};

Node *nil;

// ?????¨????§????
void init() {
	//nil = (Node *)malloc(sizeof(Node));
	nil = new Node();
	nil->next = nil;
	nil->prev = nil;
}

// ????????¨????´¢?????????key????????? O(n)
Node* listSearch(int key) {
	// ????????¨??´??????????§???????
	Node *cur = nil->next;
	while (cur != nil && cur->key != key) {
		cur = cur->next;
	}
	return cur;
}

// ?????°?????¨
void printList() {
	Node *cur = nil->next;
	int flag = 0;
	while (cur != nil) {
		if (flag++ > 0)
			printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

// ????????????t
void deleteNode(Node *t) {
	// t?????´??????????????????
	if (t == nil)
		return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	//free(t);
	delete(t);
}

// ????????´??????
void deleteFirst() {
	deleteNode(nil->next);
}

// ???????°???????
void deleteLast() {
	deleteNode(nil->prev);
}

// ???????????????key O(n)
void deleteKey(int key) {
	deleteNode(listSearch(key));
}

// ??¨?????¨??´??¨??????????´?key
void insert(int key) {
	//Node *x = (Node *)malloc(sizeof(Node));
	Node *x = new Node();
	x->key = key;

	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}
int main() {
	int n, key, size = 0;
	char op[20];
	scanf("%d", &n);
	getchar();
	// ????§?????????¨
	init();
	for (int i = 0; i < n; i++) {
		scanf("%s %d", op, &key);
		if (op[0] == 'i') {
			insert(key);
			size++;
		}else {
			if (strlen(op) > 6) {
				if (op[6] == 'F') {//????????´??????
					deleteFirst();
				}else {//???????°???????
					deleteLast();
				}
			}
			else { //????????????
				deleteKey(key);
			}
			size--;
		}
	}
	printList();
	return 0;
}

Measured memory_bytes: 34368
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
//これは、頭が悪く競プロが世界で一番できないHIR180が
//IOI2014日本代表になるまでのN日間の記録である。
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
int x1[1005],x2[1005],y11[1005],y2[1005];
bool ok[4005][4005]={};
int main()
{
	srand((unsigned int)time(NULL));
	while(1)
	{

	int n,m,k; scanf("%d%d%d",&n,&m,&k);
	if(!n) return 0;
	vector<int>x(0),y(0);
	x.pb(0); y.pb(0);
	x.pb(n-1); y.pb(m-1);
	for(int i=0;i<k;i++)
	{
		scanf("%d%d%d%d",&x1[i],&y11[i],&x2[i],&y2[i]);
		if(x1[i]) x.pb(x1[i]-1);
		if(x1[i]<n) x.pb(x1[i]);
		if(x2[i]) x.pb(x2[i]-1);
		if(x2[i]<n) x.pb(x2[i]);
		if(y11[i]) y.pb(y11[i]-1);
		if(y11[i]<m)y.pb(y11[i]);
		if(y2[i]) y.pb(y2[i]-1);
		if(y2[i]<m) y.pb(y2[i]);
	}
	sort(x.begin(),x.end()); sort(y.begin(),y.end());
	x.erase(unique(x.begin(),x.end()),x.end()); y.erase(unique(y.begin(),y.end()),y.end());
	memset(ok,0,sizeof(ok));
	for(int i=0;i<k;i++)
	{
		int minx=lower_bound(x.begin(),x.end(),x1[i])-x.begin();
		int maxx=lower_bound(x.begin(),x.end(),x2[i]-1)-x.begin();
		int miny=lower_bound(y.begin(),y.end(),y11[i])-y.begin();
		int maxy=lower_bound(y.begin(),y.end(),y2[i]-1)-y.begin();
		for(int a=minx;a<=maxx;a++)
		{
			for(int b=miny;b<=maxy;b++)
			{
				ok[a][b]=true;
			}
		}
	}
	int ret=0;
	/*for(int i=0;i<x.size();i++)
	{
		for(int j=0;j<y.size();j++)
		{
			printf("%c",ok[i][j]?'#':'.');
		}
		puts("");
	}*/
	for(int i=0;i<x.size();i++)
	{
		for(int j=0;j<y.size();j++)
		{
			if(ok[i][j]) continue;
			ret++;
			queue<P>que;
			que.push(mp(i,j));
			int dx[4]={0,1,0,-1};
			int dy[4]={1,0,-1,0};
			while(!que.empty())
			{
				P p=que.front(); que.pop();
				int xq=p.f; int yq=p.s;
				if(ok[xq][yq]) continue;
				ok[xq][yq]=true;
				for(int k=0;k<4;k++)
				{
					int nx=xq+dx[k];
					int ny=yq+dy[k];
					if(!(0<=nx&& nx<x.size())) continue;
					if(!(0<=ny&& ny<y.size())) continue;
					if(ok[nx][ny]) continue;
					que.push(mp(nx,ny));
				}
			}
		}
	}
	printf("%d\n",ret);
	
	}
}

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

int main()
{
	int N, K;

	cin >> N >> K;

	int ans = 1;
	for(int i = 0; i < N; i++)
		ans = min(ans * 2, ans + K);
	
	cout << ans << endl;
	return 0;
}


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

int main(){
    i64 n,k,b;
    cin>>n>>k;
    bool a[n];
    for(i64 i=0;i<n;i++) a[i]=false;
    for(i64 i=0;i<k;i++){
        cin>>b;
        vector<i64> c(b);
        for(i64 j=0;j<b;j++){
            cin>>c[j];
        }
        for(i64 j=0;j<b;j++){
            a[c[j]-1]=true;
        }
    }
    i64 ans=0;
    for(i64 i=0;i<n;i++){
        if(a[i]==false) ans++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3604
def main():
    a, b, k = map(int, input().split())

    if a == b == 0:
        print(0, 0)
        return

    if k <= a:
        a -= k
    else:
        if k - a <= b:
            b -= k - a
        else:
            b = 0
        a = 0

    print(a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lli=long long int;
#define rep(i, n) for (int i = 1; i <= (int)(n); i++)
using vi=vector<int>;  using vs=vector<string>; using gi=greater<int>;
#define soao(c) sort((c).begin(),(c).end()) //昇順
#define sodo(c) sort((c).begin(),(c).end(),gi()) //降順
#define rev(c) reverse((c).begin(), (c).end())

int main() {
  int a,b; cin>>a>>b;
  rep(n,1000){
    int A=n*0.08;
    int B=n*0.1;
    if(A==a&&B==b){
      cout<<n<<endl;
      goto end;
    }
  }
  cout<<"-1"<<endl;
  end:;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>

using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

#define MOD (1000000000+7)

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

int main() {
    int N, K;
    cin >> N >> K;
    int mk = (N-1)*(N-2)/2;
    if ( K > mk ) {
        cout << -1 << endl;
    } else {
        int M = N - 1 + mk - K;
        cout << M << endl;
        REP(i, N-1) {
            cout << 1 << " " << i+2 << endl;
        }
        int a = 2;
        int b = 3;
        REP(i, mk-K) {
            cout << a << " " << b << endl;
            b++;
            if (b > N) {
                a++;
                b = a+1;
            }
        }
    }
}


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

//var 
int N,a[100001],b[100001],c[100001], dp[100001][3];

int main(){
	cin >> N;
	for(int i = 1; i<= N; i++)cin >> a[i] >> b[i] >> c[i];
	dp[1][0] = a[1]; dp[1][1] = b[1]; dp[1][2] = c[1];
	for(int i = 2; i<=N; i++){
		dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][1],dp[i-1][0]) + c[i];
	}cout << max(max(dp[N][0],dp[N][1]),dp[N][2]) << endl;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
int A,B,C,D;
  cin>>A>>B>>C>>D;
  int ans=0;
  if (A>=B){
    ans+=B;
  }
  else ans+=A;
  if (C>=D){
    ans+=D;
  }
  else ans+=C;
  cout<< ans << endl;
 return 0;}


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

const int MAX = 10;

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

    while(true){
        int n;
        cin >> n;
        if(n == 0) break;

        int E[MAX][MAX];
        for(int i = 0; i < MAX; i++){
            for(int j = 0; j < MAX; j++){
                if(i == j) E[i][j] = 0;
                else E[i][j] = 1e9;
            }
        }

        map<int, bool> mp;
        for(int i = 0; i < n; i++){
            int a, b, c;
            cin >> a >> b >> c;
            mp[a] = true;
            mp[b] = true;
            E[a][b] = c;
            E[b][a] = c;
        }
        
        for(int i = 0; i < MAX; i++){
            for(int j = 0; j < MAX; j++){
                for(int k = 0; k < MAX; k++){
                    E[j][k] = min(E[j][i] + E[i][k], E[j][k]);
                }
            }
        }

        int idx, cost = 1e9;
        for(int i = 0; i < MAX; i++){
            if(!mp[i]) continue;
            int tmp = 0;
            for(int j = 0; j < MAX; j++){
                if(mp[j]) tmp += E[i][j];
            }
            if(cost > tmp){
                idx = i;
                cost = tmp;
            }
        }

        cout << idx << ' ' << cost << endl;
    }

    return 0;
}


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

typedef long long lint;
typedef unsigned long long ulint;
const int MOD=1000000007;

int main(){
    int N,K;
    int A[100000];
    cin >> N >> K;
    for(int i=0;i<N;i++) cin >> A[i];

    int one;
    for(int i=0;i<N;i++){
        if(A[i]==1){
            one=i;
            break;
        }
    }

    int left=(one+K-2)/(K-1);
    int nokori=(N-one-1)-(left*(K-1)-one);
    int right=(nokori+K-2)/(K-1);
    cout << left+right << endl;

    return 0;
}

Measured memory_bytes: 640
// In The Name Of Allah
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
const ll mod = 1e9 + 7;
 
 
void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
 
const ll M = 400 + 10;
const ll N = 100 * 1000 + 10;
 
ll a[N];
 
int main()
{
	faster();
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll ans = a[0] - 1, cnt = 2;
	for (int i = 1; i < n; i++)
	{
		if(a[i] == cnt)
			cnt++;
		ans += (a[i] - 1) / cnt;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main() {
  int n,a[10][10],b[100],c[10][10];
  for(int i = 0; i < 3; i++) {
    for(int j = 0; j < 3; j++) {
      cin >> a[i][j];
      c[i][j] = 0;
    }
  }
  cin >> n;
  for(int i = 0; i < n; i++)
    cin >> b[i];

  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 3; j++) {
      for(int k = 0; k < 3; k++) {
        if(b[i] == a[j][k]) 
          c[j][k] = 1;
      }
    }
  }
  for(int i = 0; i < 3; i++) {
    if(c[i][0] == 1 & c[i][1] == 1 & c[i][2] == 1) {
      cout << "Yes" << endl;
      return 0;
    }
    if(c[0][i] == 1 & c[1][i] == 1 & c[2][i] == 1) {
      cout << "Yes" << endl;
      return 0;
    }
    if(c[0][0] == 1 & c[1][1] == 1 & c[2][2] == 1) {
      cout << "Yes" << endl;
      return 0;
    }
    if(c[0][2] == 1 & c[1][1] == 1 & c[2][0] == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>



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


map<string, int> mp;
#define ll long long

ll a, b, x;

ll f(ll i) {
    if (i == -1) return 0;
    else return i / x + 1;
}

int main() {
    cin >> a >> b >> x;

    
    cout << f(b) - f(a - 1) << endl;


    return 0;
}

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

int main() {
  int a,b,d,r;
  double f;
  cin >> a >> b;
  d=a/b;
  r=a%b;
  f=(double)a/(double)b;
  cout << fixed;
  cout << setprecision(8) << d << ' '<< r<<' '<<  f << endl;
}



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

using namespace std;

#pragma GCC optimize ("-O3")

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define vll vector<ll> 
#define vs vector<string>
#define vc vector<char>
#define vpll vector<pair<ll,ll> >
#define tc ll t=0;cin>>t;while(t--)
#define pb push_back
#define pop pop_back
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define maxe *max_element
#define mine *min_element
#define f first
//#define s second
#define vli vll::iterator 
#define mp make_pair
#define unmap unordered_map
#define unmapll unordered_map<ll,ll>
#define max_val 99999999
#define min_val -99999999
#define mod 1000000007
const ld PI = 3.141592653589793;

bool isPowerOfTwo (int x) 
{ 
  return x && (!(x&(x-1))); 
} 

int main()
{
    IOS
    #ifdef LOCAL
            freopen("C:\\Users\\Just Coding Things\\Codeforces\\input.txt","r",stdin);
            freopen("C:\\Users\\Just Coding Things\\Codeforces\\output.txt","w",stdout);
        #endif
        ll k,i;
        cin>>k;
        string st;
        cin>>st;
        ll sz=st.size();
        if(sz<=k)
     {
		 for(i=0;i<sz;i++)
        cout<<st[i];
    }
    else if(sz>k)
    {
    	for(i=0;i<k;i++)
        cout<<st[i];
        cout<<"...";
	}
    
		return 0;
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
	int n, m, k;
	while(cin >> n >> k >> m, n){
		int stone[10000];
		for(int i=0;i<n;i++) stone[i] = i+1;
		int pos = m-1, size = n;
		while(size != 1){
			for(int i=pos;i<size;i++) stone[i] = stone[i+1];
			size--;
			pos = (pos+k-1)%size;
		}
		printf("%d\n", stone[0]);
	}
}

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

int main()
{
	long long int n,m;

	scanf("%lld%lld",&n,&m);
	if(n==1 || m==1)
	{
		printf("1");
		return 0;
	}

	printf("%lld",(n*m+1)/2);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

struct edge{ int to,cost; };
const int N = 2e5+10;
vector<vector<edge>> G(N);
vector<int> d(N,0),dp(N);

void dfs1(int u,int pre){
  for(auto e : G[u]){
    if(e.to == pre) continue;
    dfs1(e.to,u);
    d[u] = max(d[u],d[e.to] + e.cost);
  }
}

int dfs2(int u,int pre,int d_par){
  vector< pair<int,int> > v;
  v.push_back({0,-1});
  for(auto e : G[u]){
    if(e.to == pre) v.push_back({d_par + e.cost,e.to});
    else v.push_back({e.cost + d[e.to],e.to});
  }
  sort(v.rbegin(),v.rend());

  int res = v[0].first;
  for(auto e : G[u]){
    if(e.to == pre) continue;
    bool child = (v[0].second == e.to); //e.toがuの部分木かどうか
    dfs2(e.to,u,v[child].first);
  }
  return dp[u] = res;
}

//頂点iを根とした時の木の高さ
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_B&lang=ja
signed main(){

  int n; cin >> n;
  for(int i = 0; i < n-1; i++){
    int s,t,w; cin >> s >> t >> w;
    G[s].push_back({t,w});
    G[t].push_back({s,w});
  }

  dfs1(0,-1);
  dfs2(0,-1,0);
  for(int i = 0; i < n; i++){
    cout << dp[i] << endl;
  }

  return 0;
}



Measured memory_bytes: 13432
// ABC163-D Sum of Large Numbers
#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

signed main() {
    long long n, k;
    long long ans, a, b;

    cin >> n >> k;
    
    ans = 0;
    for(long long i=k ;i<=n+1 ;i++ ) {
        a = i * (2 * n - i + 1) / 2; // 選べる最大値
        b = i * (i - 1) / 2; // 選べる最小値

        ans = (a - b + 1 + ans) % MOD;
    }

    cout << ans << endl;

    return (0);
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
  int n;
  string s;
  cin >> n >> s;
 
  int white = 0;
  for (int i = 0; i < n; i++)
    if (s[i] == '.')
      white++;

  int w = 0; 
  int minChange = white;
  for (int i = 0; i < n; i++) {
    if (s[i] == '.')
      w++;
    int change = (white - w) + i + 1 - w;
    minChange = min(minChange, change);
  }
 
  cout << minChange << endl;
  return 0;
}

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

int main() {
        int n;
        scanf("%d", &n);
        vector<int> a(n);
        for (int i = 0; i < n; i ++) scanf("%d", &a[i]);
        long long res = 1;
        for (int i = 0; i < n; i ++) if (a[i] % 2 == 0) res *= 2;
        long long all = pow(3, n);
        printf("%lld\n", all - res);
        return 0;
}



Measured memory_bytes: 640
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [10 ** 10] * (n + k)
h += [10 ** 10] * k
dp[0] = 0

for i in range(n):
    for j in range(1, k + 1):
        cost = abs(h[i] - h[i + j])
        dp[i + j] = min(dp[i + j], dp[i] + cost)

print(dp[n - 1])


Measured memory_bytes: 52448
function bomb(y,arr){
   if(y==Y){
      var sum=0;
      for(var i=0;i<X;i++){
         var cnt=0;
         for(var j=0;j<Y;j++){
            if(arr[j][i]==0)cnt++;
         }
         sum+=Math.max(cnt,Y-cnt);
      }
      max=Math.max(max,sum);
      return;
   }
   bomb(y+1,arr);
   if(y==-1)return;
   arr[y].forEach(function(v,i){arr[y][i]=1-v;});
   bomb(y+1,arr);
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var rc=Arr.shift().split(" ").map(Number);
   var Y=rc[0];
   var X=rc[1];
   if(Y==0 && X==0)break;   
   var yx=[];
   for(var i=0;i<Y;i++){
      var v=Arr.shift().split(" ").map(Number);
      yx.push(v);
   }
   var max=0;
   bomb(-1,yx);
   console.log(max);
}

Measured memory_bytes: 11788
X = int(input())

if 400 <= X and X <= 599:
    print(8)
elif 600 <= X and X <=799:
    print(7)
elif 800 <= X and X <=999:
    print(6)
elif 1000 <= X and X <=1199:
    print(5)
elif 1200 <= X and X <=1399:
    print(4)
elif 1400 <= X and X <=1599:
    print(3)
elif 1600 <= X and X <=1799:
    print(2)
elif 1800 <= X and X <=1999:
    print(1)


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

int main() {
  
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if (N > K) {
    cout << K * X + (N - K) * Y << endl;      
  }
  else {
    cout << N * X << endl;  
  }
  
return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

int main() {
  int H,W;
  cin >> H >> W;
  bool F[110][110];
  for (int i = 0;i<H;i++) {
    for (int j = 0;j<W;j++) {
      char a;
      cin >> a;
      if (a == '.') F[i][j] = false;
      else F[i][j] = true;   //# = true
    }
  }
  
  ll dp[110][110];
  for (int i = 0;i<110;i++) {
    for (int j = 0;j<110;j++) {
      dp[i][j] = INF;
    }
  }
  bool iro;
  if (F[0][0]) {
    dp[0][0] = 1;
    iro = true;
  }
  else {
    dp[0][0] = 0;
    iro = false;
  }
  
  
  for (int i = 0;i<H;i++) {
    for (int j = 0;j<W;j++) {
      if (F[i][j] == F[i+1][j]) { //iro同じ
        chmin(dp[i+1][j],dp[i][j]);
      }
      else if (F[i][j]){ //iro違うかつ黒から白
        chmin(dp[i+1][j],dp[i][j]);
      }
      else if (F[i+1][j]) { //iro違うかつ白から黒
        chmin(dp[i+1][j],dp[i][j] + 1);
      }
      
      if (F[i][j] == F[i][j+1]) { //iro同じ
        chmin(dp[i][j+1],dp[i][j]);
      }
      else if (F[i][j]){ //iro違うかつ黒から白
        chmin(dp[i][j+1],dp[i][j]);
      }
      else if (F[i][j+1]) { //iro違うかつ白から黒
        chmin(dp[i][j+1],dp[i][j] + 1);
      }
    }
  }
  cout << dp[H-1][W-1] << endl;
}

      
      
      
      
      
  
  



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

int main() {
  int n;
  cin >> n;
  long long  pMod = 1000000007;
  long long  a[n];
  long long  tempsum = 0;
  long long  sum = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    tempsum += a[i];
    tempsum %= pMod;
  }
  for(int i = 0; i < n; i++) {
    tempsum -= a[i];
    if(tempsum < 0) tempsum += pMod;
    sum += tempsum * a[i];
    sum %= pMod;
  }
  cout << sum << endl;
}

Measured memory_bytes: 5196
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}
void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  // int n,k;
  // cin>>n>>k;
  // // ll ans=0;
  // // rep(i,1,n/k+1){
  // //   int left=n-i*k;
  // //
  // //   ans=(ans+nCr(left+i-1,i-1))%mod;
  // // }
  // ll dp[n][k];
  // rep(i,0,n) rep(j,0,i+1) dp[i][j]=
  // cout<<ans<<endl;
  string s;
  cin>>s;
  if(s[s.length()-1]!='s') s+="s";
  else s+="es";
  cout<<s<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    // pre();
    {solve();}
}


Measured memory_bytes: 7024
using System;

namespace ABC082A
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            double remind = (double)(a + b)/2.0; 
            int    remind2 = (int)Math.Floor((a + b)/2.0);
            if ( remind > remind2){
                Console.WriteLine("{0}", remind2+1);
            } else{
                Console.WriteLine("{0}", remind2);
            }
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
typedef long long ll;
using namespace std;
//#define int long long

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}

//互除法
ll gcd(ll a, ll b) {
	if (a < b) {
		return gcd(b, a);
	}
	else if (a%b) {
		return gcd(b, a%b);
	}
	else {
		return b;
	}
}

//異なるn個からr個の整数を取り出す組合せの数を求める
int combination(int n, int r) {
	if (r == 0 || n == r) {
		return 1;
	}
	else if (r == 1) {
		return n;
	}
	else {
		return combination(n - 1, r - 1) + combination(n - 1, r);
	}

}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor(int n) {
	map<int, int> res; // map[i]:=ｎを素因数分解したときiは何乗か。
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n] = 1;
	return res;
}

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

	int N, A, B;
	int res[3] = { 0 };

	cin >> N >> A >> B;

	for (int i = 0; i < N; i++)
	{
		int P;
		cin >> P;

		if (P <= A) {
			res[0]++;
		}else if(P>B){
			res[2]++;
		}
		else {
			res[1]++;
		}
	}

	cout << min(res[0],min(res[1],res[2])) << endl;

	return 0;
}


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


VI a[26];
VI b[26];

VI aa(26), bb(26);


int main() {


	string s, t;
	cin >> s >> t;

	int n = s.size();
	int m = t.size();
	
	REP(i, s.size()) {
		aa[s[i] - 'a']++;
		a[s[i] - 'a'].push_back(i);
	}
	REP(i, t.size()) {
		bb[t[i] - 'a']++;
		b[t[i] - 'a'].push_back(i);
	}

	REP(i, 26) {
		if (bb[i] != 0 && aa[i] == 0) {
			cout << -1 << endl;
			return 0;
		}
	}

	ll ans = 0;
	
	int cur = -1;

	REP(i, m) {
		int j = t[i] - 'a';
		int k = upper_bound(ALL(a[j]), cur) - a[j].begin();
		
		if (k == a[j].size()) {

			ans += n - cur;
			ans += a[j][0];
			cur = a[j][0];
		}
		else {
			ans += a[j][k] - cur;
			cur = a[j][k];
		}
		
	}


	cout << ans << endl;


}

Measured memory_bytes: 1724
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  ll X;

  cin >> X;
  ll cur=100;
  int ans=1;
  for(ans=1; (cur+=cur/100)<X; ans++){}
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N=scan.nextInt();
        int p=0;
for(int a=1;a<N;a++){
    for(int b=1;a*b<N;b++){p++;}
}

System.out.println(p);
    }
}



Measured memory_bytes: 27208
s = input()
 
if s == 'SUN':
  print(7)
elif s == 'MON':
  print(6)
elif s == 'TUE':
  print(5)
elif s == 'WED':
  print(4)
elif s == 'THU':
  print(3)
elif s == 'FRI':
  print(2)
elif s == 'SAT':
  print(1)

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

int main()
{
int A;
int B;
int N[ 5 ];

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> A;
	cin >> B;

	N[ 0 ] = A + B;
	N[ 1 ] = A - B;
	N[ 2 ] = A * B;

	sort( N, N + 3 );

	cout << N[ 2 ] << endl;

	return 0;
}






Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func mul(a int64, b int64) int64 {
	return (a * b) % mod
}

func power(x int64, y int64) int64 {
	if y == 0 {
		return 1
	} else if y%2 == 0 {
		ans := int64(power(x, y/2)) % mod
		ans = mul(ans, ans)
		return ans
	} else {
		ans := int64(power(x, y/2)) % mod
		ans = mul(mul(ans, ans), x)
		return ans
	}
}

var mod = int64(1000000007)

func comb(n int, k int) int64 {
	x := int64(1)
	for i := 0; i < k; i++ {
		x = mul((int64(n - i)), x)
		x = mul(power(int64(i+1), mod-2), x)
	}
	return x
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := nextInt()
	b := nextInt()

	ans := power(2, int64(n)) - 1
	ans %= mod
	if ans < 0 {
		ans += mod
	}
	ans = ans - comb(n, a)
	ans %= mod
	if ans < 0 {
		ans += mod
	}
	ans = ans - comb(n, b)
	ans %= mod
	if ans < 0 {
		ans += mod
	}
	fmt.Println(ans)
}


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

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  vector<int> count(N);
  for (int i = 0; i < Q; i++) {
    cin >> A.at(i);
    count.at(A.at(i) - 1)++;
  }
  
  for (int j = 0; j < N; j++) {
    if (Q - count.at(j) < K) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

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

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

  string X, Y;
  cin >> X >> Y;
  if(X < Y){
    cout << "<" << endl;
  }else if(Y < X){
    cout << ">" << endl;
  }else{
    cout << "=" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>

int P[4]={1,10,100,1000};

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    int c=a*P[int(log10(b))+1]+b;
    if(sqrt(c)==int(sqrt(c))) printf("Yes");
    else printf("No");
}


Measured memory_bytes: 128
#!/usr/bin/python3
# -*- coding: utf-8 -*-

#
# This problem can be solved smarter. But this example shows simple method
#

import sys

while True:
    s = sys.stdin.readline().strip()
    if s == '-':
        break
    n = int(sys.stdin.readline())
    for i in range(n):
        h = int(sys.stdin.readline())
        s = s[h:] + s[:h]
    print(s)



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
using namespace std;
const int MX = 1e5+5;
int n,k;
vector<int> v;
int dp[MX];

int solve(int pos){
    if(pos > n) return 1e17;
    if(pos == n) return 0;
    if(dp[pos] != -1) return dp[pos];
    int ans = 1e17,curr_height = v[pos],next_height;
    for(int i=1 ; i<=k ; i++){
        if(pos+i <= n){
            next_height = v[pos + i];
            ans = min(ans, solve(pos + i) + abs(curr_height - next_height));
        }
    }
    return dp[pos] = ans;
}


int32_t main()
{
    memset(dp,-1,sizeof dp);
    cin>>n>>k;
    v.resize(n+1);
    for(int i=1 ; i<=n ; i++) cin>>v[i];
    cout<<solve(1);
    return 0;
}


Measured memory_bytes: 8064
s = input()
n = len(s)

for i in range(n-1 if(n%2==1) else n-2,0, -2):
    nx = i // 2
    #print("{} {}".format(s[0:nx],s[nx:i]))
    if (s[0:nx] == s[nx:i]):
        print(i)
        exit()
else:
    print(0)

Measured memory_bytes: 3064
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
import math
def top(A):
    s = 0
    for i in range(0,len(A)):
        if A[i] > A[0]:
            s = s + 1
    return s
def count(A):
    t = 0
    for i in range(1,N):
        t = t + top(A) * math.factorial(N-i)
        A.pop(0)
    return t
a = abs(count(P)-count(Q))
print(a)

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

typedef long long ll;

const int MAXN = 50;
const int MOD = 1e9 + 7;

struct matrix{

	ll mat[MAXN][MAXN];

	matrix(int idd = 0){
		for(int i = 0;i<MAXN;i++){
			for(int j = 0;j<MAXN;j++){
				mat[i][j] = (idd) ? (i == j) : (0);
			}
		}
	}

	matrix operator*(const matrix& other)const{
		matrix ans;
		for(int i = 0;i<MAXN;i++){
			for(int j = 0;j<MAXN;j++){
				for(int k = 0;k<MAXN;k++){
					ans.mat[i][j] += mat[i][k]*other.mat[k][j];
					if(ans.mat[i][j] > MOD) ans.mat[i][j] %= MOD;
				}
			}
		}
		return ans;
	}

};

matrix exponentiation(matrix base, ll K){

	matrix ans(1);

	for(int i = 0;(1LL << i) <= K;i++){
		if((1LL << i) & K) ans = ans*base;
		base = base*base;
	}

	return ans;

}

int main(){

	matrix base;
	int N;
	ll K;
	cin >> N >> K;
	for(int i = 0;i<N;i++){
		for(int j = 0;j<N;j++) cin >> base.mat[i][j];
	}

	matrix ans = exponentiation(base,K);
	ll paths = 0;
	for(int i = 0;i<N;i++){
		for(int j = 0;j<N;j++){
			paths = (paths + ans.mat[i][j]) % MOD;
		}
	}

	cout << paths << endl;

	return 0;

}

Measured memory_bytes: 3572
import scala.math._

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val p = List.fill(n)(sc.nextLong)

  val middle = p.size / 2
  val sorted = p.sorted
  val ans = sorted(middle) - sorted(middle - 1)

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)
}

Measured memory_bytes: 59160
N = int(input())
S = input()
ans = ''
alpha2num = lambda c: ord(c) - ord('A') + 1
num2alpha = lambda c: chr(c+64)
for i in range(0,len(S)):
    y = alpha2num(S[i]) + N
    if y > 26:
        y -= 26
    ans += num2alpha(y)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

long long mod = 1e9 + 7;

template <typename T>
T modpow(T x, T n, const long long p)
{
    long long ret = 1;
    for(int i=0; i<n; i++){
        ret *= x;
        ret %= mod;
    }
    return ret;
}

int ans(int n)
{
    long long ans = modpow(10, n, mod) % mod - (modpow(9, n, mod) % mod * 2 - modpow(8, n, mod) % mod) % mod;
    return ans % mod;
}

int main()
{
    int n;
    cin >> n;
    if (n > 2)
    {
        int answer = ans(n);
        answer += answer < 0 ? mod : 0;
        cout << answer << endl;
    }
    else
    {
        if (n == 1)
        {
            cout << 0 << endl;
        }
        else
        {
            cout << 2 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <queue>
#include <numeric>

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

using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  priority_queue<int> a;
  rep(i, n)
  {
    int tmp;
    cin >> tmp; a.emplace(tmp);
  }
  rep(i, m)
  {
    int tmp = a.top() / 2;
    a.pop();
    a.emplace(tmp);
  }
  ll ans = 0;
  while(!a.empty())
  {
    ans += a.top();
    a.pop();
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 892
#include<iostream>

using namespace std;

int main()
{
  while(true){
    int A,B;
    cin >> A >> B;
    if( A == 0 && B == 0 ) break;
    int C = B-A;
    
    int n100=0,n500=0,n1000=0;
    while(C>=1000){
      C-=1000;
      n1000++;
    }
    while(C>=500){
      C-=500;
      n500++;
    }
    while(C>=100){
      C-=100;
      n100++;
    }
    printf("%d %d %d\n", n100, n500, n1000);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int cnt[2][101010];

int main(){
  int n;
  cin >> n;
  rep(i,0,n - 1){
    int a;
    cin >> a;
    cnt[i % 2][a]++;
  }
  int m = n / 2;
  int A = max_element(cnt[0],cnt[0] + 101010) - cnt[0];
  int B = max_element(cnt[1],cnt[1] + 101010) - cnt[1];
  int a = cnt[0][A];
  int b = cnt[1][B];
  int ans = a + b;
  if(A == B){
    cnt[0][A] = 0;
    cnt[1][B] = 0;
    ans = max(a + *max_element(cnt[1],cnt[1] + 101010),b + *max_element(cnt[0],cnt[0] + 101010));
  }
  cout << n - ans << endl;
}


Measured memory_bytes: 1024
def resolve():
    import math
    n = int(input())
    a = list(map(int, input().split()))
    ava = sum(a)/len(a)
    floor =math.floor(ava)
    ceil = math.ceil(ava)
    if abs(floor-ava) <= abs(ceil-ava):
        ava = floor
    else:
        ava = ceil
    ans = []
    for i in range(len(a)):
        ans.append((a[i]-ava)**2)
    print(sum(ans))
resolve()

Measured memory_bytes: 38384
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  s <- getLine
  k <- readInt
  putStrLn $ go s k

go :: String -> Int -> String
go [] k = ""
go (x:[]) k = [toEnum $ (fromEnum x - fromEnum 'a' + k) `mod` 26 + fromEnum 'a']
go (x:xs) k =
  let countA = (26 - (fromEnum x - fromEnum 'a')) `mod` 26 in
  if k < countA
  then x : go xs k
  else 'a' : go xs (k - countA)


------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFormat :: Double -> String
doubleFormat = Text.Printf.printf "%.12f"


Measured memory_bytes: 5116
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
typedef long long ll;

int main(){
    int N ,Q;
    cin >> N >> Q;
    vector<int> w(N+1,0);
    vector<int> v[N+1];
    rep(i,N-1){
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    rep(i,Q){
        int p,x;
        cin >> p >> x;
        w[p]+=x;
    }

    queue<int> que;
    vector<bool> visit(N+1,false);
    que.push(1);
    while(!que.empty()){
        int cur=que.front();
        visit[cur]=true;
        que.pop();
        for(int next : v[cur]){
            if(visit[next]) continue;
            
            w[next]+=w[cur];
            que.push(next);
        }
    }

    rep2(i,1,N+1) cout << w[i] << " ";
    cout << endl;

}

Measured memory_bytes: 15604