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

#define rep(i,N) for(int i=0; i<(N); i++)
#define pb push_back

typedef long long ll;
typedef pair<int,int> P;
const ll mod=1e9+7;

map<ll,ll> mp;

bool is_prime(ll n){
	if(n==1) return true;
	int cnt=0;
	for(int i=1; i<=sqrt(n); i++){
	if(n%i==0){
		ll a=i;
		ll b=n/i;
		cnt++;
		if(a!=b) cnt++;
	}
	}
	if(cnt==2) return true;
	else return false;
}

ll A,B;
ll ans;

int main(){ 

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

cin>>A>>B;

for(int i=1; i<=sqrt(A); i++){
	if(A%i==0){
		ll a=i;
		ll b=A/i;
		mp[a]++;
		if(a!=b) mp[b]++;
	}
}
for(int i=1; i<=sqrt(B); i++){
	if(B%i==0){
		ll a=i;
		ll b=B/i;
		mp[a]++;
		if(a!=b) mp[b]++;
	}
}

map<ll,ll>::iterator it;
  for(it = mp.begin(); it!=mp.end(); it++){
    ll n1=it->first;
    ll n2=it->second;
    if(n2==2){
    	if(is_prime(n1)) ans++;
    }
}

cout<<ans<<endl;


}


Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	ll x,y=100ll;
	int ans = 0;
	std::cin >> x;
	while(y<x){
		y += y/100;
		++ans;
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3632
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ratio
import Data.Ord
import Data.Array.IO
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete

swap c [x,y]
  | c==x = y
  | c==y = x
  | otherwise = c

main = map (wordsBy (==',')) . lines <$> getContents >>= putStrLn . foldl swap "A"

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

int main(){
    int n;
    cin >> n;
    long long nagasa,trans;
    //int array[n];
    vector<long long> v;
    int ans = 0;
    string s;
    set<string> ss;

    for (int i = 0; i < n; i++){
        cin >> s;
        //nagasa = s.length();
        //trans = 0;
        /*
        for (int j = nagasa; j > 0; j--){
            trans += ((s[nagasa-j]-'a')+1) * pow(27,j-1);
        }
        */
            //auto itr = find(v.begin(),v.end(),trans);
        /*
        if(!binary_search(v.begin(),v.end(),trans)){
            v.push_back(trans);
            ans += 1;
            sort(v.begin(),v.end());
        }
        */
       ss.emplace(s);
    }
    cout << ss.size()<< endl;
}

Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {

  int a,b; cin>>a>>b;
  int ans=0;

  if(a>=1&&a<=9){ans++;}
  if(b>=1&&b<=9){ans++;}
  
  if(ans==2){cout<<a*b<<endl;}
  else{cout<<-1<<endl;}
  
}

Measured memory_bytes: 3600
#include<iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int flag = 0;
	for (int i = 0; i <= 25; i++) {
		for (int j = 0; j <=15; j++) {
			if ((4 * i + 7 * j) == N) {
				
				flag = 1;
			}
		}
	}
	if (flag)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

const ll MOD = 1000000007;

struct mint {
    ll x;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    mint operator-() const {
        return mint(-x);
    }
    mint &operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t / 2);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

ostream &operator<<(ostream &os, const mint &a) {
    return os << a.x;
}

struct counting {
    vector<mint> fact, ifact;
    counting(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint nCk(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    mint nPk(int n, int k) {
        return fact[n] * ifact[n - k];
    }
    mint factorial(int n) {
        return fact[n];
    }
} c(1000009);

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

    if (N > M) {
        cout << 0 << endl;
        return 0;
    }

    mint ans = c.nPk(M, N);
    mint b   = 0;
    for (int i = 1; i <= N; ++i) {
        mint k = c.nCk(N, i)*c.nPk(M-i,N-i);
        if (i % 2 == 1) {
            b += k;
        } else {
            b -= k;
        }
    }
    cout << ans * (ans-b) << '\n';
}


Measured memory_bytes: 18584
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
const double EPS = 1e-8;
#define Scan(a) int a;scanf("%d", &a);
#define ScanS(a) char a[500];scanf("%s", a);
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1LL)
#define bitset(a,b)      ( a |= (1LL << b))
#define bitunset(a,b)    (a &= ~(1LL << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
pii Dir[8] = {
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};


pii operator+(pii obj, pii obj2) {
	return MP(obj.first + obj2.first, obj.second + obj2.second);
}
pii operator-(pii obj, pii obj2) {
	return MP(obj.first - obj2.first, obj.second - obj2.second);
}

int main() {
	string str;
	cin >> str;

	string str2;
	for (auto itr : str)
		if (itr != 'x') str2 += itr;

	bool f = 1;
	REP(i, str2.length() / 2) {
		if (str2[i] != str2[str2.length() - i - 1]) {
			f = 0;
			break;
		}
	}
	if (!f) {
		printf("-1\n");
		return 0;
	}
	int str2c = 0, str2f = 0,fxc = 0, sxc = 0;
	REP(i, str.length()) {
		fxc = i;
		if (str2[str2c] == str[i]) {
			str2c++;

			if (str2c == (str2.length() + 1) / 2) {
				break;
			}
		}
	}

	for (int i = str.length() - 1; 0 <= i; i --) {
		sxc = i;

		if (str2[str2.length() - str2f - 1] == str[i]) {
			str2f++;

			if (str2f == (str2.length() + 1) / 2) {
				break;
			}
		}
	}
	int ans = 0;
	int i = 0, j = str.length()-1;
	while (1) {
		if (i == fxc && j == sxc)
			break;
		if (str[i] != str[j]) {
			if (str[i] == 'x') {
				ans++;
				i++;
			}
			if (str[j] == 'x') {
				ans++;
				j--;
			}
		}
		else {
			i++, j--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;

struct node
{
	ll x;
	ll h;
}a[200005];
ll js;
ll n,d,sh;
ll ans;
ll f[200005];
inline void read(ll &x)
{
	ll f;char c;
	for (f=1,c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for (x=0;c<='9'&&c>='0';c=getchar()) x=x*10+(c&15);x*=f;
}
inline bool cmp(node p,node q)
{
	if(p.x!=q.x) return p.x<q.x;
	else return p.h>q.h;
}
inline ll lowbit(ll x)
{
	return x&-x;	
}
inline void add(ll x,ll k)
{
	while(x<=n)
	{
		f[x]+=k;
		x+=lowbit(x);
	}
}
inline ll gt(ll p)
{
	ll rest=0;
	while(p>0)
	{
		rest+=f[p];
		p-=lowbit(p);
	}
	return rest;
}
int main()
{
	read(n);read(d);read(sh);
	for(ll i=1;i<=n;i++)
	{
		read(a[i].x);
		read(a[i].h);
	}
	sort(a+1,a+n+1,cmp);
	for(ll i=1;i<=n;i++)
	{
		if(a[i].h-gt(i)<=0) continue;
		js=(((a[i].h-gt(i))-1)/sh+1)*sh;
		ans+=(a[i].h-gt(i)-1)/sh+1;
		ll l=i,r=n,mid,j=i;
		while(l<=r)
		{
			mid=(l+r)>>1;
			if(a[i].x+2*d>=a[mid].x)
			{
				j=mid;
				l=mid+1;
			}
			else
			{
				r=mid-1;
			}
		}
		add(i,js);
		add(j+1,-js);
	}
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a;
    cin >> a;
    int base = 360, i = 2;
    while(base % a != 0){
        base = 360 * i++;
    }
    cout << base / a << endl;
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> arr;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        arr.push_back(make_pair(x,i));
    }
    sort(arr.begin(), arr.end());
    for(int i=0;i<n;i++){
        cout<<arr[i].second<<" ";
    }
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=105;
//i_am_noob
int n,m;
vector<int> vec1,vec2;
char c[maxn][maxn];
bool flag;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> m;
	rep(n) rep1(j,m) cin >> c[i][j];
	rep(n){
		flag=true;
		rep1(j,m) if(c[i][j]=='#') flag=false;
		if(!flag) vec1.pb(i);
	}
	rep(m){
		flag=true;
		rep1(j,n) if(c[j][i]=='#') flag=false;
		if(!flag) vec2.pb(i);
	}
	rep(sz(vec1)){
		rep1(j,sz(vec2)) cout << c[vec1[i]][vec2[j]];
		cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>

#define AS(a) (sizeof(a)/sizeof(a[0]))
using namespace std;
long long int MOD = 1000000007;

int main() {
  int N;
  cin >> N;
  int s[N];
  for(int i = 0; i < N; i++) {
    cin >> s[i];
  }
  bool dp[10001];
  for(int j = 0; j < 10001; j++) {
    dp[j] = false;
  }
  dp[0] = true;
  for(int i = 0; i < N; i++) {
    for(int j = 10000; j >= 0; j--) {
      if(!dp[j]) continue;
      dp[j + s[i]] = true;
     }
  }
  for(int j = 10000; j >= 0; j--) {
    if((j % 10 != 0 && dp[j]) || j == 0) {
      cout << j << endl;
      break;
    }
  }

}


Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int H, W;
	cin >> H >> W;
	FOR(i, 0, H) {
		string c;
		cin >> c;
		cout << c << endl << c << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int card[4][14] ={0};
    char S[]="SHCD";
    int n, m, i, j;
    char s;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf(" %c %d", &s, &m);
        for (j=0; j<4; j++)
             if (s == S[j]) card[j][m] =1;
    }
    for (i = 0; i < 4; i++) {
        for (j = 1;  j < 14; j++) {
            if (card[i][j] == 0) {
                printf("%c %d\n", S[i], j);
             }
         }
    }
}




Measured memory_bytes: 2024
public class Main {

    public static void main(String[] args) {
        int page = new Integer(getLine()[0]);
        int ans = page/2;
        if(page % 2 == 1){
            ans += 1;
        }
        System.out.println(ans);
    }

    public static String[] getLine(){
        java.util.Scanner scan = new java.util.Scanner(System.in);
        return scan.nextLine().split(" ");
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<lld> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
static lld r,j,cu=0,x,y,a,nu=0,b,m,n,s,q,i,z,p,k,d,t;string s1,s2,s3,s4;
vi v[100001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s1;
    cout<<"2018";
    rep(i,4,s1.size())
    cout<<s1[i];
} 

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int n,k;cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(ALL(p));
    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3628
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

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

void Main(){
    string s;
    cin >> s;
    ll K;
    cin >> K;
    REP(i, s.length()){
        if(s[i]=='a'){
            continue;
        }
        int tmp = ('z'+1)-s[i];
        if(tmp<=K){
            s[i] = 'a';
            K -= tmp;
        }
    }
    if(K>0){
        K%=26;
        ll t = s.length()-1;
        s[t] += K;
        if(s[t] > 'z'){
            s[t] -= 26;
        }
    }
    cout << s << el;
}



Measured memory_bytes: 512
import sys
from math import sqrt, pi
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    r = I()
    print(2 * r * pi)
    pass


if __name__ == "__main__":
    main()


Measured memory_bytes: 65204
#include <cstdio>
#include <cstring>

char s[11];

int main(void)
{
	scanf("%s" ,&s[1]);

	if (strcmp(&s[1], "Sunny") == 0)
		printf("Cloudy");
	else if (strcmp(&s[1], "Rainy") == 0)
		printf("Sunny");
	else
		printf("Rainy");
	return 0;
}


Measured memory_bytes: 128
import numpy as np

def main():
    n = int(input())
    ab = np.zeros([n, 2], dtype=int)
    for i in range(n):
        ab[i] = list(map(int, input().split(' ')))

    so = np.argsort(ab[:, 1], axis=0)
    count = 0
    ok = True
    for i in so:
        count += ab[i][0]
        if count > ab[i][1]:
            ok = False
            break

    print("Yes" if ok else "No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 20300
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
 int n;
 cin>>n;
 long long a[n+1],b[n+1];
 for(int i=1;i<=n;i++){cin>>a[i];b[i]=a[i];}
 sort(b+1,b+n+1,less<int>());
 for(int i=1;i<=n;i++){
 	if(a[i]<=b[n/2])cout<<b[n/2+1]<<endl;
 	else if (a[i]>=b[n/2+1])cout<<b[n/2]<<endl;
 }
 return 0;
}

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

int main() {
	int n;
	cin>>n;
	int a[n];
	for(int i = 0;i < n; i++){
		cin>>a[i];
	}
	int dp[n];
	dp[n-1] = 0;
	dp[n-2] = abs(a[n-2]-a[n-1]);
	for(int i = n-3; i>=0; i--){
		dp[i] = min(abs(a[i] - a[i+1]) + dp[i+1], abs(a[i]-a[i+2])+dp[i+2]);
	}
	cout<<dp[0]<<endl;
}

Measured memory_bytes: 1024
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int X, A, B;
	cin >> X >> A >> B;
	cout << (X - A) % B << endl;







	return(0);
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a[3], b[3], c[3][3];
	bool flag = false;

	cin >> c[0][0] >> c[0][1] >> c[0][2];
	cin >> c[1][0] >> c[1][1] >> c[1][2];
	cin >> c[2][0] >> c[2][1] >> c[2][2];

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			for (int k = 0; k <= 100; k++) {
				a[0] = i;
				a[1] = j;
				a[2] = k;
				b[0] = c[0][0] - a[0];
				b[1] = c[0][1] - a[0];
				b[2] = c[0][2] - a[0];
				if (b[0] >= 0 && b[1] >= 0 && b[2] >= 0) {
					if (c[1][0] == a[1] + b[0] && c[1][1] == a[1] + b[1] && c[1][2] == a[1] + b[2]) {
						if (c[2][0] == a[2] + b[0] && c[2][1] == a[2] + b[1] && c[2][2] == a[2] + b[2]) {
							flag = true;
						}
					}
				}
			}
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

s = ns()
ans = 0
for i in range(2 ** (len(s) - 1)):
    lis = list(bin(i)[2:].zfill(len(s) - 1))
    b = 0
    for j in range(len(lis)):
        if lis[j] == '1':
            ans += int(s[b:j + 1])
            b = j + 1
    ans += int(s[b:])
print(ans)


Measured memory_bytes: 3316
#include <CodeforcesSolutions.h>
#include <ONLINE_JUDGE <solution.cf(contestID = "1359",problemID = "C",method = "GET")>.h>
"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time,decimal
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################
 
def solve():
    a,b = insr().split(" ")
    q = b.index(".")
    qw = b[:q]
    w = int(b[:q] + b[q + 1:])
    qq = len(b) - q - 1
    if len(str(int(a) * w)) <= qq:
        print(0)
        return
    print(str(int(a) * w)[:- q - 1])
                
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
    sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(float,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)
 
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()


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

using namespace std;

typedef unsigned long long ll;

#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fi first
#define se second
#define II pair <int,int>

const int N=2e5+10;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int a,b;
    cin >> a >> b;
    if (a<=b) cout << "unsafe";
    else cout << "safe";
}
    

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define ull unsigned long long
#define mp make_pair
#define ld long double
#define fi first
#define se second
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
const int N=5005;
const ll inf=1e18;
ll dp[N][N];
int p[N],A,B,to[N];
int main(){
	int n=read(); A=read(); B=read();
	for(int i=1;i<=n;i++){
		p[i]=read(); to[p[i]]=i;
	}
	ll ans=inf;
	for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=inf;
	dp[0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(p[i+1]<=j)dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			if(to[j+1]<=i)dp[i][j+1]=min(dp[i][j+1],dp[i][j]);
			if(p[i+1]==j+1)dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]);
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]+A);
			dp[i][j+1]=min(dp[i][j+1],dp[i][j]+B);
		}
	}
	for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)if(max(i,j)==n)ans=min(ans,dp[i][j]);
	cout<<ans<<endl;
}
/*
位置<i 或者 <=j的数已经归位 
*/

Measured memory_bytes: 195840
#include <iostream>
#include<algorithm>
using namespace std;
int n,a,rs,tt;
int aa[1000000];
int find(int t)
{
	for (int i=0;i<tt;i++)
		if(aa[i]==t)
			return i;
	return -1;
}
int main()
{
	cin>>n;rs=0;tt=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&aa[i]);
	}
	sort(aa,aa+n);
	int t1,tt;t1=-1;
	for(int i=0;i<n;i++)
	{
		if(t1==-1)
		{
			t1=aa[i];tt=1;
		}
		else if(i<n-1)
		{
			if(t1==aa[i])tt++;
			else
			{if(tt%2)rs++;t1=aa[i];tt=1;}
		}
		else 
		{
			if(t1==aa[i]){tt++;if(tt%2)rs++;}
			else{if(tt%2)rs++;rs++;}
		}

	}
	cout<<rs;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(void){
    int m, f, b;
    cin >> m >> f >> b;
    if(m >= b){
        cout << 0 << endl;
    } else if((b - m) <= f){
        cout << (b - m) << endl;
    } else {
        cout << "NA" << endl;
    }
}



Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
    long long n, k;
    cin >> n >> k;

    if (k % 2 == 0) {
        cout << (n / k) * (n / k) * (n / k) + ((n + k / 2) / k) * ((n + k / 2) / k) * ((n + k / 2) / k) << endl;
    } else {
        cout << (n / k) * (n / k) * (n / k) << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

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

		String msg ="";
		if(a > b){
			msg = "a > b";
		} else if(a < b){
			msg = "a < b";
		} else {
			msg = "a == b";
		}

		System.out.println(msg);
	}
}


Measured memory_bytes: 26136
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

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

	vector<int> border;
	while(k > 1) {
		border.push_back(k);
		k = k / 2 + (k % 2 == 0? 0 : 1);
	}
	border.push_back(1);

	double ans = 0;
	if(border[0] <= n) ans += 1.0 * (n - border[0] + 1) / n;
	int size = border.size();
	double p = 1.0 / n;
	for(int i = 1; i < size; i++) {
		p /= 2;
		if(border[i] > n) continue;
		else if(border[i - 1] - 1 >= n) ans += (n - border[i] + 1) * p;
		else ans += (border[i - 1] - border[i]) * p;
	}

	cout << setprecision(19) << ans << endl;

	return 0;
}

Measured memory_bytes: 384
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n,a,b;
  cin >> n >> a >> b;
  int ans = (n/(a+b))*a;
  int rem = (n%(a+b));
  ans+=min(rem,a);
  cout << ans << endl;


return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K,N,dif=0;
  cin >> K >> N;
  vector<int> house(N);
  for(int i=0; i<N ; i++){
    cin >> house.at(i);
  }
  dif=house.at(0)+(K-house.at(N-1));
  for(int i=0; i<N-1 ; i++){
    if(dif<max(house.at(i),house.at(i+1))-min(house.at(i),house.at(i+1))){
      dif=max(house.at(i),house.at(i+1))-min(house.at(i),house.at(i+1));
    }
  }
  cout << K-dif << endl;
}

Measured memory_bytes: 1024
using System;

namespace ABC083
{
    class B
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int A = int.Parse(input[1]);
            int B = int.Parse(input[2]);

            int sum = 0;
            int res = 0;
            int value = 0;
            for (int i = 1; i <= N; i++)
            {
                value = i;
                while (0 < value)
                {
                    sum += (value % 10);
                    value = (value / 10);
                }

                if (A <= sum && sum <= B)
                {
                    res += i;
                }
                sum = 0;
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

typedef struct {
    long long x;
    long long y;
} dot_t;

int sortx(const void *a, const void *b){
    return ((dot_t*)a)->x - ((dot_t*)b)->x ;
}

int sorty(const void *a, const void *b){
    return ((dot_t*)a)->y - ((dot_t*)b)->y ;
}

int main(void){
    int n,k;
    long long tmp=LONG_MAX,ans=LONG_MAX;
    scanf("%d%d",&n,&k);
    dot_t dx[n],dy[n];
    for (int i=0; i<n; i++){
        scanf("%lld%lld",&dx[i].x,&dx[i].y);
        dy[i].x=dx[i].x;
        dy[i].y=dx[i].y;
    }
    qsort (dx,n,sizeof(dot_t),sortx);
    qsort (dy,n,sizeof(dot_t),sorty);
    for (int a=0; a<n; a++){
        for (int b=a+1; b<n; b++){
            for (int c=0; c<n; c++){
                for (int d=c+1; d<n; d++){
                    int count=0;
                    for (int e=0; e<n; e++){
                        if (dx[e].x>=dx[a].x && dx[e].x<=dx[b].x && dx[e].y>=dy[c].y && dx[e].y<=dy[d].y){
                            count++;
                        }
                    }
                    if (count>=k){
                        tmp=(dx[b].x-dx[a].x)*(dy[d].y-dy[c].y);
                    }
                    if (ans>tmp){
                        ans=tmp;
                    }
                }
            }
        }
    }
    printf("%lld\n",ans);
    return 0 ;
}

Measured memory_bytes: 128
program kadai
integer  ::  N,i
integer  ::  a(3,3)
integer,allocatable  ::  b(:)

read(*,*) a(1,:)
read(*,*) a(2,:)
read(*,*) a(3,:)
read(*,*) N
allocate(b(N))
do i=1,N
    read(*,*) b(i)
end do

do i=1,N
    do j=1,3
        do k=1,3
            if (a(j,k)==b(i)) then
                a(j,k)=1000
            end if
        end do
    end do
    do k=1,3
        if (a(k,1)==1000 .and. a(k,2)==1000 .and. a(k,3)==1000) then
            write(*,*) "Yes"
            stop
        end if
        if (a(1,k)==1000 .and. a(2,k)==1000 .and. a(3,k)==1000) then
            write(*,*) "Yes"
            stop
        end if
    end do
    if (a(1,1)==1000 .and. a(2,2)==1000 .and. a(3,3)==1000) then
        write(*,*) "Yes"
        stop
    end if
    if (a(3,1)==1000 .and. a(2,2)==1000 .and. a(1,3)==1000) then
        write(*,*) "Yes"
        stop
    end if
end do

write(*,*) "No"

stop



end program kadai


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

typedef long long ll;

int main()
{
    ll ara[]={1,2,1,3,1,3,1,1,3,1,3,1};
    ll a,b;
    cin>>a>>b;
    if(ara[a-1]!=ara[b-1])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;

}

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

int main() {
	int N, M;
	cin >> N >> M;
	long long A_sum = 0;
	for (int i = 0; i < M; i++) {
		int tmp;
		cin >> tmp;
		A_sum += tmp;
	}
	if (A_sum > N) {
		cout << "-1" << endl;
	} else {
		cout << N - A_sum << endl;
	}
}

Measured memory_bytes: 3640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  int N; cin >> N;
  VI A(N);
  REP(i,N) cin >> A[i];

  for(int i=0;i<N;++i){
	for(int j=i-1;j>=0 && A[j]>A[j+1];--j){
	  swap(A[j], A[j+1]);
	}
	
	cout << A[0];
	REP(i,N-1) cout << " " << A[i+1];
	cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1196
# coding: utf-8
# Your code here!
import sys
from collections import deque

def input():
    return sys.stdin.readline().rstrip()

N = int(input())
que = deque([int(input()) for i in range(N)])
tmp = 0
max_num1 = sorted(que)[-1]
max_num2 = sorted(que)[-2]

for i in range(N):
    tmp = que.popleft()
    if tmp != max_num1:
        print(max_num1)
    else:
        print(max_num2)
    que.append(tmp)

Measured memory_bytes: 71192
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) (a*a)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int a[2005];

int main() {
	int n, x, y;
	cin >> n >> x >> y;
	REP(i, n)scanf("%d", &a[i]);
	if (n == 1)cout << abs(y - a[n - 1]) << endl;
	else cout << max(abs(y - a[n - 1]), abs(a[n - 1] - a[n - 2])) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.at(0)=='S')cout<<"Cloudy"<<endl;
  if(s.at(0)=='C')cout<<"Rainy"<<endl;
  if(s.at(0)=='R')cout<<"Sunny"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

int
main(int argc, char **argv)
{
	int d, w, h;
	int r;
	int n;

	while (true)
	{
		scanf("%d %d %d", &d, &w, &h);
		if (d == 0 && w == 0 && h == 0)
			break;

		scanf("%d", &n);
		while (n--)
		{
			scanf("%d", &r);
			r *= 2;
			if (d * d + w * w < r * r || w * w + h * h < r * r || h * h + d * d < r * r)
				printf("OK\n");
			else
				printf("NA\n");
		}
	}

	return 0;
}

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

using namespace std;

int main(){

string str;

cin>>str;

stack<int>stc;

for(int i=0;i<str.size();i++){

  if(str[i]=='0') stc.push(0);

  if(str[i]=='1') stc.push(1);

  if(str[i]=='B'&& stc.size()>0){

        stc.pop();

 }

}

vector<int>is;

 while(!stc.empty()){

     is.push_back(stc.top());

   stc.pop();

 }

 reverse(is.begin(),is.end());

 for(auto i : is) cout<<i;

return 0;

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int a, b, m;
	int A[100005], B[100005];
	int min;
	scanf("%d%d%d", &a, &b, &m);
	int mina, minb;
	mina = minb = 2000000000;
	for (int i = 1; i <= a; i++) {
		scanf("%d", &A[i]);
		if (mina > A[i]) mina = A[i];
	}
	for (int i = 1; i <= b; i++) {
		scanf("%d", &B[i]);
		if (minb > B[i]) minb = B[i];
	}

	int x, y, c;
	if (m >= 1) {
		scanf("%d%d%d", &x, &y, &c);
		min = A[x] + B[y] - c;
		for (int i = 2; i <= m; i++) {
			scanf("%d%d%d", &x, &y, &c);
			if (min > A[x] + B[y] - c)
				min = A[x] + B[y] - c;
		}
	}

	if (min > mina + minb) {
		min = mina + minb;
	}

	
	printf("%d", min);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
using namespace std;


int main() {
	string s; cin >> s;
	if (s == "000")cout << "0" << endl;
	else if (s[1] == '1'&&s[2] == '1'&&s[0] == '1')cout << "3" << endl;
	else if ((s[0] == '1'&&s[1] == '1') || (s[0] == '1'&&s[2] == '1') || (s[1] == '1'&&s[2] == '1')) cout << "2" << endl;
	else cout << "1" << endl;
	return 0;
}

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

using namespace std;
int main()
 {
	int n,t_limit;
	cin >> n >> t_limit;

  int cost[n],t[n],min_cost;
  min_cost = 100000;
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &cost[i], &t[i]);
    if(t[i] <= t_limit){
      if(cost[i] < min_cost){
        min_cost = cost[i];
      }
    }
  }

  if(min_cost == 100000){
    std::cout << "TLE" << '\n';
  }
  else{
    std::cout << min_cost << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	int N,M;
	int[] a;
	boolean[] isIn;
	public void solve(){

		N = nextInt();
		M = nextInt();
		a = new int[N];
		Arrays.fill(a, 1);
		isIn = new boolean[N];
		isIn[0] = true;
		for(int i = 0;i < M;i++){

			int x = nextInt() - 1;
			int y = nextInt() - 1;

			if(isIn[x]){
				if(a[x] == 1){
					isIn[x] = false;
					isIn[y] = true;
				}else{
					isIn[x] = true;
					isIn[y] = true;
				}
			}
			a[x]--;
			a[y]++;
		}
		int ans = 0;
		for(int i = 0;i < N;i++){
			if(isIn[i])ans++;
		}
		out.println(ans);

	}

	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: 18376
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		int[] a=sc.Ia;
		int q=0,l=int.MaxValue;
		long ans=0;
		for(int i = 0;i<n;i++) {
			if(a[i]<0){q++;}
			ans+=Math.Abs(a[i]);
			l=Math.Min(l,Math.Abs(a[i]));
		}
		Console.WriteLine(q%2==0?ans:(ans-l*2));
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}


Measured memory_bytes: 29020
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun


#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")

int ctoi(char c) {
	switch (c)
	{
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default:
		cout << "ERR_ctoi" << endl;
		return -1;
	}
}
int main() {
	int k;
	cin >> k;
	PRI((k / 2) * ((k + 1) / 2));
	return 0;
}

Measured memory_bytes: 3624
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        a: usize, b: usize, k: usize,
    }

    if b - a + 1 < k {
        println!("{}", (a..=b).map(|x| x.to_string()).join("\n"));
    } else {
        if b - k + 1 <= a + k {
            println!("{}", (a..=b).map(|x| x.to_string()).join("\n"));
        } else {
            println!("{}", (a..(a + k)).map(|x| x.to_string()).join("\n"));
            println!("{}", ((b - k + 1)..=b).map(|x| x.to_string()).join("\n"));
        }
    }
}


Measured memory_bytes: 2208
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long a = s.nextLong();
		long b = s.nextLong();
		long x = s.nextLong();
		long answer = 0;

		long q = (b / x) - (a / x);

		if(a%x==0) {
			q = q+1;
		}


		System.out.println(q);
	}

}

Measured memory_bytes: 21972