akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<limits.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
typedef pair<ll,ll> PL;
static const int IINF=INT32_MAX;
static const ll LINF=INT64_MAX;
static const ll mod=1e9+7;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

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

ll p_num[1000005];
ll N;

ll ans=0;

vector<PL> p;

ll Pow(ll x,ll n){
    ll res=1;
    for(int i=0;i<n;++i)res*=x;
    return res;
}

int main(){
    //cout<<(ll)(8ll*27ll*125ll*6079ll*6079ll)<<endl;
    cin>>N;
    ll x=N;
    for(ll j=2;j*j<=x;j++){
        ll k=0;
        while(x%j==0){
            k++;
            x/=j;
        }
        if(k!=0)p.push_back(PI(j,k));
        //p_num[j]=max(k,p_num[j]);
    }
    if(x!=1)p.push_back(PI(x,1));
    for(int i=0;i<p.size();++i){
        //cout<<"p="<<p[i].first<<endl;
        //cout<<"k="<<p[i].second<<endl;
        //if(-1+8*p[i].second<0)continue;
        ll n=(-1+sqrt(1+8*p[i].second))/2;
        //cout<<"n="<<n<<endl;
        for(int j=1;j<=n;++j){
            //ll z=Pow(p[i].first,j);
            //N/=z;
            //cout<<"z="<<z<<endl;
            //cout<<"N="<<N<<endl;
        }
        ans+=n;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {

	int k; cin >> k;
	int ans;
	if (k % 2 == 0) {
		ans = (k / 2) * (k / 2);
	}
	else {
		ans = (k + 1) / 2 * (k / 2);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e6 + 5, MOD = 1e9 + 7;
const int SQ =225;
const long double EPS = 1e-7;
ll dp[N];
ll sum[N];
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  int n;

  cin >> n;

  dp[0] = 1;
  sum[0] = 1;
  for(int i = 1; i <= n; i++){
    dp[i] += dp[i-1];
    if(i >= 3){
      dp[i] += sum[i - 3];
      if(dp[i] >= MOD)dp[i] -= MOD;
    }
    sum[i] = (sum[i-1] + dp[i]) % MOD;
  }
  ll ans = dp[n - 1] * n % MOD;

  if(n >= 2){
    ans += dp[n-2] * (n - 1ll) % MOD *n %MOD;
  }
  ans%=MOD;

  f(i,0,n-2){
    ans+=dp[i]*(i+2ll)%MOD;
    ans+=dp[i]*(n-1ll)%MOD*(n-1ll)%MOD;
    ans%=MOD;
  }
  cout<<ans<<'\n';


  return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a) ;i < (b) ;i++)
#define repr(i, a, b) for (int i = (b) - 1 ;i >= a ;i--) 
int main(){
	int N, A[100000] ;
	cin >> N ;
	rep(i, 0, N)cin>>A[i] ;

	long ans = A[0] - 1, now = 1 ;
	rep(i, 1, N){
		ans += (long (A[i]) - 1) / (now + 1) ;
		if (A[i] == now + 1)now++ ;
	}
	cout<<ans<<endl ;
	return 0 ;
}


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

int main(){
    int n,t,x,y;
    int tp,xp,yp;
    int a,b,c;
    bool ans=true;
    cin >> n;
    tp=0;
    xp=0;
    yp=0;
    for(int i=0;i<n;i++){
        cin >> t >> x >> y;
        a=abs(t-tp);
        b=abs(x-xp);
        c=abs(y-yp);
        if((a<b+c)||((a-b-c)%2!=0)){
            ans=false;
        }
        else{
            tp=t;
            xp=x;
            yp=y;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3560
/*
by.YXH_XianYu
   2018.6.16
 */
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define MXN 2010
#define MX 15

int n,k,q,
	a[MXN],
	b[MXN],
	c[MXN],
	d[MXN],
	ans=1000000000;


int main(){
	//freopen("mothergoose.in","r",stdin);
	//freopen("mothergoose.out","w",stdout);

	scanf("%d%d%d",&n,&k,&q);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),b[i]=a[i];
	std::sort(b+1,b+n+1);
	for(int y=1;y<=n;y++){
		for(int i=1;i<=n;i++)
			if(a[i]>=b[y])
				c[++c[0]]=a[i];
			else{
				if(c[0]<k){
					c[0]=0;
					continue;
				}
				std::sort(c+1,c+c[0]+1);
				for(int j=1,lim=c[0]-k+1;j<=lim;j++)
					d[++d[0]]=c[j];
				c[0]=0;
				continue;
			}
		if(c[0]>0){
			std::sort(c+1,c+c[0]+1);
			for(int j=1,lim=c[0]-k+1;j<=lim;j++)
				d[++d[0]]=c[j];
			c[0]=0;
		}
		if(d[0]>=q){
			std::sort(d+1,d+d[0]+1);
			ans=std::min(ans,d[q]-b[y]);
			d[0]=0;
		}
		else{
			break;
		}
	}
	printf("%d\n",ans);

	return 0;
}


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

using namespace std;

int main() {
	stack<int> line;
	int n;

	while (cin >> n) {
		if (n == 0) {
			cout << line.top() << endl;
			line.pop();
		}
		else {
			line.push(n);
		}
	}
	return 0;
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int t; t=1;
	while(t--){
	   ll x; cin>>x;
	   if(x<600)cout<<8;
	   else if(x<800)cout<<7;
	   else if(x<1000)cout<<6;
	   else if(x<1200)cout<<5;
	   else if(x<1400)cout<<4;
	   else if(x<1600)cout<<3;
	   else if(x<1800)cout<<2;
	   else if(x<2000)cout<<1;
	}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 998244353;

int main() {
	int X, Y;
	cin >> X >> Y;
	for (int i = 0;i <= X;i++) {
		if (i * 2 + (X - i) * 4 == Y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3620
/*****************************************************

@author: vichitr
Compiled On: 1st Sept 2019

*****************************************************/
#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define double long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define loops(i,s,n) for(int i=s;i<=n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1009;
const ll SZ = 107;
const ll N = 5e5+7;

ll pwr(ll x, ll y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r;
}

int inv(int x)
{
	return pwr(x, MOD-2ll);
}

int n, m; 

void solve()
{
	int a, b; cin>>a>>b;
	int ans = (b-1)/(a-1);
	if((b-1)%(a-1))
		ans++;
	cout<<ans;
}

signed main()
{
    fast;
    int t=1;
    // cin >>t;
    while(t--){
        solve();
        
    }
    return 0;
}

/*****************************


****************************/


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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

int main(){
    
    ll m = pow(10,9)+7;
    ll N, K;
    cin >> N >> K;
    ll answer=0;
    
    FOR(i,K,N+2){
        answer = (answer + (i*(N-i+1)+1) %m )%m;
    }
    
    cout << answer << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#include <iomanip>
#include <string>
using namespace std;
// std::ios::sync_with_stdio(false);
typedef long long LL;
const int N = 200007;
const int M = 2000005;
const int INF = 0x3f3f3f;
// const double Pi = acos(-1.0);
int n;
int dis[N];
bool vis[N];
struct nd
{
    int v,c;
    int nxt;
}edge[N<<1];
int head[N],cnt;
void ini()
{
    memset(head,-1,sizeof head);
    cnt=0;
}
void add_edge(int a,int b,int c)
{
    edge[cnt].v = b;
    edge[cnt].c = c;
    edge[cnt].nxt = head[a];
    head[a] = cnt++;
}
void spfa()
{
    memset(vis,false,sizeof vis);
    memset(dis,INF,sizeof dis);
    dis[1] = 1;
    vis[1] = true;
    queue <int> q;
    q.push(1);
    while (!q.empty())
    {
        int x = q.front();
        q.pop();
        vis[x] = false;
        for (int i=head[x];~i;i=edge[i].nxt)
        {
            int e = edge[i].v;
            int c = edge[i].c;
            if (dis[e] > dis[x]+c)
            {
                dis[e] = dis[x]+c;
                if (vis[e]==0)
                {
                    vis[e]=true;
                    q.push(e);
                }
            }
        }
    }
}
int main()
{
    while (~scanf("%d",&n))
    {
        ini();
        for (int i=0;i<n;i++)
        {
            add_edge(i,(i+1)%n,1);
            add_edge(i,(i*10)%n,0);
        }
        spfa();
        printf("%d\n",dis[0]);
    }
    return 0;
}

/*

6
41
79992

*/

Measured memory_bytes: 6784
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int x[50], y[50];
int main() {
	int n, cnt = 1;
	while (scanf("%d", &n), n) {
		rep(i, n)scanf("%d%d", &x[i], &y[i]);
		int sum = 0;
		rep(i, n)sum += x[i] * y[(i + 1) % n] - y[i] * x[(i + 1) % n];
		printf("%d %.1lf\n", cnt, abs(sum) / 2.);
		cnt++;
	}
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin >> x;
    if(x == 3){
      cout << "YES" << endl;
    }else if(x == 5){
      cout << "YES" << endl;
    }else if(x == 7){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
}

    

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <unordered_map>
#include <vector>
#include <utility>
#include <cassert>
#include <algorithm>
#include <cstring>

using namespace std;

constexpr int kMaxNodeNum = 8;
bool has_path[kMaxNodeNum + 1][kMaxNodeNum + 1];
bool node_is_passed[kMaxNodeNum + 1];
int passed_node_count;
int N, M;

int countPaths(int next) {
  node_is_passed[next] = true;
  passed_node_count++;
  if(passed_node_count == N) {
    node_is_passed[next] = false;
    passed_node_count--;
    return 1;
  }
  int count = 0;
  for(int i = 1; i <= N; i++) {
    if(!has_path[next][i]) continue;
    if(node_is_passed[i]) continue;
    count += countPaths(i);
  }
  node_is_passed[next] = false;
  passed_node_count--;
  return count;
}

int main(int argc, char *argv[]) {
  cin >> N >> M;
  for(int i = 0; i < M; i++){
    int from, to;
    cin >> from >> to;
    has_path[from][to] = true;
    has_path[to][from] = true;
  }
  cout << countPaths(1) << endl;

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  int c;
  int target;
  
  cin >> a >> b >> c;
  
  target = 100*a + 10 * b + c ;
  target = target%4 ;
  
  if(target == 0){
  
    cout << "YES" << endl;    
  }
  
  else{
  
    cout << "NO" << endl;
    
  } 
}

Measured memory_bytes: 3584
#include <stdio.h>
int main() {
  int n = 0;
  int i;
  int st = 0;
  int ed;
  int ans = 0;
  char s[101] = "0";
  scanf ("%s", s);

  for (i = 0; s[i] != 0; i++) {
    n++;
  }

  ed = n - 1;

  for (i = 0; i < n / 2; i++) {
    if (s[st] != s[ed]) ans++;
    st++;
    ed--;
  }

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

  return 0;
}


Measured memory_bytes: 128
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
	int r = int.Parse(ReadLine());

	if (r < 1200)
	{
	    WriteLine("ABC");
	}
	else if (r < 2800)
	{
	    WriteLine("ARC");
	}
	else
	{
	    WriteLine("AGC");
	}
    }
}


Measured memory_bytes: 11092
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	int m;
	m = (int)sqrt(n);
	if( m * m == n)
		printf("%d\n", n);
	else
		printf("%d\n", m*m);
}

Measured memory_bytes: 128
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long, long long>;

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

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

  ll n;
  std::cin>>n;

  std::vector<ll> c(n);
  rep(i,0,n)std::cin>>c[i];

  std::sort(all(c));

  ll ans=0;

  std::vector<ll> two(n+2,1),three(n+2,1);
  rep(i,1,n+2)two[i]=(two[i-1]*2)%MOD;
  rep(i,1,n+2)three[i]=(three[i-1]*3)%MOD;


  rep(i,0,n){
    ll temp=two[n-1-i];
    if(n-2-i>=0)temp=(temp+(n-1-i)*two[n-2-i]%MOD)%MOD;
    temp=(temp*c[i])%MOD;
    temp=(temp*two[i])%MOD;
    ans=(ans+temp)%MOD;
  }

  std::cout<<(ans*two[n])%MOD<<"\n";

  return 0;
}

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


int main(void){
    int k;
    cin >> k;
    int gu = 0;
    int ki = 0;
    for(int i=1;i<=k;i++){
        if(i%2==1){
            ki++;
        }
        else{
            gu++;
        }
    }
    int ans = ki*gu;
    cout <<ans <<endl;
    
    
    return 0;
}










































Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

signed main()
{
    ll k, mn = 2, mx = 3;
    cin >> k;
    vector<ll> v(k);
    rep(i, k) cin >> v[i];

    if (v.back() != 2)
    {
        cout << -1 << endl;
        return 0;
    }

    reverse(all(v));

    repi(i, 1, k)
    {

        ll st=mn,ue=mx-mx%v[i-1]+v[i-1]-1;
        if (st/v[i]==ue/v[i] && st%v[i]!=0)//
        {
            cout<<-1<<endl;
            return 0;
        }
        mn += (v[i] - mn % v[i])%v[i];

        mx-=mx%v[i-1];
        mx+=v[i-1]-1;
        mx-=mx%v[i];

        //cout<<mn<<" "<<mx<<endl;
    }
    mx += v[k - 1] - 1;
    if(k==1)mx=3;

    cout << mn << " " << mx << endl;
}

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

using namespace std;

#define int long long

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, len = 1, cnt = 1;
    cin >> n;
    while (1) {
        cnt *= 26;
        if (n <= cnt) {
            for (int i = 1; i <= len; ++i) {
                cnt /= 26;
                cout << char('a' + (n - 1) / cnt);
                n = (n - 1) % cnt + 1;
            }
            exit(0);
        }
        else n -= cnt;
        len++;
    }
    return 0;
}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
	cin.sync_with_stdio(false);
	int n;
	cin >> n;
	ll a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	ll num = 0, sz = a[0];
	repl(i, 1, n) {
		if (sz * 2 < a[i]) num = i;
		sz += a[i];
	}
	cout << n - num << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,s=0;
  cin >>n>>k;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >>vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  for(int i=0;i<k;i++){
    s+=vec.at(i);
  }
  
  cout <<s<<endl;
}

Measured memory_bytes: 3632
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var count = 0;
            for(var i = 1; i <= n; i++){
                var x = Divisor(i);
                if(i % 2 != 0 && x == 8){
                    count++;
                }
            }

            Console.WriteLine(count);
        }

        static int Divisor(long n){
            var count = 0;
            for(var i = 1; i * i <= n; i++){
                if(n % i == 0){
                    count++;
                    if(i * i != n){
                        count++;
                    }
                }
            }
            return count;
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main()
{
    Hello
    int a, b;
    cin >> a >> b;
    if((a + b) % 2) cout << "IMPOSSIBLE";
    else cout << (a + b)/2;
    return 0;
}


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

const long long MOD = 1e9 + 7;

long long fast_pow(long long a, long long p){
    long long res = 1;
    while (p){
        if (p & 1){
            res *= a;
            res %= MOD;
        }

        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;

    vector<long long> fac(2 * n + 1), inv(2 * n + 1);
    fac[0] = fac[1] = 1;
    for (long long i = 2; i <= 2 * n; i++)
        fac[i] = (fac[i - 1] * i) % MOD;

    inv[2 * n] = fast_pow(fac[2 * n], MOD - 2);
    for (long long i = 2 * n - 1; i >= 0; i--)
        inv[i] = ((i + 1) * inv[i + 1]) % MOD;
    
    auto C = [&fac, &inv](long long n, long long m){
        return (((fac[n] * inv[m]) % MOD) * inv[n - m]) % MOD;
    };

    long long ans = C(2 * n - 1, n - 1); // total
    for (long long kk = k + 1; kk <= n - 1; kk++){
        ans = (ans + MOD - C(n, kk) * C(n - 1, n - kk - 1) % MOD) % MOD;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N,K;cin>>N>>K;
    int a[N];
    int min=100000;
    int minK;
    int count=0;
    bool f=true;
    int sum=0;
    rep(i,N){
        cin>>a[i];
        /*
        if(a[i]<min){
            min=a[i];
            minK=i;
        }
        */
    }
    while(1){
        if(f){
            sum+=K;
            count++;
            f=false;
        }else{
            sum+=(K-1);
            count++;
        }
        if(sum>=N){
            break;
        }
    }
    cout<<count<<endl;

}

Measured memory_bytes: 4032
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll N;

vector<bool > prime;

//primeListには素数は入ってません
void isPrime(ll N){
    prime[0] = false;
    prime[1] = false;

    //ルートN以下まで繰り返す
    for(ll i = 2; i < ceil(sqrt(N)) ; i++){
        //素数になりえないとき
        //cout << i << endl;
        if(!prime[i]) continue;
        
        //Nまでのi(素数)の倍数を斑入り落とす
        for(ll j = i * i; j <= N; j += i){
            prime[j] = false;
        }    
    }
}

int main(){

    cin >> N;
    prime.assign(110000 + 1, true);
    isPrime(110000);

    for(ll i = N; i < prime.size(); i++){
        if(prime[i] == true){
            cout << i << endl;
            return 0;
        }
    }
} 

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

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	fastio
	int n;
	cin >> n;
	int a[n][3];
	for(int i = 0;i < n;i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
	int dp[n][3];
	memset(dp,0,sizeof dp);
	dp[0][0] = a[0][0], dp[0][1] = a[0][1], dp[0][2] = a[0][2];
	for(int i = 1;i < n;i++){
		dp[i][0] = max(dp[i-1][1]+a[i][0], dp[i-1][2] + a[i][0]);
		dp[i][1] = max(dp[i-1][0]+a[i][1], dp[i-1][2] + a[i][1]);
		dp[i][2] = max(dp[i-1][0]+a[i][2], dp[i-1][1] + a[i][2]);
	}
	cout << max({dp[n-1][0],dp[n-1][1], dp[n-1][2]}) << "\n";
}

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

using namespace std;

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

#define mm 100005
#define nn 1005
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define cases int t;  cin>>t;   while(t--)
#define check(a,n) forn(iiii,int(n)) cout<<int(a[iiii])<<" "; cout<<endl
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    int sum=0,n,k,a[mm];
    cin>>n>>k;
    forn(i,n)
        cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    forn(i,k)
        sum+=a[i];
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
w,h,n=map(int,input().split())
xl=0
xh=w
yl=0
yh=h
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        xl=max(xl,x)
    elif a==2:
        xh=min(xh,x)
    elif a==3:
        yl=max(yl,y)
    else:
        yh=min(yh,y)
if yh<=yl or xh<=xl:
    print(0)
else:
    print((yh-yl)*(xh-xl))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,Y;
  cin>>X>>Y;
  string ans="No";
  for(int k=0;k<10000;k++){
    int t=X-k;
    if(t<0)break;
    if(t*2+k*4==Y)ans="Yes";
  }
    
  cout<<ans<<endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y<a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[191];
int l[200110];
int j2[555111],j[3333];

long long x,y,z,mod=1000000007;
//string r,r1;
char r[200101];

P u[10];
queue<P> q;
stack<int> s[33];
map<int,int> p;
vector<int> v;

bool as(P a,P b)
{
  return a.x>b.x;
}

int f(int n,int m)
{
  int k=0;
  //printf("%d %d\n",n,m);
  for(;n<m;)
  {
    if(n%2) k+=j2[n++];
    else if(m%2==0) k+=j2[m--];
    else n/=2,m/=2;
  }
  //printf("%d %d\n",j[n],k);
  return j2[n]+k;
}

int main()
{
  scanf("%s",r+1);
  a=strlen(r+1);
  for(int t=1;t<=a;r[t]-='a',t++);
  for(int t=1;t<=a;t++)
  {
    k-=o[r[t]]%2;
    o[r[t]]++;
    k+=o[r[t]]%2;
    if(o[r[t]]%2) e=r[t];
  }
  if(k>1)
  {
    puts("-1");
    return 0;
  }
  for(int t=0;t<26;t++)
  if(o[t]%2) l[a/2+a%2]=t;
  //if(k) l[a/2+a%2]=e;
  
  for(i=1;i<a;i*=2);
  c=1;
  d=0;
  for(int t=1;t<=a;t++)
  {
    if(j[r[t]]<o[r[t]]/2)
    {
      for(int h=(i+t-1);h;h/=2)
        j2[h]++;
      j[r[t]]++;
      l[c]=r[t];
      x+=t-f(i,i+t-1);
      c++;
    }
    else
    {
      d++;
      //printf("%d\n",r[t]);
      s[r[t]].push(a/2-d+1+a%2);
    }
  }
  memset(j2,0,sizeof(j2));
  //printf("%lld\n",x);
  
  for(int t=1;t<=a/2+a%2;t++)
  {
    /*if(s[l[t]].size()==0)
    {
      puts("-1");
      return 0;
    }*/
    //printf("%c\n",l[t]+'a');
    for(int h=(i+s[l[t]].top()-1);h;h/=2)
      j2[h]++;
    x+=s[l[t]].top()-f(i,i+s[l[t]].top()-1);
    s[l[t]].pop();
    
  }
  printf("%lld",x);
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    int n;
    string s,t;
    cin>>n>>s>>t;
    int ans=0;
    rep(i,n){
        int z=0;
        rep(j,n-i) if(s[i+j]==t[j]) z++;
        if(z==n-i){ans=z;break;}
    }
    cout<<2*n-ans;
}

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

int cnt;

void insertionSort(vector<long long> &A, long long N, long long g){
    int v;
    for ( int i = g; i < N; i++ ){
        v = A.at(i);
        int j = i - g;
        while( j >= 0 && A.at(j) > v ){
            A.at(j+g) = A.at(j);
            j = j - g;
            cnt++;
        }
        A.at(j+g) = v;
    }
}

void shellSort( vector<long long> &A, long long N ){
    cnt = 0;
    vector<long long> G;

    long long h = 1;
    while ( h <= N ){
        G.push_back(h);
        h = 3 * h + 1;
    }

    cout << G.size() << endl;
    for ( long long i = G.size() - 1; i > 0; i-- ) cout << G.at(i) << " " ;
    cout << G.at(0) << endl;

    for ( long long  i = G.size() - 1; i >= 0; i-- ){
        insertionSort(A, N, G.at(i));
    }
    cout << cnt << endl;
}

int main(){
    long long N;
    cin >> N;
    vector<long long> A(N);
    for ( long long  i = 0; i < N; i++ ) cin >> A.at(i);
    
    shellSort( A, N );
    for ( long long  i = 0; i < N; i++ ) cout << A.at(i) << endl;

    return 0;
}


Measured memory_bytes: 10588
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int a,b,k,y,t,i=0;
  cin >> a >> b >> k;
  if (a>b) swap(a,b);
  while (b%a){
    y=a;
    a=b%a;
    b=y;
  }
  t=a;
  while (i<k){
    if (a%t==0) i++;
    t--;
  }
  cout << t+1 << endl;
  return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int H,W,K;
    Scd3(H,W,K);
    char s[11231];
    vector<vi> w(H,vi(W));
    Rep(i,H){
        Scs(s);
        Rep(j,W) w[i][j] = s[j]-'0';
    }

    int HH = 1<<(H-1);
    vi div;
    vi cnt;
    int ans = INF;
    Rep(hi,HH){
        int N = 1;
        div.clear();
        Rep(bi,H-1){
            if( (1<<bi) & hi ){
                div.push_back(bi);
                N++;
            }
        }
        div.push_back(H);
        cnt.assign(N,0);
        int tmp = N-1;
        Rep(j,W){
            bool ove = false;
            int ci = 0;
            Rep(i,H){
                cnt[ci] += w[i][j];
                if( i == div[ci] ) ci++;
            }
            // Rep(i,N) printf ("%d ", cnt[i] );
            // printf ("\n");
            Rep(i,N) if( cnt[i] > K ){
                tmp++;
                ove = true;
                break;
            }
            ci = 0;
            if( ove ){
                cnt[0] = 0;
                Rep(i,H){
                    cnt[ci] += w[i][j];
                    if( i == div[ci] ) ci++, cnt[ci] = 0;
                }
            }
            Rep(i,N) if( cnt[i] > K ){
                tmp = INF;
                break;
            }
        }
        // printf ("!%d\n", tmp );
        ans = min( ans, tmp );
    }

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

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
//string s;
#define rep2(x,from,to) for(long long x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
int n;
int b[3];
string s;

int main()
{
    cin>>s;
    int f=1;
    int ss=s.size();
    rep(i,ss)
    {
        if(i%2==0)
        {
            if(s[i]!='R'&&s[i]!='U'&&s[i]!='D')
            {
                f=0;
            }
        }
        else
        {
            if(s[i]!='L'&&s[i]!='U'&&s[i]!='D')
            {
                f=0;
            }

        }
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

string s[7][4] =
{
	{
		"1100",
		"1100",
		"0000",
		"0000"
	},
	{
		"1000",
		"1000",
		"1000",
		"1000"
	},
	{
		"1111",
		"0000",
		"0000",
		"0000"
	},
	{
		"0100",
		"1100",
		"1000",
		"0000"
	},
	{
		"1100",
		"0110",
		"0000",
		"0000"
	},
	{
		"1000",
		"1100",
		"0100",
		"0000"
	},
	{
		"0110",
		"1100",
		"0000",
		"0000"
	}
};
string Add = "00000000000";

int main() {
	string str;
	while ( cin >> str ) {
		VS d;
		d.push_back( str + "000" );
		for ( int i = 0; i < 7; i++ ) {
			cin >> str;
			d.push_back( str + "000" );
		}
		d.push_back( Add );
		d.push_back( Add );
		d.push_back( Add );
		bool break_check = false;
		for ( int i = 0; i < 8; i++ ) {
			for ( int j = 0; j < 8; j++ ) {
				for ( int k = 0; k < 7; k++ ) {
					break_check = true;
					for ( int l = i; l < i + 4; l++ ) {
						if ( d[ l ].substr( j, 4 ) != s[ k ][ l - i ] ) {
							break_check = false;
							break;
						}
					}
					if ( break_check ) {
						printf( "%c\n", k + 'A' );
						break;
					}
				}
				if ( break_check ) {
					break;
				}
			}
			if ( break_check ) {
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1208
from math import gcd

while True:
    s = str(input())
    if s == "#":
        break

    li = list()
    while s:
        if s[:5] == "north":
            li.append(-1)
            s = s[5:]
        else:
            li.append(1)
            s = s[4:]
    
    ans = li[-1] * 45 + 45
    li = li[:-1]
    mot = 1
    for d in reversed(li):
        ans = ans * 2 + d * 90
        mot *= 2

    g = gcd(ans, mot)
    ans, mot = ans // g, mot // g
    if mot == 1:
        print(ans)
    else:
        print("{0}/{1}".format(ans, mot))


Measured memory_bytes: 5628
#define C

#ifdef C
#include <stdio.h>
#define abs(a) ((a) < 0 ? -(a) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define isdigit(a) ((a) >= '0' && (a) <= '9' ? true : false)
#endif
#ifdef Cpp
#include <bits/stdc++.h>
using namespace std;
#endif

#define freopen(x) freopen(x".in", "r", stdin);freopen(x".out", "w", stdout)
#define repl(i, t) for (int i = fi[t]; i; i = ne[i])
#define rep(i, a, b) for (int i = (int) a;  i <= (int) b; ++i)
#define per(i, a, b) for (int i = (int) a;  i >= (int) b; --i)
#define _r read()
#define readtype long long
template<typename type> void swap(type &a, type &b) { type c; c = a; a = b; b = c; }

typedef long long var;

const int INF = 0x3f3f3f3f;

readtype read();

int main() {
  int m = _r, d = _r;
  int res = 0;
  while (m) {
    for (int i = 2; i <= 9; ++i) {
      if (m % i) continue;
      if (m / i <= 9 && m / i >= 2 && i * 10 + (m / i) <= d) res++;
    }
    m--;
  }
  printf("%d\n", res);
  return 0;
}

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}


Measured memory_bytes: 128
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int a,b;
char op;

int main()
{
	//fuck
	scanf("%d %c %d",&a,&op,&b);
	if(op=='+')
	{
		printf("%d\n",a+b);
	}
	else
	{
		printf("%d\n",a-b);
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define w(x) int x; cin>>x; while(x--)
using namespace std;
bool sieve[100007];
void sieve_make() 
{
	memset(sieve,true,sizeof(sieve));
	sieve[0]=sieve[1]=false;
	for(int i=2;i*i<=100006;i++)
	{
		if(sieve[i])
		{
			for(int j=2*i;j<=100006;j+=i)
				sieve[j]=false;
		}
	}
}

int max(int a,int b)
{
	if(a>b)
		return a;
	return b;
}
int min(int a,int b)
{
	if(a<b)
		return a;
	return b;
}
int modexp(int a,int b,int c)
{
	if(a==0) return 0;
	if(b==0) return 1;

	int ans;
	if(b%2==0)
	{
		int small=modexp(a,b/2,c);
		ans=(small*small)%c;
	}
	else
	{
		int small=modexp(a,b-1,c);
		ans=(a%c);
		ans=(small*ans)%c;
	}
	return (ans+c)%c;
}

string rev(string s)
{
	reverse(s.begin(), s.end());
	return s;
}
bool sign(int x)
{
	if(x>0)
		return true;
	return false;
}

int base3(string b)
{
	int ans=0,c=0;
	for(int i=b.length()-1;i>=0;i--)
	{
		ans+=(b[i]-'0')*pow(3,c++);
	}
	return ans;
}
int dp[501][501];
int solve(int* a,int i,int j)
{
	if(i>=j)
		return 0;
	int ans=INT_MAX;
	if(dp[i][j]!=-1)
		return dp[i][j];
	for(int k=i;k<j;k++)
	{
		int temp=solve(a,i,k)+solve(a,k+1,j)+a[i-1]*a[k]*a[j];
		ans=min(ans,temp);
	}
	return dp[i][j]=ans;
}

int32_t main()
{
	ios::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
	
	
	int k;string s;
	cin>>k>>s;
	if(s.length()<=k)
	cout<<s<<endl;
	else
	cout<<s.substr(0,k)+"..."<<endl; 
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(void){
  int k,m;
  scanf("%d%d",&k,&m);
  int num;

  if(m==100) num=k*1000+m;
  else if(m>=10) num=k*100+m;
  else num=k*10+m;

  int cand[320];
  for(int i=0;i<=320;i++){
    cand[i]=i*i;
  }

  int flag=0;
  for(int i=0;i<=320;i++){
    if(cand[i]==num){
      printf("Yes");
      flag=1;
    }
  }

  if(flag==0){
    printf("No");
  }
}


Measured memory_bytes: 128
eval"N,K,*A="+`dd`.split*?,
S=->a{eval a*?+}
s,*l=S[A]
1.upto(3e4){|j|s%j<1&&l<<j<<s/j}
p l.select{|h|a=A.map{|x|x%h}
S[a.min(N-S[a]/h)]<=K}.max

Measured memory_bytes: 5892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, m;
  cin >> n >> m;
  cout << max((ll)0, n-m) << endl;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

template <ll mod> class ModInt {
    ll a;
public:
    constexpr ModInt(const ll a = 0) noexcept : a((a % mod + mod) % mod) {}
    constexpr ll &value() noexcept { return a; }
    constexpr ModInt operator + (const ModInt &rhs) const noexcept { return ModInt(*this) += rhs; }
    constexpr ModInt operator - (const ModInt &rhs) const noexcept { return ModInt(*this) -= rhs; }
    constexpr ModInt operator * (const ModInt &rhs) const noexcept { return ModInt(*this) *= rhs; }
    constexpr ModInt operator / (const ModInt &rhs) const noexcept { return ModInt(*this) /= rhs; }
    constexpr ModInt &operator += (const ModInt &rhs) noexcept {
        a += rhs.a;
        if (a >= mod) a -= mod;
        return *this;
    }
    constexpr ModInt &operator -= (const ModInt &rhs) noexcept {
        a -= rhs.a;
        if (a < mod) a += mod;
        return *this;
    }
    constexpr ModInt &operator *= (const ModInt &rhs) noexcept {
        a = a * rhs.a % mod;
        return *this;
    }
    constexpr ModInt pow(ll t) const noexcept {
        if (t == 0) return 1;
        auto ret = pow(t >> 1);
        ret *= ret;
        if (t & 1) ret *= *this;
        return ret;
    }
    constexpr ModInt inv() const noexcept { return pow(mod - 2); }
    constexpr ModInt operator /=(const ModInt &rhs) { return (*this) *= rhs.inv(); }
    constexpr bool operator == (const ModInt &rhs) const noexcept { return this->a == rhs.a; }
    constexpr bool operator != (const ModInt &rhs) const noexcept { return this->a != rhs.a; }
    friend constexpr ostream &operator << (ostream &os, const ModInt &rhs) noexcept { return os << rhs.a; }
    friend constexpr istream &operator >> (istream &is, ModInt &rhs) {
        is >> rhs.a;
        return is;
    }
};
using mint = ModInt<MOD>;

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

    string L;
    cin >> L;

    int n = L.size();

    vector<vector<mint>> dp(n + 1, vector<mint>(2));
    dp[0][0] = 1;

    for (int i = 0; i < n; i++) {
        if (L[i] == '0') {
            dp[i + 1][0] = dp[i][0];
            dp[i + 1][1] = dp[i][1] * 3;
        } else {
            dp[i + 1][0] = dp[i][0] * 2;
            dp[i + 1][1] = dp[i][0] + dp[i][1] * 3;
        }
    }

    cout << dp[n][0] + dp[n][1] << "\n";
    return 0;
}

Measured memory_bytes: 5824
def sol( s )
	l = s.length
	a = Array.new
	for i in 1..l
		s1 = s[0, i]
		s2 = s[i..(l-1)]
		a.push( s1 + s2 )
		a.push( s2 + s1 )
		a.push( s1.reverse + s2 )
		a.push( s2 + s1.reverse )
		a.push( s1 + s2.reverse )
		a.push( s2.reverse + s1 )
		a.push( s1.reverse + s2.reverse )
		a.push( s2.reverse + s1.reverse )
	end
	a.uniq.size
end

m = gets.chomp.to_i
m.times do
	s = gets.chomp.to_s
	puts sol( s )
end

Measured memory_bytes: 6288
#include<iostream>

using namespace std;

int main(){
    unsigned long long int H,answer = 0,p = 1;
    cin >> H;
    for(int i = 0;H >= 1;i++){
        H /= 2;
        answer++;
    }
    for(int i = 0;i < answer;i++){
        p *= 2;
    }
    answer = (p -1);
    cout << answer;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  while (true) {
    string s; cin >> s;
    if (s == "#") break;
    int y, m, d; cin >> y >> m >> d;
    if (10000 * y + 100 * m + d <= 310430) {
      cout << "HEISEI " << y << ' ' << m << ' ' << d << '\n';
    } else {
      cout << "? " << y - 30 << ' ' << m << ' ' << d << '\n';
    }
  }
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  string A;
  int mak = 1;
  map<string,int> S;
  for(int i=0;i<N;i++)
  {
    cin >> A;
    if(S.count(A))
    {
      S.at(A)++;
      if(S.at(A)>mak)mak=S.at(A);
    }
    else{
      S[A]=1;
    }
  }
  vector<string> ans;
  for(auto i=S.begin();i!=S.end();i++)
  {
    if(mak==i->second)ans.push_back(i->first);
  }
  sort(ans.begin(),ans.end());
  for(int i=0;i<ans.size();i++){
    cout << ans.at(i) << endl;
  }
  
}

Measured memory_bytes: 26868
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
typedef pair<int, int> P;
const int inf = 1<<30;

ll choose(ll n) {
  return n*(n-1)/2;
}

int main() {
  int n; cin >> n;
  map<ll, ll> mp;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    mp[a[i]]++;
  }
  ll res = 0;
  for(auto& m : mp) {
    res += choose(m.second);
  }

  rep(i, n) {
    ll ans = res;
    ans -= choose(mp[a[i]]);
    ans += choose(mp[a[i]]-1);
    cout << ans << endl;
  }

  return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<int> a(3*n);
	rep(i, 3*n) cin >> a.at(i);

	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());

	long long ans = 0;
	rep(i, n)
		ans += a.at(i*2+1);
	cout << ans << endl;
	
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
const ll MN = 100012;
vector<vl> v[2];
set<ll> st;
int main (void) {
    ios::sync_with_stdio(false);cin.tie(0);
    v[0].assign(10, vl());
    for (ll i = 1; i < 10; i++) {
        v[0][i].push_back(i);
        st.insert(i);
    }
    ll cur = 1;
    while (st.size() < MN) {
        v[cur].assign(10, vl());
        for (ll i = 0; i < 10; i++) {
            for (ll j = -1; j <= 1; j++) {
                if (i+j < 0 or i+j > 9) continue;
                for (ll x : v[1-cur][i+j]) {
                    ll nx = x*10 + i;
                    v[cur][i].push_back(nx);
                    st.insert(nx);
                }
            }
        }
        cur = 1 - cur;
    }
    vl lunlun (st.begin(), st.end());
    ll k; cin >> k;
    cout << lunlun[--k] << '\n';
    return 0;
}



Measured memory_bytes: 12668
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int P = 1e9 + 7;
inline int qpow(int x,int y){
	static int r; r=1; while (y){ if (y&1) r=(LL)r*x%P;y>>=1,x=(LL)x*x%P; } return r;
}
inline int Inv(int x){
	return qpow(x,P-2);
}
int fac[800050],nfac[800050],inv[800050];
inline int C(int n,int m){
	return (m>n||n<0||m<0)?(0):((LL)fac[n]*nfac[m]%P*nfac[n-m]%P); 
}
int n,k,ans;
int main(){
	cin>>n>>k;
	fac[0] = nfac[0] = inv[0] = fac[1] = nfac[1] = inv[1] = 1;
	for (int i = 2; i <= 4 * n; ++i){
		fac[i] = (LL)fac[i-1] * i % P;
		inv[i] = (LL)(P-P/i) * inv[P%i] % P;
		nfac[i] = (LL)nfac[i-1] * inv[i] % P;
	}
	if (k >= n){ cout << C(2*n-1,n-1) << endl; return 0; }
	int a = k,b = n-k,i;
	for (i = 0; i <= n; ++i){
		a = n-i; if (!a || a<b) continue;
		ans += (LL)C(n-1,a-1) * C(n,i) % P; ans%=P;
	}
	cout << ans << endl;
    return 0;
}

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

typedef long long ll;
int n, w;
vector<ll> wt;
vector<ll> value;
ll dp[100001][101];
ll answer(ll remW, int curr_idx){
    if(curr_idx == n) return 0;
    if(remW <= 0) return 0;
    if(dp[remW][curr_idx] > -1) return dp[remW][curr_idx];
    ll ans=0;
    if(remW - wt[curr_idx] >= 0) 
        ans = answer(remW-wt[curr_idx], curr_idx+1) + value[curr_idx];
    return dp[remW][curr_idx] = max(ans, answer(remW, curr_idx+1));
}
int main(){
    cin >> n >> w;
    wt.resize(n);
    value.resize(n);
    memset(dp, -1, sizeof(dp));
    for(int i=0; i<n; i++){
        cin >> wt[i] >> value[i];
    }
    cout << answer(w, 0) << endl;
}

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

int main() {
  string s;
  cin >> s;
  
  int Aat=200001,Zat=0;
  for(int i=0; i<s.size(); i++){
    if(s.at(i)=='A' && i<Aat) Aat=i;
    if(s.at(i)=='Z' && i>Zat) Zat=i;
  }
  cout << Zat-Aat+1 << endl;
}

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

using namespace std;


typedef long long ll;

const ll inf = ll(1e18);
const ll mod = 1000000007;

int stairs[1000000];

int n,m;

ll memo[1000000][3];
ll check[1000000][3];

ll dp(int pos,int step){

    //cout << pos << endl;

    if(pos>n) return 0;
    if(pos==n) return 1;

    if(stairs[pos]==1) return 0;

    if(check[pos][step]) return memo[pos][step];

    ll op1 = dp(pos+1,1);
    ll op2 = dp(pos+2,2);

    ll res = ((op1%mod)+(op2%mod))%mod;


    memo[pos][step]=res;
    check[pos][step]=true;

    return memo[pos][step];

}


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

    for(int i=0;i<m;i++){
        int r;
        cin >> r;
        stairs[r]=1;
    }

    cout << dp(0,0) << endl;


    return 0;
}

Measured memory_bytes: 15616