akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define rep(a,n,b) for(int i=a;i<n;i+=b)
#define rrep(a,n,b) for(int i=n;i>=a;i-=b)
#define iter(obj) for(auto x : obj) 
#define pb(i) push_back(i)
#define ff first
#define ss second
#define pchr(flag) cout<<(flag ? "YES" : "NO")
#define ll long long int
#define input freopen("input.txt","r",stdin)
#define op freopen("output.txt","w",stdout);
#define fastio std::ios::sync_with_stdio(false)
using namespace std;
const int N = 2e5+7;
const int MOD  = 1000000007;
const float PI = 3.1415926535;
int arr[N];
//33333333333;
int main()  {
	// input;  	
	fastio;
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b+c >= 22) cout<<"bust";
	else cout<<"win";
} 


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int a,b,k;
	cin>>a>>b>>k;
	for(int i=1;i<=k;i++){
		if(i%2==0){
			if(b%2==0){
				b/=2;
				a+=b;
			} 
			else{
				b--;
				b/=2;
				a+=b;
			}
		}
		else{
			if(a%2==0){
				a/=2;
				b+=a;
			}
			else{
				a--;
				a/=2;
				b+=a;
			}
		}
	}
	cout<<a<<" "<<b<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  vi data(1000,0);
  rep(i,4) {
    char c;
    cin >> c;
    data[c]++;
  }
  int ans = 0;
  rep(i,1000) if(data[i] == 2) ans++;
  if(ans == 2) yes();
  else no();
  hinata;
}


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

using namespace std;

int main()
{
    int z;
    int memo[1112];

    for (int i = 0; i < 1112; ++i)
        memo[i] = i * i * i;

    while (cin >> z, z) {
        int max_xy = 0;
        int z3 = memo[z];

        for (int x = 1; memo[x] <= z3; ++x) {
            for (int y = 1; memo[y] <= z3 - memo[x]; ++y)
                max_xy = max(max_xy, memo[x] + memo[y]);
        }

        cout << z3 - max_xy << endl;
    }

    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, m;
    cin >> n;
    string s;
    unordered_map<string, int> cnt;
    while(n--) {
        cin >> s;
        cnt[s] += 1;
    }
    cin >> m;
    while(m--) {
        cin >> s;
        cnt[s] -= 1;
    }
    int ans = 0;
    for(auto p: cnt) {
        ans = max(ans, p.second);
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector<vector<int>> f(h, vector<int>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (i + j == 0) {
                f[0][0] = (s[0][0] == '#');
            } else {
                f[i][j] = (int) 1e9;
                if (i > 0) f[i][j] = min(f[i][j], f[i - 1][j] + (s[i - 1][j] == '.' && s[i][j] == '#'));
                if (j > 0) f[i][j] = min(f[i][j], f[i][j - 1] + (s[i][j - 1] == '.' && s[i][j] == '#'));
            }
        }
    }
    cout << f[h - 1][w - 1] << '\n';
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

  public static String hms(int remaining_seconds) {
    int hours = (int) remaining_seconds / 3600;
    remaining_seconds -= (hours * 3600);
    int minutes = (int) remaining_seconds / 60;
    remaining_seconds -= (minutes * 60);
    return hours + ":" + minutes + ":" + remaining_seconds;
  }

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int seconds = s.nextInt();
		System.out.println(hms(seconds));
	}
}


Measured memory_bytes: 26348
#include<bits/stdc++.h>
using namespace std;
#define int long long
template <class Q>
void clearQueue(Q & q) {
    q = Q();
}
void solve(){
	int n,x,t;cin>>n>>x>>t;
	int cnt=(n/x)*t;
	if(n%x!=0) cnt+=t;
	cout<<cnt;
} 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];
  vector<int> idx(n);
  iota(idx.begin(), idx.end(), 1);
  int a, b, cnt = 0;
  do {
    bool f1 = true, f2 = true;
    rep(i, n) {
      if (idx[i] != p[i])
        f1 = false;
      if (idx[i] != q[i])
        f2 = false;
    }
    if (f1) a = cnt;
    if (f2) b = cnt;
    cnt++;
  } while (next_permutation(idx.begin(), idx.end()));
  cout << abs(a-b) << endl;
  return 0;
}

Measured memory_bytes: 3600
seq = map(int,raw_input().split())

for i in range(len(seq)):
    for j in range(i,len(seq)-1):
        if seq[i] > seq[j+1]:
            a = seq[j+1]
            seq[j+1] = seq[i]
            seq[i] = a
        
print seq[0],seq[1],seq[2]

Measured memory_bytes: 4212
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    int n;
    cin >> n;
    int ans=n/2;
    if(n%2==0)ans--;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define endl "\n"
#endif
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<lu> vu;
typedef vector<v> vv;
typedef vector<vu> vvu;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<set<ll>> vsll;
typedef set<pair<ll, ll>> spll;
typedef vector<spll> vspll;
typedef vector<pll> vpll;
typedef pair<lu, lu> puu;
typedef vector<puu> vpuu;
const ll MOD = 1000000007;
const ld PI = 2 * acos(0.0);
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define sz(x) (ll) x.size()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yesno(f) \
    if (f)       \
        yes else no;
#define noo \
    { no return; }

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template <typename T = ll>
vector<T> ga(ll n, bool oneIndexed = false) {
    vector<T> a = vector<T>(n + oneIndexed);

    for (ll i = 0; i < n; i++) {
        T p;
        cin >> p;
        a[i + oneIndexed] = p;
    }

    return move(a);
}

template <typename T, typename A>
void pa(vector<T, A> const &a, ll begin = 0, ll end = -1) {
    if (end == -1)
        end = sz(a) - 1;
    for (ll i = begin; i <= end; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

void solve() {
    ll n;
    cin >> n;
    v a = ga(n);

    vector<vv> dp(n, vv(n, v(2, 0)));
    for (ll len = 1; len <= n; len++) {
        for (ll i = 0; i < n; i++) {
            ll j = i + len - 1;
            if (j >= n)
                break;

            if (len == 1) {
                dp[i][j][0] = a[i];
                dp[i][j][1] = -a[i];
            } else {
                dp[i][j][0] =
                    max(dp[i][j - 1][1] + a[j], dp[i + 1][j][1] + a[i]);
                dp[i][j][1] =
                    min(dp[i][j - 1][0] - a[j], dp[i + 1][j][0] - a[i]);
            }
        }
    }

    cout << dp[0][n - 1][0];
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // freopen("file", "r", stdin);
    // freopen("file", "w", stdout);
    // ll t;cin >> t;while(t--)
    solve();
    return 0;
}

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

int a[4];
int c[8];
int k;

int calc(){
	int op = c[k++];
	int ret = 0;
	if(op >= 0){
		ret = op;
	}
	else if(op >= -3){
		int x = calc();
		int y = calc();
		if(op == -1){
			ret = x + y;
		}
		else if(op == -2){
			ret = x - y;
		}
		else{
			ret = x * y;
		}
	}
	else{
		throw 0;
	}
	return ret;
}

void print(){
	int op = c[k++];
	if(op >= 0){
		printf("%d", op);
	}
	else{
		char ch;
		if(op == -1){ ch = '+'; }
		else if(op == -2){ ch = '-'; }
		else{ ch = '*'; }

		putchar('(');
		print();
		printf(" %c ", ch);
		print();
		putchar(')');
	}
}

void solve(int i, int S, int oprem, int numrem){
	if(i == 6){
		for(int j = 0; j < 4; ++j){
			if(S >> j & 1){
				c[6] = a[j];
			}
		}
		try{
			k = 0;
			if(calc() == 10 && k == 7){
				k = 0;
				print();
				puts("");
				throw "";
			}
		}catch(int){}
		return;
	}

	if(oprem > 0){
		for(int op = -1; op >= -3; --op){
			c[i] = op;
			solve(i + 1, S, oprem - 1, numrem + 1);
		}
	}

	
	for(int j = 0; j < 4; ++j){
		if(S >> j & 1){
			c[i] = a[j];
			solve(i + 1, S ^ 1 << j, oprem, numrem - 1);
		}
	}
}

int main(){
	while(1){
		for(int i = 0; i < 8; ++i){
			c[i] = -9;
		}
		for(int i = 0; i < 4; ++i){
			scanf("%d", &a[i]);
		}
		if(a[0] == 0){ break; }
		try{
			solve(0, 15, 3, 0);
			puts("0");
		}catch(...){}
	}
}

Measured memory_bytes: 1128
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if

signed main(){
  int n,a,b;
  cin>>n>>a>>b;
  int e=a+b;
  if(n<=e)
    cout<<min(n,a)<<endl;
  else{
    int c=n/e;
    int d=n-c*e;
    cout<<c*a+min(a,d)<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN
    ll n,x,y;cin>>n>>x>>y;
    x--;
    y--;
    ll dp[n][n];
    REP(i,n)REP(j,n) dp[i][j]=inf;
    REP(i,n) dp[i][i]=0;
    REP(i,n){
        REP(j,n){
            dp[i][j] = min({abs(i-j), abs(i-x)+abs(j-y)+1, abs(i-y)+abs(j-x)+1});

        }
    }
    map<ll,ll> mp;
    REP(i,n){
        REP(j,n){
            mp[dp[i][j]]++;
        }
    }
    FOR(i,1,n-1){
        cout<<mp[i]/2<<endl;
    }
    return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

vector<int> diff[2];
set<int> dx[2], dy[2];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	string s;
	int x, y, FT, dir = 0;
	cin >> s >> x >> y;
	FT = s.size();
	for (int i = 0; i < s.size(); i++) if (s[i] == 'T') {
		FT = i;
		break;
	}
	x -= FT;
	for (int i = FT; i < s.size(); i++) {
		if (s[i] == 'T') diff[dir = 1 - dir].push_back(0);
		else diff[dir].back()++;
	}
	dx[1].insert(0);
	for (int i = 0; i < diff[0].size(); i++) {
		dx[i & 1].clear();
		for (auto d : dx[(i - 1) & 1]) {
			dx[i & 1].insert(d + diff[0][i]);
			dx[i & 1].insert(abs(d - diff[0][i]));
		}
	}
	dy[1].insert(0);
	for (int i = 0; i < diff[1].size(); i++) {
		dy[i & 1].clear();
		for (auto d : dy[(i - 1) & 1]) {
			dy[i & 1].insert(d + diff[1][i]);
			dy[i & 1].insert(abs(d - diff[1][i]));
		}
	}
	if (dx[(diff[0].size() - 1) & 1].find(abs(x)) != dx[(diff[0].size() - 1) & 1].end() && dy[(diff[1].size() - 1) & 1].find(abs(y)) != dy[(diff[1].size() - 1) & 1].end()) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	return 0;
}

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

int main(){
  int n,ans=0;
  long long int a[110000];
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    while(i+1<n && a[i]==a[i+1]) i++;
    if(a[i]<a[i+1]){
      while( i+1<n && a[i]<=a[i+1]) i++;
    }
    else if(a[i]>a[i+1]){
      while(i+1<n && a[i]>=a[i+1]) i++;
    }
    ans++;
  }
  cout<<ans;
}


Measured memory_bytes: 4396
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
using namespace std;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______      
 * |\  \|\  \  |\  ___ \  |\  ___ \     
 * \ \  \/  /|_\ \   __/| \ \   __/|    
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__  
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \ 
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

long long pow_mod(long long base,long long power) {
	long long res = 1;
	while(power) {
		if(power&1) res = res * base % mod;
		base = base * base % mod;
		power >>= 1;
	}
	return res;
}

const int mxF = 200010;
long long fact[mxF],inv[mxF];

long long NcR(long long N,long long R) {
	if(R > N) return 0;
	return (fact[N] * inv[R] % mod) * inv[N-R] % mod;
}

long long get(long long cnt,long long dv) {
	if(dv <= 0) return cnt == 0;
	return NcR(cnt+dv-1,dv-1);
}


int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	fact[0] = fact[1] = inv[0] = inv[1] = 1;
	for(int i = 2;i < mxF;i++) fact[i] = i * fact[i-1] % mod, inv[i] = pow_mod(fact[i],mod-2);

	long long N,M;
	cin>>N>>M;
	vector<int> cs;
	for(long long i = 2;i * i <= M;i++) {
		if(M%i) continue;
		int cnt = 0;
		while(M%i == 0) cnt++, M/=i;
		cs.push_back(cnt);
	}
	if(M > 1) cs.push_back(1);
	long long res = 1;
	for(auto p : cs) {
		res = res * get(p,N) % mod;
	}
	cout<<res<<'\n';
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#define INF (1 << 24)
#define MASK (1 << 10)-1
#define fr first
#define sc second
using namespace std;

typedef pair<double,double> S;
typedef pair<S,int> P;
struct edge{ 
  double to,time; edge(){}
  edge(double to,double time):to(to),time(time){}
};

double n,m,p,a,b,timed[101][1500];
vector <double> ti(11);
vector< vector<edge> > info(101);

void init(){
  for(int i=0;i<101;i++){
    for(int j=0;j<1500;j++) timed[i][j] = INF;
  }
  info.resize(0); info.resize(101);
  ti.resize(0); ti.resize(11);
}

void add_info(){
  double x,y,z;
  cin >> x >> y >> z;
  info[(int)x].push_back(edge(y,z));
  info[(int)y].push_back(edge(x,z));
}

double Dijkstra(){
  priority_queue<P,vector<P>,greater<P> > que;
  que.push(P(S(0,a),MASK));
  timed[(int)a][MASK] = 0;
  while(!que.empty()){
    P p = que.top(); que.pop();
    double now = p.fr.sc,t = p.fr.fr;
    int bit = p.sc;
    if(now == b) return t;
    for(int i=0;i<info[(int)now].size();i++){
      edge e = info[(int)now][i];
      for(int j=0;j<n;j++){
	if(bit >> j & 1){
	  if(e.time/ti[j] + t < timed[(int)e.to][bit & ~(1<<j)]){
	    que.push(P(S(e.time/ti[j]+t,e.to),bit & ~(1<<j)));
	    timed[(int)e.to][bit & ~(1<<j)] = e.time / ti[j] + t;
	  }
	}
      }
    }
  }
  return -1;
}

int main(){
  while(cin>>n>>m>>p>>a>>b,n||m||p||a||b){
    init();
    for(int i=0;i<n;i++) cin >> ti[i];
    for(int i=0;i<p;i++) add_info();
    double d = Dijkstra();
    if(d != -1) printf("%.3f\n",d);
    else cout << "Impossible" << endl;
  }
}

Measured memory_bytes: 4660
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int n,k;
string s;

bool cmp(int a,int b){
  R(i,n){
    if(s[a-i-1] != s[b-i-1]){
      return s[a-i-1] < s[b-i-1];
    }
  }
  return 0;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> k >> s;
  k--;
  mini(k,20ll);
  string s2 = s;
  reverse(ALL(s2));
  s+=s2;
  int naj = n;
  for(int i = n; i <= 2 * n; i++){
    if(cmp(i,naj)){
      naj = i;
    }
  }
  int same = 0;
  while(s[naj-same-1] == s[naj-1]){
    same++;
  }
  R(i,min(n, same * (1 << k))){
    cout << s[naj-1];
  }
  R(i, n - min(n, same * (1 << k))){
    cout << s[naj-same-i-1];
  }
  cout << "\n";
}


Measured memory_bytes: 256
/*
ID: toooooEasy or RafaelSaddatimov
PROG:
*/
#include <bits/stdc++.h>
#define MAX 3009
#define MOD 1000000007
#define INF 2100000000
#define EPS 1e-12
#define ll long long
#define _l long
#define F first
#define S second
#define NLINE printf("\n")
#define BYE(v) return 0 * printf(v)
#define all(v) v.begin(), v.end()
#define pb push_back
using namespace std;
ll c[26];

int main()
{
    string s;
    cin >> s;
    ll n = (ll)s.size();
    ll tot = n * (n - 1) / 2;
    for(int i=0; i<s.size(); ++i)
        c[s[i]-'a']++;
    for(ll i=0; i<26; ++i)
        if(c[i] > 1)
            tot = tot - c[i] * (c[i] - 1) / 2;
    printf("%lld", tot + 1);
}


Measured memory_bytes: 644
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> ans(M * 2);
    for (int i = 0; i < M; i++)
    {
        cin >> ans[2 * i] >> ans[2 * i + 1];
    }
    for (int i = 1; i <= N; i++)
    {
        cout << count(ans.begin(), ans.end(), i) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	int n;
	cin >> n;
	map<char, int> wow;
	REP(i, n) {
		string s;
		cin >> s;
		if (s == "Y") {
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;
	return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int s = S.size(), t = T.size();
  set<string> set_1;
//  cout << S << T << s << t << endl;
  
  for (int i = s-t; i >= 0; i--) {
    string S_store = S;
    int finish = 0;
    for (int j = t-1; j >= 0; j--) {
      if (S.at(i+j) == '?' || S.at(i+j) == T.at(j)) {
        S.at(i+j) = T.at(j);
        if (j == 0)  finish = 1;
        continue;
      }
      else break;
    }
    if (finish == 1)  set_1.insert(S);
    
    S = S_store;
  }
  
  if(set_1.empty()) {
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
      
  set<string> setset;
  for (auto nv : set_1) {
    for (int i = 0; i < s; i++) {
      if (nv.at(i) == '?') {
        nv.at(i) = 'a';
      }
     }
    setset.insert(nv);
//    cout << nv << endl;
  }
  
  string st = *begin(setset);
  cout << st << endl;

}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898

//------------------------------------------------------

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;

    int pass = 0;
    int passb = 0;

    rep(i, s.length()) {
        if (s[i] == 'a') {
            if (pass < a + b) {
                cout << "Yes" << endl;
                pass++;
            } else {
                cout << "No" << endl;
            }
        } else if (s[i] == 'b') {
            if (pass < a + b && passb < b) {
                cout << "Yes" << endl;
                pass++;
                passb++;
            }else{
                cout << "No" << endl;
            }
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define endl "\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 998244353;
 
// code begins here

int main(){
    fast;
    
    ll n,m,k;
    cin>>n>>m>>k;
    
    vector<ll> arr(n), brr(m);
    for(auto &u: arr)
        cin>>u;
    for(auto &u: brr)
        cin>>u;
    
    for(ll i=1;i<n;i++)
        arr[i]+=arr[i-1];
    for(ll j=1;j<m;j++)
        brr[j] += brr[j-1];
    
    ll ans =0;
    
    for(ll i=0;i<n;i++){
        if(arr[i]>k)
            break;
        
        ll ans1 = i+1;
        auto it = upper_bound(brr.begin(), brr.end(), k - arr[i]) - brr.begin();
        ans1 += it;
        ans = max(ans, ans1);
    }
    
    for(ll i=0;i<m;i++){
        if(brr[i]>k)
            break;
        ans = max(ans, i+1);
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	long long int a[26]={0};
	for(long long int i=0;i<s.length();i++)
	{
		a[s[i]-97]++;
	}
	long long int sum=0;
	for(long long int i=0;i<26;i++)
	{
		sum=sum+(a[i]*(a[i]-1)/2);
	}
	long long int x=s.length();
	cout<<x*(x-1)/2 -sum +1;
	return 0;
}

Measured memory_bytes: 640
#import math
s=input()
t=input()
#=int(input())
#n,m,x=map(int,input().split())
#=list(map(int,input().split()))
#ca=[list(map(int,input().split())) for _ in range()]

if s == t[:len(t)-1]:
    print('Yes')
else:
    print('No')

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

int main(){
  int N,M;
  cin >> N >> M;
  int num[N];
  for(int i=0;i<N;i++){
    num[i]=0;
  }
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >> b;
    num[a-1]++;
    num[b-1]++;
  }
  for(int i=0;i<N;i++){
    cout << num[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a, b;
	cin >> a >> b;
	if (a<b){
		cout  << "a < b" << endl;
	}
	else if (a>b){
		cout <<  "a > b" << endl;

	}
	else if (a == b){
		cout << "a == b" << endl;
	}
	return 0;
}


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

namespace Vol0_3
{
    class Program
    {
        static void Main(string[] args)
        {
            // ??????????????\???????????????????????\????????°??¨??????
            int iInputNum = int.Parse(Console.ReadLine());

            // ??\???????????¨??\???????????´?§?????§???¢????????§??????
            for (int i = 0; i < iInputNum; i++)
            {
                List<double> iList = new List<double>();
                int iParam1 = 0;
                int iParam2 = 0;
                int iParam3 = 0;
                
                // ??\???????????????????????????????????????List???????´?
                string[] str_List = Console.ReadLine().Split(' ');
                iParam1 = int.Parse(str_List[0]);
                iParam2 = int.Parse(str_List[1]);
                iParam3 = int.Parse(str_List[2]);

                // ?????§??????????????????
                iList.Add(System.Math.Pow(iParam1,2));
                iList.Add(System.Math.Pow(iParam2,2));
                iList.Add(System.Math.Pow(iParam3,2));
                iList.Sort();
                
                // ??´?§?????§???¢????????§??????
                double dTmp = iList[0] + iList[1];
                if (dTmp == iList[2])
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }

            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9316
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

using namespace std;

int main() {
    int A, B, C, X;
    int count = 0;
    cin >> A >> B >> C >> X;
    for (int i = 0; i <= A; i++) {
        for (int j = 0; j <= B; j++) {
            for (int k = 0; k <= C; k++) {
                int total = 500 * i + 100 * j + 50 * k;
                if ((total == X) && (total % 50 == 0)) {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
log = console.log;

var stdin = require("fs").readFileSync("/dev/stdin", "UTF-8");
var lines = stdin
  .split("\n")
  .filter(v => v !== "")
  .map(v => v.split(" ").map(Number));

var N = lines[0][0];
var K = lines[0][1];
lines = lines.slice(1);
lines.sort((a,b)=> a[0]-b[0])

var i = 0;
var count = 0;
while(count<K){
  if(K<=count+lines[i][1]){
    log(lines[i][0])
    break;
  } else {
    count += lines[i][1]
    i++
  }
}

Measured memory_bytes: 50360
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FORR(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (e), i ## __begin = (b); i -- > i ## __begin;)
#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define ALL(x) begin (x), end (x)
using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  int64_t a, b, k;
  cin >> a >> b >> k;

  auto c = __gcd (a, b);
  set <int64_t> candidate;

  for (int64_t i = 1; i * i <= c; ++ i)
  {
    if (c % i == 0)
    {
      candidate.insert (i);
      candidate.insert (c / i);
    }
  }

  auto ite = candidate.rbegin ();
  rep (i, k - 1)
  {
    ++ ite;
  }
  cout << * ite << endl;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var ans, cnt int

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1000000)
	s, _, _ := reader.ReadLine()
	str := make([]string, len(s))

	var j int
	for i := 1; i < len(s); i++ {
		if s[i-1] == 'B' && s[i] == 'C' {
			str[j] = "X"
			i++
		} else {
			str[j] = string(s[i-1])
		}
		j++
	}

	for i := 0; i < len(str); i++ {
		if str[i] == "A" {
			cnt++
		} else if str[i] == "X" {
			ans += cnt
		} else {
			cnt = 0
		}
	}

	fmt.Println(ans)
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}

type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 4864
S = input().strip()
ansB = 0
ansW = 0
for i,c in enumerate(S):
	if (i % 2 == 0):
		if (c == '0'):
			ansW += 1
		else:
			ansB += 1
	else:
		if (c == '1'):
			ansW += 1
		else:
			ansB += 1
ans = min(ansW, ansB)
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
#include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ld long double
#define ull unsigned long long
#define pi std::pair<int,int>
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=
#define npm next_permutation 
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll &x, ll &y);
ll nCr(ll n, ll r);
void stat();
template <typename T> T fact(T num);
constexpr ll mod = 1000000000 + 7;

int main()
{
    stat();
    int n;cin>>n;
    vec<pi> v(n);
    vec<int> index(n);
    rep(i,n){
	    cin>>v[i].first>>v[i].second;
	    index[i]=i;
    }
   long double sum=0;
    auto dist=[] (pi l,pi r){
	    long double ret;
ret= sqrt(pow(l.first-r.first,2)+pow((l.second-r.second),2));
return ret;
    };
    do {
	    rep(i,n-1){
sum+=dist(v[index[i]],v[index[i+1]]);
	    }
    }while(npm(all(index)));
cout<<setprecision(15)<<(long double) sum/(long double)(fact(n))<<endl;
    return 0;
}
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat() {
#ifdef local
    rep(i, 2) {std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) { num = num * (n - i + 1) / i; }
    return num;
}

template <typename T> T fact(T num){
if(num==1){return 1;}
return num*fact(num-1);
}


Measured memory_bytes: 3848
# 入力
H,W=map(int,input().split())

l=[]
for i in range(H):
  l.append(list(input()))

for i in range(H):
  for j in range(W):
    # 地雷数のカウンタ
    c=0

    # '#'の場合はなにもしない
    if l[i][j]=='#':
      pass

    # '#'以外の場合
    else:
      # 左上
      if 0<i and 0<j and l[i-1][j-1]=='#':
        c+=1
      # 上
      if 0<i and l[i-1][j]=='#':
        c+=1
      # 右上
      if 0<i and j<W-1 and l[i-1][j+1]=='#':
        c+=1
      # 左
      if 0<j and l[i][j-1]=='#':
        c+=1
      # 右
      if j<W-1 and l[i][j+1]=='#':
        c+=1
      # 左下
      if i<H-1 and 0<j and l[i+1][j-1]=='#':
        c+=1
      # 下
      if i<H-1 and l[i+1][j]=='#':
        c+=1
      # 右下
      if i<H-1 and j<W-1 and l[i+1][j+1]=='#':
        c+=1

      l[i][j]=str(c)

# 出力
for i in range(H):
  print(''.join(l[i]))

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var aArray = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();
        var ans = 0;
        for (var cnt = 0; cnt < N; cnt++)
        {
            if ((cnt + 1) % 2 == 1 && aArray[cnt] % 2 == 1)
            {
                ans++;
            }

        }
        Console.WriteLine(ans);
;    }
}


Measured memory_bytes: 28068
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <vector>

using namespace std;

int N;
vector<int> A;

void write(vector<int> v) {
    for (int i = 0; i < N - 1; i++) {
        cout << v[i] << " ";
    }
    cout << v[N - 1] << endl;
}

int main() {
    cin >> N;
    A = vector<int>(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        for (int j = i; j > 0; j--) {
            if (A[j] < A[j - 1]) {
                swap(A[j], A[j - 1]);
            } else {
                break;
            }
        }
        write(A);
    }
    return 0;
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

ll rec(ll n) {
    if (n == 1) {
        return 1;
    } else {
        return 1 + 2 * rec(n / 2);
    }
}

int main() {
    ll h;
    cin >> h;
    out(rec(h));
    return 0;
}


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

#define EPS (1e-7)
#define INF (1<<25)
#define PI (acos(-1))

#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

vector<int> G[100001];
ll distw[100001];
ll distb[100001];

void dfsw(int v, int p, ll d) {
  distw[v] = d;
  for (const auto &e : G[v]) {
    if (e == p) continue;
    dfsw(e, v, d+1);
  }
}

void dfsb(int v, int p, ll d) {
  distb[v] = d;
  for (const auto &e : G[v]) {
    if (e == p) continue;
    dfsb(e, v, d+1);
  }
}

int main() {
  int n; cin >> n;
  REP(i,n-1) {
    int a, b;
    cin >> a >> b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
  }
  dfsb(0, -1, 0);
  dfsw(n-1, -1, 0);
  int b = 0, w = 0;
  REP(i,n) {
    if (distb[i] <= distw[i]) b++;
    else w++;
  }
  if (b > w) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;
  return 0;
}


Measured memory_bytes: 11904
N = int(input())
*A, = [int(input()) for _ in range(N)]

ans = 0
v = 1

for i, j in enumerate(A):
    if i==0:
        ans += j-1
    else:
        if j==v+1:
            v += 1
        ans += (j-1)//(v+1)

print(ans)


Measured memory_bytes: 7852
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
long long int factorial(long long int k){
    long long int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
        sum %= MOD;
    }
    return sum;
}
int main()
{
    int n;
    cin >> n;
    cout << factorial(n);
    
    return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int odd = 0;
		for(int i=0;i<N;i++) if(A[i] % 2 != 0) odd++;
		int two = 0;
		for(int i=0;i<N;i++) if(A[i] % 2 == 0 && A[i] % 4 != 0) two++;
		int four = N - odd - two;
		
		bool chk = true;
		if(two > 0) two = 1;
		if(odd + two > four + 1) chk = false;
		Console.WriteLine(chk ? "Yes" : "No");
		
		
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 20448
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();
    int n = 1;
    int cnt = 0;
    
    while(n<b){
      n += a-1;
      cnt++;
    }
    
    System.out.println(cnt);
  }
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll c,d,e,f,g,k; cin>>c>>d>>e>>f>>g>>k;
    if(!(g-c>k)) cout<<"Yay!";
  else cout<<":(";
}

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++)

int main()
{
    ll N, K;
    cin >> N >> K;

    vector<pair<int, int>> D(K);
    rep(i, K) cin >> D.at(i).first >> D.at(i).second;

    sort(D.begin(), D.end());

    ll mod = 998244353;

    vector<ll> dp(N + 1, 0);
    vector<ll> dp2(K, 0);
    dp.at(1) = 1;
    for (int i = 1; i < N; i++)
    {
        for (int j = 0; j < K; j++)
        {
            pair<int, int> d = D.at(j);

            if (i - d.second >= 0)
            {
                dp2.at(j) -= dp.at(i - d.second);
            }

            if (i + 1 - d.first >= 0)
            {
                dp2.at(j) += dp.at(i + 1 - d.first);
            }

            while (dp2.at(j) < 0)
            {
                dp2.at(j) += mod;
            }
            dp2.at(j) %= mod;
            dp.at(i + 1) += dp2.at(j);
            dp.at(i + 1) %= mod;
        }
    }

    cout << dp.at(N) << endl;
    return 0;
}

Measured memory_bytes: 4844
import sys

groups = {
    (1, 3, 5, 7, 8, 10, 12),
    (4, 6, 9, 11),
    (2, )
}

x, y = map(int, input().split(" "))

for group in groups:
    if x in group and y in group:
        print("Yes")
        sys.exit()
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include<cstdio>
using namespace std;
int main(void){
  int H,W;
   while(1){
       cin>>H>>W;
       if(H==0&&W==0)break;
      
   for(int i=1;i<=H;i++){
     for(int j=1;j<=W;j++){
        if(i==1||i==H||j==1||j==W){
            cout<<"#";
        }
        else cout<<".";
      }
     cout<<"\n";
    }
  cout<<"\n";
   }
}
   



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

class A
{
    static void Main()
    {
        var NAB = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        Console.WriteLine(Math.Min(NAB[1], NAB[2]) + " " + Math.Max(0, NAB[1] + NAB[2] - NAB[0]));
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int a,p;
  cin >> a >> p;
  cout << (p+3*a)/2 << endl;
  
  return 0;     
}


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

int main() {
  string s;
  cin >> s;
  int m = 0;
  for (char c: s) m = (m + c - '0') % 9;
  if (!m) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}


Measured memory_bytes: 3728
N = int(input())
p = [int(x) for x in input().split()]

diff_count = 0
diff_formar = 0
diff_latter = 0

for i in range(0,N):
    if p[i] != i+1:
        diff_count=diff_count + 1

if diff_count in [0,2]:
    print("YES")
else:
    print("NO")
            

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
	public Main(){
		String[] str = new String[6];
		for(int i = 0; i < 6; i++){
			str[i] = (i+1) + ":";
		}
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double tmp;
		
		for(int i = 0; i < n; i++){
			tmp = sc.nextDouble();
			
			if(tmp < 165.0){
				str[0] += "*";
			} else if(tmp < 170.0){
				str[1] += "*";
			} else if(tmp < 175.0){
				str[2] += "*";
			} else if(tmp < 180.0){
				str[3] += "*";
			} else if(tmp < 185.0){
				str[4] += "*";
			} else {
				str[5] += "*";
			}
		}
		
		for(String s: str){
			System.out.println(s);
		}
	}

	public static void main(String[] args){
		Main ma = new Main();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
    ll t=1;
//    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll x=0,val=0;
        for(ll i=0;i<n;i++)
        {
            ll a,b;
            cin>>a>>b;
            if(a==b)
                x++;
            else
                x=0;
            val=max(val,x);
        }
        if(val>=3)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*
    I LOVE CLARICE STARLING

     ♥LOVE♥        ♥LOVE♥
  ♥LOVE♥♥LOVE♥  ♥LOVE♥♥LOVE♥
♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
   ♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
      ♥LOVE♥♥LOVE♥♥LOVE♥
         ♥LOVE♥♥LOVE♥
            ♥LOVE♥
               ♥


    EXPLAINATION BELOW->
    1)Testcase to prove why Greedy fails
      A)4
        1 7 5 11
      Greedy approach of choosing at each step one which finds to have min |hi-hj| at a point fails here
      B)6
        1 2 10 3 0 1
     Greedy of approach of always jumping from i to i+2 so that min jumps lead to min addition of differences fails for this testcase
     
    In testcase B after handrunning bottom to top i.e right to left
    You can observe
    Optimal substructure as well as Overlapping Subproblems so Definitely Dynamic Programming
    
    State is only position
    position indicates if I start from this position what is the optimal Answer
*/
/*
 * 
 * 
 *   ITERATIVE SOLUTION
 * 
 * */
//
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
int N,K,i,j;
int H[100005];
ll dp[100005];//long long since sum can surpass limits of int
void solve()
{
  cin>>N>>K;
  fo(i,0,N)cin>>H[i];
  
  dp[N-1]=0;

  for(i=N-2;i>=0;i--)
  {
      dp[i]=INT64_MAX;
      for(j=1;j<=K&&i+j<N;j++)
      {
        dp[i]=min(dp[i],abs(H[i]-H[i+j])+dp[i+j]);
      }
  }
  cout<<dp[0]<<"\n";
}
int main()
{
   fastio
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 1408