akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>

bool subset(const int state1, const int state2){
    return not (state1 & (~state2));
}


int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    
    int n, k; std::cin >> n >> k;
    std::vector<int> A(n), B(n); for(int i = 0; i < n; ++i) std::cin >> A[i] >> B[i];

    long long int res = 0; for(int i = 0; i < n; ++i) if( subset(A[i], k) ) res += B[i];
    for(int bit = 0; bit < 32; ++bit) if((k >> bit) & 1){
        const int mask = (k ^ (1 << bit)) | ((1 << bit) - 1);
        long long int cnt = 0;
        for(int i = 0; i < n; ++i) if( subset(A[i], mask) ) cnt += B[i];
        if(res < cnt) res = cnt;
    }
    std::cout << res << '\n';
    
    return 0;
}

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

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

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;

    map<int,int> ap;
    for(int m = 2; m <= n; m++) {
        int div=2;
        int tm=m;
        while(div*div<=tm) {
            if(tm%div==0){
                ap[div]++;
                tm/=div;
            }
            else div++;
        }
        ap[tm]++;
    }
    ap[1]=1;

    int sf=0;
    int tf=0;
    int ft=0;
    int fv=0;
    int tr=0;

    for(auto itr = ap.begin(); itr != ap.end(); itr++) {
        int tmp=itr->second;
        if(tmp>=74) sf++;
        else if(tmp>=24) tf++;
        else if(tmp>=14) ft++;
        else if(tmp>=4) fv++;
        else if(tmp>=2) tr++;
        else continue;
    }

    tf+=sf;
    ft+=tf;
    fv+=ft;
    tr+=fv;

//    cout << "75 " << sf << "\n";
//    cout << "25 " << tf << "\n";
//    cout << "15 " << ft << "\n";
//    cout << "05 " << fv << "\n";
//    cout << "03 " << tr << "\n";

    int ans=0;
    ans+=sf;
    ans+=tf*(tr-1);
    ans+=ft*(fv-1);
    ans+=fv*(fv-1)*(tr-2)/2;

    cout << ans << "\n";
    return 0;
}

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

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

bool TEST=false;
ll MOD = 1000000007;

void show(){if (TEST){cout << endl;}}
void show(string x){if (TEST){cout << x;}}
void show(string x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(ll x){if (TEST){cout << x;}}
void show(ll x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(p_ll p){
  if (TEST){cout << "{ ";show(p.first);cout << " ";show(p.second);cout << " }";}
}
void show(v_ll v){
  if (TEST){
    cout << "<begin> ";
    for (ll i=0;i<v.size();i++){show(v[i]); cout << " ";}cout <<"<end>"<< endl;
}}
void show(vv_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}
void show(vp_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}

ll mod(ll x){
  ll n=MOD;
  ll ret=x%n;
  if (ret<0)ret+=n;
  return ret;
}
void mod_self(ll &x){
  x=mod(x);
}
ll mod_inv(ll x){
  ll n=MOD;
  ll y = x,z = n-2, ret=1;
  y=mod(y);
  while (z>0){
    if(z%2==1) ret=mod(ret*y);
    y=mod(y*y);
    z/=2;
  }
  return ret;
}
ll mod_pow(ll x,ll a){
  ll y = x,z = a,ret=1;
  y=mod(y);
  if (z<0)z=-z;
  while (z>0){
    if(z%2==1) ret=mod(ret*y);
    y=mod(y*y);
    z/=2;
  }
  if (a<0) ret=mod_inv(ret);
  return ret;
}
v_ll mod_nck(ll n){
  v_ll nck(n+1,0);
  nck[0]=1;
  for (ll i=1;i<=n;i++){
    nck[i]=mod(nck[i-1]*(n+1-i));
    nck[i]=mod(nck[i]*mod_inv(i));
  }
  return nck;
}
v_ll mod_factorial(ll n){
  v_ll fct(n+1,0);
  fct[0]=1;
  for (ll i=1;i<=n;i++){
    fct[i]=mod(fct[i-1]*i);
  }
  return fct;
}

ll N,D;
vv_ll X;
int main(){
  cin >> N >> D;
  X.assign(N+10,v_ll(D+10,0));
  for (ll i=1; i<=N; i++){
    for (ll j=1; j<=D; j++){
      cin >> X[i][j];
    }
  }
  ll ans=0;
  for (ll i=1; i<N; i++){
    for (ll j=i+1; j<=N; j++){
      ll sum=0;
      for (ll k=1; k<=D; k++){
        sum+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
      }
      ll x=0;
      while (1){
        if (x*x == sum) {ans++;break;}
        else if (x*x>sum) {break;}
        x++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 888
#include <stdio.h>
int main(void){
  int a,b,c,d,p,x,y;
  scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
  x=a*p;
  if(c<p)
    y=b+(p-c)*d;
  else
    y=b;
  printf("%d\n",x<y?x:y);
  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
using namespace std;
int N, M, Q;
int A[505][505];
int main(void){
	scanf("%d %d %d", &N, &M, &Q);
	for(int i = 0; i < M; i++){
		int a, b; scanf("%d %d", &a, &b);
		A[a][b]++;
	}
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			A[i][j] += A[i-1][j] +A[i][j-1] -A[i-1][j-1];
		}
	}
	for(int i = 0; i < Q; i++){
		int a, b; scanf("%d %d", &b, &a);
		int ans = A[a][a] -A[a][b-1] -A[b-1][a] +A[b-1][b-1];
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int k; string s; cin >> k >> s;
	int ssize = s.size();
	if( ssize > k ){
		for( int i = 0; i < k; ++i ) cout << s[i];
		cout << "..." << endl;
	} else {
		cout << s << endl;
	}
}

Measured memory_bytes: 3628
n=int(input())
G=[[0 for j in range(n)] for j in range(n)]

for i in range(n):
	l=list(map(int,input().split()))
	u=l[0]
	k=l[1]
	for j in range(2,k+2):
		v=l[j]
		G[u-1][v-1]=1
for i in range(n):
	print(*G[i])



Measured memory_bytes: 6388
#include <bits/stdc++.h>
using namespace std;
int DP[3000][3000]; vector< pair<int, int> > V; 

int dp(int a, int b){
if(DP[a][b]>=0){ return DP[a][b]; }
int t=V[a].first, v=V[a].second;
if(a==0){ return DP[0][b]=(t<=b)?v:0; }
return DP[a][b]=(t>b)?dp(a-1, b):max(dp(a-1, b), dp(a-1, b-t)+v);
}

int main(){
int N, T, i, ans; cin >> N >> T; int A[N], B[N];
for(i=0; i<N; i++){ cin >> A[i] >> B[i]; V.push_back(make_pair(A[i], B[i])); }
sort(V.begin(), V.end()); memset(DP, -1, sizeof(DP));
for(i=1, ans=V[0].second; i<N; i++){ ans=max(ans, dp(i-1, T-1)+V[i].second); }
cout << ans << "\n";
}

Measured memory_bytes: 35584
from bisect import bisect
a,b,c,d,e,f=map(int,input().split())
g=f//100
lst=[0]*(g+1)
i=0
for i in range(31):
    for j in range(31):
        h=a*i+b*j
        if h<=g:
            lst[h]=1
data=[]
for i in range(g*e//c):
    for j in range(g*e//d):
        data.append(c*i+d*j)
if not data:
    data=[0]
data.sort()
ans=-1
z=[]
for i in range(1,g+1):
    if lst[i]==0:
        continue
    k=100*i
    m=bisect(data,i*e)
    if m==0:
        continue
    o=data[m-1]
    if k+o<=f:
        if ans<=100*o/(k+o):
            z=[k+o,o]
            ans=100*o/(k+o)
    else:
        m=bisect(data,f-k)
        o=data[m-1]
        if ans<=100*o/(k+o):
            z=[k+o,o]
            ans=100*o/(k+o)
print(*z)

Measured memory_bytes: 73012
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int n;
    int d[110]={0};
    cin >> n;
    for(int i=0; i<n; i++) cin >> d[i];

    int num[110]={0};
    for(int i=0; i<n; i++){
        num[d[i]]++;
    }

    int res = 0;
    for(int i=0; i<=100; i++){
        if(num[i]){
            res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin >> n >> k;
    vll a(n);
    REP(i,n) cin >> a[i];
    for(ll i=k;i<n;++i){
        if(a[i]>a[i-k]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4764
from collections import Counter

def median_sum(N, A):
    median = -1
    if N%2 == 0:
        median = (A[N//2] + A[N//2 - 1]) // 2
    else:
        median = A[N//2]
    sum = 0
    for a in A:
        sum += abs(a - median)
    print(sum)
def main():
    N = int(input())
    A = [j - (i+1) for i , j in enumerate(map(int, input().split()))]
    A.sort()
    median_sum(N, A)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 26756
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(in, &n)
	as := make([]int, 0, n+1)
	for i := 0; i < n+1; i++ {
		var a int
		fmt.Fscan(in, &a)
		as = append(as, a)
	}
	var ans int
	for i := 0; i < n; i++ {
		var b int
		fmt.Fscan(in, &b)

		d := min(as[i], b)
		as[i] -= d
		b -= d
		ans += d

		d = min(as[i+1], b)
		as[i+1] -= d
		b -= d
		ans += d
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}


Measured memory_bytes: 5504
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n;
ll c[26];
ll d[400][26];

ll calc(vector<int> &contest){
	ll last[26];
	
	memset(last,-1,sizeof(last));
	
	ll res=0;
	rep(x,0,n){
		res+=d[x][contest[x]];
		last[contest[x]]=x;
		
		rep(y,0,26) res-=c[y]*(x-last[y]);
	}
	
	return res;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	//freopen("sample1.in","r",stdin);
	
	auto begin_time=chrono::steady_clock::now().time_since_epoch().count();
	
	cin>>n;
	rep(x,0,26) cin>>c[x];
	
	rep(x,0,n){
		rep(y,0,26) cin>>d[x][y];
	}
	
	vector<int> curr;
	rep(x,0,n){
		curr.push_back(0);
	}
	
	ll val=calc(curr);
	
	while (chrono::steady_clock::now().time_since_epoch().count()-begin_time<1900000000){
		int idx=rng()%n;
		int type=curr[idx];
		
		curr[idx]=rng()%26;
		
		ll temp=calc(curr);
		if (temp>val){
			val=temp;
		}
		else{
			curr[idx]=type;
		}
	}
	
	rep(x,0,n) cout<<curr[x]+1<<endl;
	//cout<<"debug: "<<val<<endl;
}


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

int main(void)
{
    int age, fee;
    int result;
    cin >> age >> fee;

    if ( 13 <= age ) {
        result = fee;
    } else if ( 6 <= age && age <= 12) {
        result = fee / 2;
    } else {
        result = 0;
    }

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll n,m,k,p[100010],pn[100010],sum;
vector<ll>a[100010],b[100010];
void dep(ll now,ll pa){
	if(a[now].size()==1){
		ll nex=a[now][0];
		if(p[nex]!=-1){
			return;
		}
	}
	for(ll i=0;i<a[now].size();i++){
		ll nex=a[now][i];
		if(p[nex]!=-1){
			continue;
		}
		sum++;
		p[nex]=pa;
		dep(nex,pa);
	}
}
int main() {
	cin>>n>>m>>k;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		a[x].push_back(y);
		a[y].push_back(x);
	}
	for(ll i=0;i<k;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		b[x].push_back(y);
		b[y].push_back(x);
	}
	for(ll i=0;i<n;i++){
		p[i]=-1;
	}
	for(ll i=0;i<n;i++){
		sum =0;
		if(p[i]!=-1){
			continue;
		}
		p[i]=i;
		dep(i,i);
		pn[i]=sum;
	}
	for(ll i=0;i<n;i++){
		ll pa=p[i];
		ll now=pn[pa];
		now-=a[i].size();
		for(ll j=0;j<b[i].size();j++){
			ll nex=b[i][j];
			if(p[nex]==pa){
				now--;
			}
		}
		cout << now<<" ";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 15104
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vi h(n), dp(n, 1000000010);
  rep(i, n) cin >> h[i];
  dp[0] = 0;
  rep(i, n - 1){
    rep(j, k){
      if(i + j + 1 < n) dp[i + 1 + j] = min(dp[i + 1 + j], dp[i] + abs(h[i] - h[i + 1 + j]));
    }
  }
  cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		sc.close();
		if((A==B&&B==C&&C==A) ||
				A!=B&&B!=C&&C!=A){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}

	}

}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
 
int main(){
  string N;
  cin>>N;
  int K;
  cin>>K;
  ll B[N.size()][8]={};
  if(N.size()<K) cout<<0<<endl;
  else{
    B[0][1]=1;
    B[0][2]=1;
    B[0][3]=N[0]-'1';
    rep(i,N.size()-1){
      rep(j,8){
        if(j%2){
          B[i+1][j]+=B[i][j];
          if(j!=1) B[i+1][j]+=B[i][j-2]*9;
        }
      }
      if(N[i+1]=='0'){
        rep(j,8) if(j%2==0) B[i+1][j]+=B[i][j];
      }else{
        rep(j,8){
          if(j%2==0){
            B[i+1][j+1]+=B[i][j];
            if(j!=6){
              B[i+1][j+2]+=B[i][j];
              B[i+1][j+3]+=B[i][j]*(N[i+1]-'1');
            }
          }
        }
      }
    }
    cout<<B[N.size()-1][K*2]+B[N.size()-1][K*2+1]<<endl;
  }
  return 0; 
}

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

#define SENTINEL 2000000000

int cnt = 0;

void merge(vector<int> &A, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> L(n1+1);
    vector<int> R(n2+1);

    for (int i = 0; i < n1; i++) {
        L.at(i) = A.at(left + i);
    }
    for (int i = 0; i < n2; i++) {
        R.at(i) = A.at(mid + i);
    }
    L.at(n1) = SENTINEL;
    R.at(n2) = SENTINEL;

    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        cnt++;
        if (L.at(i) > R.at(j)) {
            A.at(k) = R.at(j);
            j++;
        }
        else {
            A.at(k) = L.at(i);
            i++;
        }
    }
}

void mergesort(vector<int> &A, int left, int right) {
    if (left+1 < right) {
        int mid = (left + right) / 2;
        mergesort(A, left, mid);
        mergesort(A, mid, right);
        merge(A, left, mid, right);
    }
}

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

    vector<int> A;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        A.push_back(tmp);
    }

    mergesort(A, 0, N);

    for (int i = 0; i < N; i++) {
        if (i)
            cout << " ";
        cout << A.at(i);
    }
    cout << endl;
    cout << cnt << endl;
}



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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

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

int main ()
{
    fastio
    lli a[4] ;
    loopcin(4 , a) ;
    sort(a + 0 , a + 2) ;
    sort(a + 2 , a + 4) ;
    cout << a[0] + a[2] ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  char n;
  cin >> n;
  if(65 <= (int)n && (int)n <= 90) cout << "A" << endl;
  else cout << "a" << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int H,W,i,j;
    cin>>H>>W;
  char a[H][W];
    for(i=0;i<H;i++)
        for(j=0;j<W;j++)
            cin>>a[i][j];
    for(i=0;i<W+2;i++)
      cout<<"#";
    cout<<endl;
    for(i=0;i<H;i++)
    {
        cout<<"#";
        for(j=0;j<W;j++)
            cout<<a[i][j];
        cout<<"#"<<endl;
    }
    for(i=0;i<W+2;i++)
      cout<<"#";
    
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
#define endl '\n'
#define ll long long
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';
#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()

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

ll t,i,x,j,y,z,k,n,a,b;

cin>>n>>a>>b;

if(a>b) swap(a,b);

y=min({b-1,n-a});

x=b-a;
if(x%2==0){
    y=min(x/2,y);
}
ll xa,xb,ma=0,mb=0;

xa=a+(n-b);
ma+=n-b;
if((n-xa)%2==1) ma++,xa++;
ma+=(n-xa)/2;

xb=b-(a-1);
mb+=a-1;
if((xb-1)%2==1) mb++,xb--;
mb+=(xb-1)/2;

    cout<<min({y,ma,mb});
}


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

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

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

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



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

}


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

	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		sum += a - 1;
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    Int x1,y1,x2,y2;
    cin >>x1>>y1>>x2>>y2;

    int x = x2-x1;
    int y = y2-y1;


    cout<< x2 -y <<" "<< y2+x<< " " <<x1-y << " " <<y1+x <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long A, long long B){
  std::cout << A*B << std::endl;
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(A, B);
  return 0;
}



Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N;
	cin>>N;
	rep1(i,1000000){
		N-=i;
		if(N<=0){
			rep1(j,i){
				if(j!=-N) cout<<j<<endl;
			}
			return 0;
		}
	}
}


Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main()
        {
            var str = Console.ReadLine().Split(' ');
            int x1 = int.Parse(str[0]);
            int y1 = int.Parse(str[1]);
            int x2 = int.Parse(str[2]);
            int y2 = int.Parse(str[3]);

            int dx = x2 - x1;
            int dy = y2 - y1;

            int x3 = x2 - dy;
            int y3 = y2 + dx;
            int x4 = x1 - dy;
            int y4 = y1 + dx;

            Console.WriteLine("{0} {1} {2} {3}", x3, y3, x4, y4);
        }
    }
}


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

constexpr int mod=1e9+7;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

template< typename T >
struct Combination {
  vector< T > _fact, _rfact, _inv;

  Combination(int sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1) {
    _fact[0] = _rfact[sz] = _inv[0] = 1;
    for(int i = 1; i <= sz; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[sz] /= _fact[sz];
    for(int i = sz - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for(int i = 1; i <= sz; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }

  inline T fact(int k) const { return _fact[k]; }

  inline T rfact(int k) const { return _rfact[k]; }

  inline T inv(int k) const { return _inv[k]; }

  T P(int n, int r) const {
    if(r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  T C(int p, int q) const {
    if(q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }

  T H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

int main(){
    int n,m;
    cin>>n>>m;
    modint ans(1);
    Combination<modint>Comb(200000);
    for(int i=2;i*i<=m;++i){
        int cnt=0;
        while(m%i==0){
            m/=i;
            cnt++;
        }
        if(cnt){
            ans*=Comb.C(n-1+cnt,cnt);
        }
    }
    if(m>1){
        ans*=n;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
# D
import sys
import math


# def main():
#     a, b, x = map(int, sys.stdin.readline().strip().split())
#
#     s = x / a
#     if s > a * b / 2:
#         ans = math.atan(a ** 2 / (2 * (a * b - s)))
#     else:
#         ans = math.atan(2 * s / (b ** 2))
#
#     print(90 - math.degrees(ans))

def main():
    a, b, x = map(int, sys.stdin.readline().strip().split())

    s = x / a
    if s > a * b / 2:
        ans = math.degrees(math.atan(2 * b / a - 2 * s / (a ** 2)))
        print(ans)
    else:
        ans = 90 - math.degrees(math.atan(2 * s / (b ** 2)))
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  int key;
  struct node *parent, *left, *right;
};

struct node *root, *NIL;

void insert(int);
void inorder(struct node *);
void preorder(struct node *);
struct node *find(struct node *, int);
struct node *treeSuccessor(struct node *);
struct node *treeMinimum(struct node *); 
void treeDelete(struct node *);

int main(){
  int n, i, x;
  char array[10];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s",&array[0]);
    if(!strcmp(array, "find")){
      scanf("%d", &x);
      if(find(root, x) != NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(!strcmp(array, "insert")){
      scanf("%d", &x);
      insert(x);
    }
    else if(!strcmp(array, "print")){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else {
      scanf("%d", &x);
      treeDelete(find(root, x));
    }
  }
  
  return 0;
}
void insert(int k){
  struct node *y = NIL;
  struct node *x = root;
  struct node *z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;  
  z->right = NIL;

  while(x != NIL){ 
    y = x; 
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else {
    if(z->key < y->key) y->left = z; 
    else y->right = z;
  }
}
void inorder(struct node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(struct node *u){
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}
struct node *find(struct node *u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}
struct node *treeSuccessor(struct node *x){
  struct node *y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}
struct node *treeMinimum(struct node *x){
  while(x->left != NIL) x = x->left;
  return x;
}
void treeDelete(struct node *z){
  struct node *y;
  struct node *x;

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else {
    if(y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  }

  if(y != z) z->key = y->key;

  free(y);
}



Measured memory_bytes: 20488
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;


class Main {
    
         
    static FastReader in;
    static StringBuilder out;
    
    public  static void main(String[] args) {
        out = new StringBuilder();
        in = new FastReader();
        String n=in.nextLine();
        char ch=n.charAt(n.length()-1);
        if(ch=='3'){
            System.out.println("bon");
        }else if(ch=='0' || ch=='1' || ch=='6' || ch=='8'){
            System.out.println("pon");
        }else{
            System.out.println("hon");
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
 
     
    
}

Measured memory_bytes: 32616
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int h,w;
vector<string>s(2);
int ans = 0;
struct xyz{int x;int y;int z;};
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
void bfs(int i ,int j){
     queue<xyz>q;
     q.push({i,j,0});
     bool b[h][w];
     memset(b,0,sizeof(b));
     b[i][j] = 1;
     while(!q.empty()){
      xyz top = q.front();
      q.pop();
      for(int k = 0;k<4;k++){
        if(top.x+dx[k]<0||top.x+dx[k]>=h||top.y+dy[k]<0||top.y+dy[k]>=w) continue;
        if(b[top.x+dx[k]][top.y+dy[k]]==0&&s[top.x+dx[k]][top.y+dy[k]]=='.'){
            b[top.x+dx[k]][top.y+dy[k]]=1;
            ans = max(ans,top.z+1);
            q.push({top.x+dx[k],top.y+dy[k],top.z+1});
        }
      }
     }
     //cout << ans <<endl;
}
void solve(){
cin >> h >> w;
s.resize(h);
for(int i = 0;i<h;i++) cin >> s[i];
for(int i = 0;i<h;i++){
    for(int j = 0;j<w;j++){
        if(s[i][j]=='.')
        bfs(i,j);
    }
}
cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


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

int main(){
  int H, W;
  char c;
  int cnt[50][50] = {};
  int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
  int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
  
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> c;
      if(c == '#'){
        cnt[i][j] -= 9;
        for(int k = 0; k < 8; k++){
          int x = j + dx[k], y = i + dy[k];
          if((0 <= x && x < W) && (0 <= y && y < H)) cnt[y][x]++;
        }
      }
    }
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(cnt[i][j] < 0) cout << '#';
      else cout << cnt[i][j];
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

class Solver {
    public void Solve() {
        String s = "1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51";
        String[] str = s.split(",");
        int k = sc.nextInt();
        System.out.println(str[k - 1]);
    }

    Scanner sc;

    Solver(Scanner in) {
        this.sc = in;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Solver s = new Solver(sc);
        s.Solve();
        sc.close();
    }
}


Measured memory_bytes: 21972
import java.io.*;

class Main
{
   public static void main(String[] args) throws IOException
   {

      BufferedReader br =
       new BufferedReader(new InputStreamReader(System.in));

      String str = br.readLine();
      int x = Integer.parseInt(str);

      System.out.println( (int)Math.pow(x,3) );

   }
}

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

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

  std::vector<int> a(N);
  rep(i, N) {
    std::cin >> a[i];
    --a[i];
  }

  std::vector<int> dp(N);
  dp[0] = (a[0] == 0) ? 1 : -1;

  for(int i = 1; i < N; ++i) {
    if(dp[i - 1] < 0) {
      dp[i] = (a[i] == 0) ? 1 : -1;
    } else {
      dp[i] = (a[i] == dp[i - 1]) ? dp[i - 1] + 1 : dp[i - 1];
    }
  }

  if(dp[N - 1] == -1) {
    std::cout << -1 << '\n';
  } else {
    std::cout << N - dp[N - 1] << '\n';
  }

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int n, k;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	cin >> n >> k;
	vector<int>dp(n, INT_MAX);
	vector<int>arr(n);
	//fill(dp.begin(), dp.end(), INT_MAX);
	//int arr[n+5];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++){
		for(int j=i-1, jump=0;j>=0 && jump<k;j--, jump++){
				dp[i]=min(dp[i], dp[j]+abs(arr[i]-arr[j]));
		}
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <queue>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <functional>
#define DEBUG

using std::endl;
constexpr int32_t MOD = 10000007;

int32_t N;
uint64_t BA[300000];

int main()
{
	std::cin >> N;
	for(int i = 0;i < N;++i){
		uint64_t a,b;
		std::cin >> a>>b;
		BA[i] = (b<<32|a);
	}
	
	std::sort(BA,BA+N,std::greater<uint64_t>());
	
	int32_t K_b = 0;
	int32_t K_e = N+1;
	while(K_b + 1 < K_e)
	{
		int32_t K = (K_b + K_e) / 2;
		std::priority_queue<uint32_t> q;
		uint64_t A_sum = 0;
		bool is_ok = false;
		for(int i = 0;i < N;++i){
			uint64_t b = BA[i]>>32;
			uint32_t a = BA[i]&0xFFFFFFFF;
			
			q.push(a);
			A_sum += a;
			if(q.size() > K){
				A_sum -= q.top();q.pop();
			}
			if(q.size() >= K){
				if(A_sum <= b*K){
					is_ok = true;
					break;
				}
			}
		}
		
		if(is_ok){
			K_b = K;
		}
		else{
			K_e = K;
		}
	}
	
	std::cout << K_b << std::endl;
}

Measured memory_bytes: 8212
// 基本型の受け取り
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 1次元ベクタでの受け取り
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 2次元ベクタの受け取り
type Vec2<T> = Vec<Vec<T>>;

fn read_vec2<T: std::str::FromStr>(n: i64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// println の省略
fn print<T: std::fmt::Display>(x: T) -> () {
    println!("{}", x);
}

fn main() {
    let n: i64 = read();
    let hs: Vec<i64> = read_vec();

    let mut max = hs[0];
    let mut ans = 0;

    for h in hs {
        if h >= max {
            max = h;
            ans += 1;
        }
    }
    print(ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

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

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */

int main() {
    int N; cin >> N;
    int p[N], cnt = 0;
    rep(i, N) {
        cin >> p[i];
    }
    rep(i, N) {
        if(i + 1 == p[i]) {
            ++cnt;
            i += 1;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 768
//ProblemE

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//for
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define forbe(i, begin, end) for(decltype(begin) i = (begin); i != (end); ++i)
#define forbes(i, begin, end, step) for(decltype(begin) i = (begin); i != (end); i += (step))

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
#define fi first
#define se second

//vector
template <typename Value>
static inline void fillv(Value& x, const Value& val) { x = val; }
template <typename Vector, typename Value>
static inline void fillv(Vector& v, const Value& val) { for (auto& x : v) fillv(x, val); }

static inline void Solve();

int main(int argc, char* argv[]) {
#ifdef REDIRECT_STDIO
	REDIRECT_STDIO;
#endif // REDIRECT_STDIO

	Solve();
	return 0;
}

constexpr int MAXN = 2000;
constexpr int INF = 0x7FFFFFFF;
int a[MAXN];
int b[MAXN];
int n, k, q;

vector<pii> get_ps(int i) {
	vector<pii> rst;
	for (int j = 0; j <= n; j++) {
		if (j < n && b[j] >= b[i]) {
			if (rst.empty() || rst.back().second != j - 1) {
				rst.push_back({ j, j });
			}

			rst.back().second = j;
		}
		else {
			if (!rst.empty() && rst.back().second - rst.back().first + 1 < k) {
				rst.pop_back();
			}
		}
	}
	return rst;
}

int tmp[MAXN];
int solve(int i) {
	for (int j = 0; j < n; j++) b[j] = a[j];
	auto ps = get_ps(i);
	bool hasi = false;
	vector<int> minv;

	for (auto &p : ps) {
		if (p.first <= i && i <= p.second) {
			hasi = true;
		}
		int num = p.second - p.first + 1;
		sort(b + p.first, b + p.second + 1);
		for (auto it = b + p.first; it != b + p.first + num - k + 1; it++) {
			minv.push_back(*it);
		}
	}

	if (!hasi) return INF;
	if ((int)minv.size() < q) return INF;
	sort(minv.begin(), minv.end());
	return minv[q-1] - a[i];
}

//ProblemE
void Solve() {
	cin >> n >> k >> q;
	forn(i, n) cin >> a[i];

	int ans = INF;
	for (int i = 0; i < n; i++) {
		ans = min(ans, solve(i));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int d1,d2,n,f[2001][2001],a=0,now=0;

void color(int x){
	if(x%2==1){
		for(int i=0;i<n<<1;++i){
			for(int j=0;j<n<<1;++j){
				if(((i>>now)+(j>>now))%2)f[i][j]=1;
			}
		}
	}else if(x%4==2){
		for(int i=0;i<n<<1;++i){
			for(int j=0;j<n<<1;++j){
				if((i>>now)%2)f[i][j]=1;
			}
		}
	}else{ 
		++now;
		color(x/4);
	}
}

int main(){
	scanf("%d%d%d",&n,&d1,&d2);
	color(d1);
	now=0;
	color(d2);
	for(int i=0;i<n<<1;++i){
		for(int j=0;j<n<<1;++j){
			if(f[i][j]==0){
				printf("%d %d\n",i,j);
				if(++a==n*n)return 0;
			}
		}
	}
}

Measured memory_bytes: 6656
#include <algorithm>
#include <limits>
#include <queue>
#include <vector>

template<typename CapacityType>
struct Dinic {
  using value_type = CapacityType;
  struct Edge {
    CapacityType cap;
    const int to, rev;
    const bool is_rev;
    Edge(int to, CapacityType cap, int rev, bool is_rev) : cap(cap), to(to), rev(rev), is_rev(is_rev) {}
  };

  static constexpr auto inf = std::numeric_limits<CapacityType>::max();
  const int UNREACHABLE = -1;

  std::vector<std::vector<Edge>> G;
  std::vector<int> level, iter;
  Dinic(int V) : G(V), level(V), iter(V) {}

  void add_edge(int from, int to, CapacityType cap) {
    int trev = G[from].size();
    int frev = G[to].size();
    G[from].emplace_back(to, cap, frev, false);
    G[to].emplace_back(from, 0, trev, true);
  }
  inline Edge& rev_edge(const Edge& e) {
    return G[e.to][e.rev];
  }
  CapacityType max_flow_value(int s, int t) {
    CapacityType value = 0;
    while (labeling(s), level[t] != UNREACHABLE) {
      std::fill(iter.begin(), iter.end(), 0);
      CapacityType bf;
      while (bf = blocking_flow(s, t, inf), bf > 0) {
        value += bf;
      }
    }
    return value;
  }
  bool labeling(int s) {
    std::fill(level.begin(), level.end(), UNREACHABLE);
    level[s] = 0;
    static std::queue<int> Q;
    Q.push(s);
    for (; !Q.empty(); Q.pop()) {
      auto v = Q.front();
      for (auto&& e : G[v]) {
        if (level[e.to] != UNREACHABLE) continue;
        if (e.cap == 0) continue;
        level[e.to] = level[v] + 1;
        Q.push(e.to);
      }
    }
    return true;
  }
  CapacityType blocking_flow(int v, int t, CapacityType f) {
    if (v == t) return f;
    auto& V = G[v];
    for (int& i = iter[v]; i < V.size(); ++i) {
      auto& e = V[i];
      if (e.cap == 0) continue;
      if (level[v] >= level[e.to]) continue;
      auto bf = blocking_flow(e.to, t, std::min(f, e.cap));
      if (bf > 0) {
        e.cap -= bf;
        rev_edge(e).cap += bf;
        return bf;
      }
    }
    return 0;
  }

  struct Flow {
    const int to;
    const CapacityType out;
    Flow(int to, CapacityType out) : to(to), out(out) {}
  };
  std::vector<std::vector<Flow>> build_flow() const {
    const int V = G.size();
    std::vector<std::vector<Flow>> F(V);
    for (int i = 0; i < V; i++) {
      for (auto&& e : G[i]) {
        if (not e.is_rev) continue;
        if (e.cap == 0) continue;
        F[e.to].emplace_back(i, e.cap);
      }
    }
    return F;
  }
};

#include <cstdio>
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
template<typename T=int>inline T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
template<typename T=int>inline void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}

int main() {
  int V = rd(), E = rd();
  Dinic<int> dinic(V);
  for (int i = 0; i < E; i++) {
    int u = rd(), v = rd(), c = rd();
    dinic.add_edge(u, v, c);
  }
  wr(dinic.max_flow_value(0, V - 1));
  return 0;
}

Measured memory_bytes: 2668
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    ll d;

    cin>>n>>d;

    int ans = 0;
    for(int i = 0; i < n; i++) {
        ll x, y;
        cin>>x>>y;
        ll temp = x * x + y * y;
        if(temp <= (d * d))
            ans++;
    }

    cout<<ans<<endl;

    return 0;
}



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

int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> as(m);
	for (auto &&a : as)
	{
		cin >> a;
	}

	cout << min(distance(as.begin(), lower_bound(as.begin(), as.end(), x)), distance(upper_bound(as.begin(), as.end(), x), as.end())) << endl;

	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
const int N=1e5+100;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int k[N];LL b[N];
int main()
{
	int n=gi(),m=gi(),i,x=gi(),y;
	LL ans,sum=0;
	for (i=1;i<n;i++,x=y) {
		y=gi();
		k[x+1]++,b[x+1]-=x+1;
		if (x<=y) {
			sum+=y-x;
			k[y+1]--,b[y+1]+=x+1;
		} else {
			sum+=m-x+y;
			k[1]++,b[1]+=m-x-1;
			k[y+1]--,b[y+1]-=m-x-1;
		}
	}
	ans=sum;
	for (i=1;i<=m;i++) {
		k[i]+=k[i-1];b[i]+=b[i-1];
		ans=min(ans,sum-1LL*k[i]*i-b[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1408
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String n = sc.next();

    char[] c = n.toCharArray();

    if(c[0]==55||c[1]==55||c[2]==55){
      System.out.println("Yes");
    }else{


    System.out.println("No");
  }

  }
}

Measured memory_bytes: 35700