akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  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 c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  vi v(11,0);
  rep(i,3){
      int a;cin>>a;
      v[a]++;
  }
  string ans="NO";
  if(v[5]==2&&v[7]==1)ans="YES";
  cout(ans);
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int A, B;
    cin >> A >> B;
    if(B % A == 0) cout << A + B << endl;
    else cout << B - A << endl;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,j,t;
    string s;
    while(cin>>s)
    {
        int cnt=0;
        for(i=0;i<3;i++)
        {
            if(s[i]=='o'||s[i]=='O')
                cnt++;
        }
        cout<<700+cnt*100<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <iostream>

using namespace std;

typedef long long int ll;

const long long INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9; 
 
int main(void){
    int n,k;
    scanf("%d", &n);
    scanf("%d", &k);

    ll h[n];
    ll costs[n];
    costs[n - 1] = 0;

    for( int i = 0; i < n; ++i ){
        ll height;
        scanf("%lld", &height);
        h[i] = height;
    }
    for( int i = n - 2; i >= 0; --i ){
        ll c;
        c = INF;

        for (int a = 1; a <= k && a < n - i; ++a) {
            int jump_to;
            jump_to = i + a;
            ll jump_cost;
            jump_cost = abs(h[jump_to] - h[i]) + costs[jump_to];
            c = (c > jump_cost) ? jump_cost : c;
        }
        costs[i] = c;
    }
    printf("%lld", costs[0]);
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(){
	int n,k;
	scanf("%d",&n);
	scanf("%d",&k);
	int x=1;
	for(int i=0;i<n;i++){
		if(x*2<x+k){
			x*=2;
		}
		else if(x*2>x+k){
			x+=k;
		}
		else{
			x*=2;
		}
	}
	printf("%d",x);
	puts("");
	return 0;
}

Measured memory_bytes: 1736
/*input
4
aaaa
a
aaa
aa
*/
#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 main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    set<string> st;
    for(int i = 0; i < n; i++)
    {
    	string s; cin >> s;
    	st.insert(s);
    }
    cout << st.size();

    return 0;
}

Measured memory_bytes: 19200
#include <random>
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld eps = 1e-12;
constexpr int inf = numeric_limits<int>::max() / 2;
constexpr ll mod = 1e9 + 7;
mt19937_64 rnd{random_device()()};

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<ll> k(n), l(n), r(n);
    ll ans = 0;
    vector<vector<int>> pl(n + 1), mn(n + 1);
    for (int i = 0; i < n; i++) {
      cin >> k[i] >> l[i] >> r[i];
      k[i]--;
      ans += min(l[i], r[i]);
      if (l[i] > r[i]) {
        pl[k[i]].push_back(l[i] - r[i]);
      }
      if (l[i] < r[i]) {
        mn[k[i] + 1].push_back(r[i] - l[i]);
      }
    }
    {
      priority_queue<ll, vector<ll>, greater<ll>> que;
      for (int i = 0; i < n; i++) {
        for (auto v : pl[i]) que.push(v);
        while (que.size() > i + 1) que.pop();
      }
      while (!que.empty()) {
        ans += que.top();
        que.pop();
      }
    }
    {
      priority_queue<ll, vector<ll>, greater<ll>> que;
      for (int i = n - 1; i >= 0; i--) {
        for (auto v : mn[i]) que.push(v);
        // n - i まで ok
        while (que.size() > n - i) que.pop();
      }
      while (!que.empty()) {
        ans += que.top();
        que.pop();
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 23664
#include<bits/stdc++.h>
using namespace std;
int main(){
//	int a,b;
//	scanf("%d%d",&a,&b);
//	map<int,int>m;
//	m[a]=1;
//	m[b]=1;
//	for(int i=1;i<=3;i++)
//		if(m[i]==0){
//			printf("%d\n",i);
//			break;
//		}
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int f=0;
	for(int i=0;i<n;){
		if(f==0)
			cout<<s[i],f=!f;
		else{
			f=!f;
			cout<<t[i];
			i++;
		}
	}
	
	return 0;
} 

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

int main(){
	while(1){
	int x,y;
	cin >> x >>y;
	if(x==0&&y==0)
	{break;}
	


  for ( int i = 0; i < x; i++ ){
    for ( int j = 0; j < y; j++ ){
        cout << "#";
    }
    cout << endl;
  }
	cout<<endl;}

    return 0;
	}


Measured memory_bytes: 1152
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>
#include <algorithm>

using namespace std;

int64_t N;
vector<uint32_t> A, F;

bool trial(int64_t time, int64_t K)
{
  bool feasible = true;
  for (uint n=0; feasible && n<N; ++n) {
    int32_t x = A[n];
    int32_t y = F[n];
    K -= max(0l, x - (time)/y);
    feasible = 0 <= K;
  }
  return feasible;
}

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

  A.reserve(N);
  F.reserve(N);

  for (uint n=0; n<N; ++n) {
    uint32_t a;
    cin >> a;
    A.push_back(a);
  }

  for (uint n=0; n<N; ++n) {
    uint32_t f;
    cin >> f;
    F.push_back(f);
  }

  sort(A.begin(), A.end());
  sort(F.begin(), F.end(), std::greater<uint32_t>());

  if (trial(0,K)) {
    cout << 0 << endl;
    return 0;
  }
  
  int64_t time = 1;
  while(!trial(time,K))
    time *= 2;

  int64_t max_impossible = time/2, min_possible = time;
  while (min_possible > max_impossible+1) {
    time = (max_impossible + min_possible)/2;
    if (trial(time,K))
      min_possible = time;
    else
      max_impossible = time;
  }

  cout << min_possible << endl;
  
  return 0;
}


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

struct UF{
    int par[200000];
    int rank[200000];
    
    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
        }
    }
    
    int find(int x){
        if(par[x]==x)return x;
        return par[x]=find(par[x]);
    }
    
    void unite(int x, int y){
        x=find(x);
        y=find(y);
        if(x!=y){
            if(rank[x]<rank[y]){
                par[x]=y;
            }else{
                par[y]=x;
                if(rank[x]==rank[y])rank[x]++;
            }
        }
    }
    
    bool same(int x, int y){
        return find(x)==find(y);
    }
};

int main(void){
    long long n,m,f=0,s=0;
    UF u;
    cin>>n>>m;
    u.init(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        u.unite(a,b);
    }
    for(int i=0;i<n;i++){
        if(u.same(0,i)){
            f++;
        }else if(u.same(1,i)){
            s++;
        }
    }
    if(f>s){
        f=n-s;
    }else{
        s=n-f;
    }
    n=f*(f-1)/2+s*(s-1)/2;
    cout<<n-m<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n, k;
  cin >> n >> k;
  vector< int > v(n);
  for (int i=0; i<n; ++i) cin >> v[i];
  int ans = 0;
  multiset< int > cur_l;
  for (int i=0; i<=min(n, k); ++i) {
    if (i>0) {
      cur_l.insert(v[i-1]);
    }
    multiset< int > cur_r;
    for (int j=0; i+j<=min(n, k); ++j) {
      if (j>0) {
        cur_r.insert(v[n-j]);
      }
      auto li=cur_l.begin(), ri=cur_r.begin();
      for (int d=0; i+j+d<k; ++d) {
        if (li == cur_l.end() && ri == cur_r.end()) break;
        if (li == cur_l.end()) {
          if (*ri < 0) ri++;
          else break;
        }
        else if (ri == cur_r.end()) {
          if (*li < 0) li++;
          else break;
        }
        else {
          if (*li <= *ri && *li < 0) li++;
          else if (*li > *ri && *ri < 0) ri++;
        }
      }
      int cur = 0;
      while (li != cur_l.end()) {
        cur += *li;
        li++;
      }
      while (ri != cur_r.end()) {
        cur += *ri;
        ri++;
      }
      /*
      if (i==3 && j==0) {
        cout << i << " " << j << " " << cur << endl;
        auto lli = cur_l.begin(), rri = cur_r.begin();
        while (lli != cur_l.end()) {cout << *lli << " "; lli++;}
        while (rri != cur_r.end()) {cout << *rri << " "; rri++;}
        cout << endl;
      }
      */
      ans = max(ans, cur);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) FOR((i),0,(n))
#define N_MAX 5000
#define M_MAX 500000
#define ll long long

//??????????????¨??????
int n,m;
int xy[N_MAX][2];
int square[4];


//??????
int ans;
bool ok;


int main() {
	//??\???
	cin>>n>>m;
	rep(i,n)rep(j,2)cin>>xy[i][j];

	//xy??????x???????????????????????????????????????
	bool flag=true;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n-1 ; j >= i + 1; j--) {
			if (xy[j][0] < xy[j - 1][0]) {
				//??£??\????´??????????
				swap(xy[j],xy[j-1]);
				flag=1;
				/*
				temp0 = xy[j][0];
				xy[j][0] = xy[j - 1][0];
				xy[j - 1][0] = temp0;

				temp1 = xy[j][1];
				xy[j][1] = xy[j - 1][1];
				xy[j - 1][1] = temp1;

				rep(k, 2) {
					temp[k]=xy[j][k];
					xy[j][k]=xy[j-1][k];
					xy[j-1][k]=temp[k];
				}
				*/
			}
		}
	}

	//?¨????
	rep(roop, m) {
		//???????¨????
		ans=0;

		//??\???
		rep(i,4)cin>>square[i];

		//??????????§??????????x?????´????????¢???(?????????????????????)
		int left=0,right=n,mid;
		while (left < right) {
			mid=(left+right)/2;
			if(left==mid )break;
			if(xy[mid][0]==square[0])break;
			else if(square[0]<xy[mid][0])right=mid;
			else                         left=mid;
		}

		//cout<<"left: "<<left<<endl;
		//cout << "ss" << square[1]<<endl;
		//cout<<xy[left][1] << endl;
		while(xy[left][0]<=square[2]){
			if(square[0] <= xy[left][0])
			   if(xy[left][0] <= square[2])
			   if(square[1] <= xy[left][1])
			   if(xy[left][1] <= square[3])
			   ans++;
			left++;
			if(left>=n)break;
		}
		cout<<ans<<endl;
	}
	/*
	//???????????°
	rep(i, n) {
		rep(j,2)cout<<xy[i][j]<<" ";
		cout<<endl;
	}
	*/
	
	//cin>>m;



	return 0;
}

Measured memory_bytes: 3112
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def cost(l, r):
        if l + 2 == r:
            return aa[l] + aa[l + 1]
        if l + 1 == r:
            return 0
        if dp[l][r] != -1:
            return dp[l][r]
        res = 10 ** 16
        for m in range(l + 1, r):
            res = min(res, cost(l, m) + cost(m, r))
        res += cumsum_aa[r] - cumsum_aa[l]
        dp[l][r] = res
        return res

    n = int(input())
    aa = list(map(int, input().split()))
    dp = [[-1] * (n + 1) for _ in range(n + 1)]
    cumsum_aa = [0]
    for i, a in enumerate(aa):
        cumsum_aa.append(cumsum_aa[i] + a)
    print(cost(0, n))

main()


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

int main () {
  string N;
  cin >> N;
  if ( N.at(0) == N.at(1) && N.at(1) == N.at(2) ) cout << "Yes" << endl;
  else if ( N.at(1) == N.at(2) && N.at(2) == N.at(3) ) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define f(i,a,b) for(int i=a;i<b;i++)
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int fiv(int n){
  if(n==0){
    return 0;
  }
  else if(n==1){
    return 1;
  }
  return fiv(n-1)+fiv(n-2);
}
ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}
int main(){
  int n,m ;
  cin>>n>>m;
  vl p(100000);
  vl y(100000);
  vvl yp(100001);
  rep(i,m){ 
    cin>>p[i]>>y[i];
    yp[p[i]].push_back(y[i]);
  }
  
  rep(i,n){
    sort(all(yp[i+1]));
  }
  rep(i,m){
    printf("%06ld%06ld\n",   p[i]  , ll(lower_bound( all(yp[p[i]]),y[i])-yp[p[i]].begin()+1  )     );
  }
}





Measured memory_bytes: 8576
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

string S;
string ptn="01";
int bw,wb;

signed main(){

    in(S);

    rep(i,S.size()){
        if(S[i]!=ptn[i%2]) bw++;
        if(S[i]!=ptn[(i+1)%2]) wb++;
    }

    out(min(bw,wb));

    return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
int main() {
	int A, B;
	cin >> A >> B;
	int ans = 0;
	for (int i = A; i <= B; i++) {
		string S = to_string(i);
		int j = 0, k = S.size() - 1;
		bool Palindromic = true;
		while (j != k) {
			if (S.at(j) != S.at(k)) Palindromic = false;
			j++;
			k--;
		}
		if (Palindromic)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  char scan[8];
  int loop1, loop2, loop3, result, n, n_judge[100], max, min;

  while(1){
    for(loop1 = 0; loop1 < 8; loop1++){
      scan[loop1] = '\0';
    }
    for(loop1 = 0; loop1 < 100; loop1++){
      n_judge[loop1] = '\0';
    }
    result = 0;

    fgets(scan, 8, stdin);
    n = atoi(scan);

    if(n == 0) break;

    for(loop1 = 0; loop1 < n; loop1++){
      fgets(scan, 8, stdin);
      n_judge[loop1] = atoi(scan);
      for(loop2 = 0; loop2 < 8; loop2++){
	scan[loop2] = '\0';
      }
    }
 
    max = n_judge[0];
    min = n_judge[0];

    for(loop1 = 0; loop1 < n; loop1++){
      result += n_judge[loop1];
      if(n_judge[loop1] > max) max = n_judge[loop1];

      if(n_judge[loop1] < min) min = n_judge[loop1];

    }

    result = result - max;
    result = result - min;

    result = result / (n - 2);

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

  }

}

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

int main(){
	int n;
	char ch;
	bool bl = false;
	cin >> n;

	for( int i = 0; i < n; ++i ){
		cin >> ch;
		if( ch == 'Y' ){
			bl = true;
			break;
		}
	}
	if( bl ) cout << "Four" << endl;
	else cout << "Three" << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
P = list(map(float, input().split()))

dp = [[0] * 3010 for _ in range(3010)]
dp[0][1] = 1
dp[0][0] = 1
# dp[i][j] iまでのコインを使って、j枚の表が出る確率
for i in range(N):
    for j in range(i+1):
        dp[i+1][j+1] += dp[i][j] * P[i]
        dp[i+1][j] += dp[i][j] * (1-P[i])

print(sum(dp[N][N//2+1:]))



Measured memory_bytes: 254344
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;




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

	cin >> N >> M;
	vector<long long int>v(N - 1);
	for (auto &i : v)cin >> i;
	vector<vector<long long int>>w(N, vector<long long int>(M));
	for (auto &i : w)for (auto &j : i)cin >> j;
	vector<vector<long long int>>ret(N + 1, vector<long long int>(N + 1));
	for (int j = 0; j < M; j++) {
		set<int>s;
		s.insert(-1);
		s.insert(N);
		vector<pair<int, int>>box;
		for (int i = 0; i < N; i++) {
			box.push_back({ w[i][j],i });
		}
		sort(box.begin(), box.end());
		reverse(box.begin(), box.end());
		for (auto i : box) {
			s.insert(i.second);
			auto it = s.find(i.second);
			auto bef = prev(it);
			auto nx = next(it);
			ret[(*bef) + 1][i.second] += i.first;
			ret[(*bef) + 1][(*nx)] -= i.first;
			ret[i.second + 1][(i.second)] -= i.first;
			ret[i.second + 1][(*nx)] += i.first;
		}
	}
	for (int i = 1; i < N - 1; i++)v[i] += v[i - 1];
	for (int i = 0; i <= N; i++) {
		for (int j = 1; j <= N; j++)ret[i][j] += ret[i][j - 1];
	}
	for (int i = 0; i <= N; i++) {
		for (int j = 1; j <= N; j++)ret[j][i] += ret[j - 1][i];
	}
	long long int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			long long int bag = ret[i][j];
			if (i)bag += v[i - 1];
			if (j)bag -= v[j - 1];
			ans = max(ans, bag);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 204316
#include <iostream>
#include <queue>
using namespace std;
int main()
{
  int n,q;
  cin >> n >> q;
  queue< pair<string,int> > que;
  for(int i=0; i<n; i++){
    string name;
    int t;
    cin >> name >> t;
    que.push(make_pair<string,int>(name,t));
  }
  int count = 0;
  while(!que.empty()){
    pair<string,int> p = que.front(); que.pop();
    if(p.second <= q){
      count += p.second;
      cout << p.first << " " << count << endl;
    }else{
      p.second -= q;
      count += q;
      que.push(p);
    }
  }
  return 0;
}

Measured memory_bytes: 4404
# 2020/09/26
# ACL Beginner Contest - C

# Union Find
# Define List
pl = list()

def root(in_root):
    if pl[in_root] == in_root:
        return in_root
    else:
        pl[in_root] = root(pl[in_root])
        return pl[in_root]

def isSame(in_a, in_b):
    if root(pl[in_a]) == root(pl[in_b]):
        return True
    else:
        return False

def unite(in_a, in_b):
    wk_a = root(in_a)
    wk_b = root(in_b)
    if wk_a == wk_b:
        return False
    else:
        if wk_a < wk_b:
            pl[wk_b] = wk_a
        else:
            pl[wk_a] = wk_b

# Input n, m
n, m = map(int,input().split())

# Init List
for i in range(n+1):
    pl.append(i)

# Input a, b
for i in range(m):
    a, b = map(int,input().split())
    wa = min(a, b)
    wb = max(a, b)
    unite(wa, wb)

# Count
ans = 0
for i in range(1, n+1):
    if pl[i] == i:
        ans = ans + 1

# Output
print(ans-1)


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"


template <typename T, typename K> struct P {
	T a; K b;
};

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
vector <P <ll, ll> >prime_factorize( ll N );
ll pow( ll a, ll n );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
int main( void ){
	// initialize();
	int N; cin >> N;
	int maximum = 0, sec_max = 0;
	vector<int> vec(N);
	rep(i,0,N){
		cin >> vec[i];
		if (maximum <=vec[i]){
			sec_max = maximum;
			maximum = vec[i];
		}
		else if (sec_max < vec[i])
			sec_max = vec[i];
	}
	rep(i,0,N){
		if (vec[i] == maximum)
			cout << sec_max << endl;
		else
			cout << maximum << endl;
	}

}

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

/*
 * @fn eratosthenes
 * @brief O(NloglogN)~=(N)
 * @param N: その数まで
 * @return 0 or 1 の配列 (boolは都合が悪い)
 */
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}

/*
 * @fn prime_factorize
 * @brief O(√N): 素因数分解
 * @param N: 素因数分解する数
 * @return vec: (a: 素数, b: 個数)
 */
vector <P <ll, ll> >prime_factorize( ll N ){
	vector <P <ll, ll> > vec;
	int lim = sqrt( N ) + 1;
	rep( i, 2, N + 1 ){
		if (i >= lim){
			vec.push_back( P <ll, ll>{N, 1} );
			break;
		}
		if (N % i == 0){
			vec.push_back( P <ll, ll>{i, 0} );
			while(N % i == 0){
				N /= i;
				vec.back().b++;
			}
		}
	}
	return vec;
}
/*
 * @fn pow
 * @brief a^n
 * @param a: 基数
 * @param n: 指数
 */
ll pow( ll a, ll n ) {
	ll res = 1;
	while (n > 0){
		if (n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 2432
n=int(input())
dp=[0]*n
l=list(map(int,input().split()))
dp[1]=abs(l[0]-l[1])
for i in range(2,n):
  dp[i]=min(dp[i-1]+abs(l[i-1]-l[i]),dp[i-2]+abs(l[i-2]-l[i]))
print(dp[-1])

Measured memory_bytes: 14748
let rec fix f x = f (fix f) x
let () =
  Scanf.scanf "%d" @@ fun n ->
  let ad = Array.init 10 (fun _ -> Array.make 10 0) in
  for i = 1 to n do
    let d = fix (fun f x -> if x < 10 then x else f (x/10)) i in
    ad.(i mod 10).(d) <- ad.(i mod 10).(d) + 1;
  done;

  fix (fun f ans i j ->
    if i > 9 then ans
    else if j > 9 then f ans (i+1) 1
    else f (ans + ad.(i).(j) * ad.(j).(i)) i (j+1)) 0 1 1 
  |> Printf.printf "%d\n"


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

const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  vector<int> dp(n,INF);
  dp[0] = 0;
  for(int i = 1; i < n; i++) {
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
    if(i > 1) dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 4064
#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<queue>
using namespace std;

const int INF=0x3f3f3f3f;
int h,w,n;//
typedef pair<int,int> P;
queue <P> q;
char g[1002][1002];
int x,y;//起点的横纵坐标
int nx,ny;//下一个点
int d[1002][1002];
int _x[4]={-1,0,0,1},_y[4]={0,-1,1,0};
bool is_legal(int x,int y)//格子是否越界
{
	if(x>=1&&x<=h&&y>=1&&y<=w) return true;
	else return false;
		
}
//队列初始要有起点
//从起点出发，目的地：power的奶酪
//power奶酪的最小步数
int bfs(int power)
{
	while(!q.empty()) q.pop();
	q.push(P(x,y));
	for(int i=1;i<=h;i++)
			for(int j=1;j<=w;j++)
			{
				d[i][j]=INF;
			}
	d[x][y]=0;
	while(!q.empty())
	{
		P p=q.front();
		q.pop();
		int row=p.first;
		int column=p.second;
		
		for(int i=0;i<4;i++)
		{
			nx=row+_x[i];
			ny=column+_y[i];
			if(!is_legal(nx,ny)) continue;
			
			//d[nx][ny]=d[row][column]+1;障碍物或越界，d数组不变
			if(g[nx][ny]=='0'+power) 
			{
				d[nx][ny]=d[row][column]+1;
				//下一次bfs的起点
				x=nx;
				y=ny;
				return d[nx][ny];
			}
			if(g[nx][ny]!='X') 
			{
				//更新d的条件没判，w了好多次
				if(d[row][column]+1<d[nx][ny])
				{
					d[nx][ny]=d[row][column]+1;
				q.push(P(nx,ny));
				}
				
			}
		}
	}
	return INF;
}

int main()
{
	while(scanf("%d %d %d",&h,&w,&n)!=EOF)
	{
		for(int i=1;i<=h;i++)
			for(int j=1;j<=w;j++)
			{
				cin>>g[i][j];
				if(g[i][j]=='S') {x=i;y=j;}
			}
		
		int ans=0;
		
		
		//1～n奶酪的最小步数之和
		
		for(int k=1;k<=n;k++) {
			ans+=bfs(k);
		}
		
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 8108
#!/usr/bin/perl                                                                                 

use strict;

main();

sub main{
    my $S = <STDIN>;
    chomp $S;
    my $length = length($S);
    my $flag = 0;
    my @chars = split("", $S);

    for(my $i = 0; $i < $length; $i++){
        if(@chars[$i] == 1){
            $flag = $flag + 1;
        }
    }

    print("$flag\n");

}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
using namespace std;
int main (void) {
    int N;
    int four = 0;
    int two = 0;
    int other = 0;

    cin >> N;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (a % 4 == 0) four++;
        else if (a % 2 == 0) two++;
        else other++;
    }

    if (two == 0) {
        if (four >= other - 1) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if (four >= other) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
using namespace std;

typedef long long lint;

int main(){
    int n;
    cin >> n;
    vector< vector<int> > a(n);
    for(int i = 0 ; i < n ; i++){
        a[i].resize(n);
        for(int j = 0 ; j < n ; j++){
            cin >> a[i][j];
        }
    }
    bool ok = true;
    lint ans = 0;
    for(int i = 0 ; i < n ; i++){
        for(int j = i + 1 ; j < n ; j++){
            bool flag = true;
            for(int k = 0 ; k < n ; k++){
                if(i == k || j == k){
                    continue;
                }
                if(a[i][k] + a[k][j] < a[i][j]){
                    ok = false;
                    break;
                }else if(a[i][k] + a[k][j] == a[i][j]){
                    flag = false;
                }
            }
            if(flag){
                ans += a[i][j];
            }
        }
    }
    if(ok){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
//#include<boost\lexical_cast.hpp> 

#define ll long long
#define ld long double
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int> 
#define vvi vector< vi >
#define vl vector<ll>
#define vpi vector<pi> 
#define vpl vector<pl>

#define PB emplace_back
#define MP make_pair
#define SZ(x) (ll)x.size()
#define SS second
#define FF first


#define DEB(x) cout << #x << "=" << x << endl
#define DEB2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define DEB3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define DEB4(x, y, z, k) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," <<#k << "=" << k<< endl
#define DEBC(a) for(auto x:a) cout<<x<<" ";
#define DEBP(name,a) cout<<name<<endl;for(auto x:a){ cout<<x.first<<"\t"<<x.second<<endl;}

#define INF 0x7fffffff
#define LINF 2000000000000000007
#define endl "\n"
#define MOD 1000000007
#define MAX 100010

#define FILL(a,x) memset(x,a,sizeof x)
#define ALL(x) x.begin(),x.end()
#define REP(i,a,n) for(ll i=a;i<n;++i)
#define REPR(i,n,b) for(ll i=n;i>=b;i--)
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

using namespace std;
//using boost::lexical_cast;
//using boost::bad_lexical_cast;
int main(){
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    int test=1;
    //cin>>test;
    while(test--){
       ll n;
       cin>>n;
       ll cnt=0, ans=0;
       while(n!=0){
            ans+=pow(2, cnt);
            cnt++;
            n=n/2;
       }
       cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B;
    cin >> A >> B;
    if(B==A) printf("%d",A*2); 
    else if(A>B) printf("%d",A*2-1);
    else printf("%d",B*2-1);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.awt.*;

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

    int n = sc.nextInt();
    int[] even = new int[100000];
    int[] odd = new int[100000];

    for (int i = 0; i < n/2; i++) {
      odd[sc.nextInt()-1]++;
      even[sc.nextInt()-1]++;
    }

    int odd_max_index = maxIndex(odd);
    int even_max_index = maxIndex(even);
    int odd_max = odd[odd_max_index];
    int even_max = even[even_max_index];

    int ans = 0;
    if (odd_max_index != even_max_index) {
      ans = n - odd_max - even_max;
    } else {
      odd[odd_max_index] = 0;
      even[even_max_index] = 0;

      odd_max_index = maxIndex(odd);
      even_max_index = maxIndex(even);

      ans = Math.min(n-odd_max-even[even_max_index], n-even_max-odd[odd_max_index]);
    }

    System.out.println(ans);
  }

  public static int maxIndex(int[] x) {
    int tmp = -1;
    int max_index = 0;

    for (int i = 0; i < x.length; i++) {
      if (x[i] > tmp) {
        tmp = x[i];
        max_index = i;
      }
    }

    return max_index;
  }
}


Measured memory_bytes: 50400
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
 
const long INF = (1l << 30);
const long LINF = (1l << 60);
const long MOD = 1000000007;

long power(long num1, unsigned long num2){
	if(num2 == 0){
		return 1;
	}
	if(num2 % 2 == 1){
		return num1 * power(num1, (num2-1)) % MOD;
	}
	long r = power(num1, num2/2);
	return r*r % MOD;
}

std::string s;
long n;
long dp[100005];
long p[100005];

int main(){
	std::cin >> s;
	n = s.length();
	if(s[n-1] == '0'){
		dp[n-1] = 1;
	}else{
		dp[n-1] = 3;
	}
	p[n-1] = 1;
	for(long i = n - 2; i >= 0; i--){
		p[i] = p[i+1] * 3 % MOD;
		if(s[i] == '0'){
			dp[i] = dp[i+1];
		}else{
			dp[i] = (dp[i+1] * 2 + p[i]) % MOD;
		}
	}
	/*
	for(int i = 0; i < n; i++){
		printf("%ld ", dp[i]);
	}
	printf("\n");
	//*/
	printf("%ld\n", dp[0]);
}


Measured memory_bytes: 2048
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n;
    string s;
    cin>>n>>s;
    int r=count(all(s),'R'),w=count(all(s),'W'),cnt=count(s.begin(),s.begin()+r,'W');
    cout<<min({r,w,cnt});
    return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
//#define f(i, a, b) for(int i = 0; i < b; ++i)


int main(){
    long long h = 100;
    long long x;
    cin >> x;
    long long count = 0;
    while(h < x){
        h= h * 1.01;
        count = count + 1;
    }
    cout << count;
    
    }
    




//stoi('213')

//to_string

Measured memory_bytes: 3636
#include <stdio.h>
#define ll long long
int gcd(int p,int q){while(q){int t=p%q;p=q;q=t;}return p;}

int a[100010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int p2=a[0]&-a[0];
	for(int i=0;i<n;i++){
		if((a[i]&-a[i])!=p2){
			puts("0");
			return 0;
		}
		a[i]/=p2;
	}
	
	ll L=p2/2;
	for(int i=0;i<n;i++){
		int d=gcd(L,a[i]);
		if(L/d*a[i]>m){
			puts("0");
			return 0;
		}
		L=L/d*a[i];
	}
	
	printf("%lld",(m/L+1)/2);
}

Measured memory_bytes: 2120
#include <iostream>
#include <list>
#include <cassert>

using namespace std;

int main() {
  int q;
  cin >> q;
  list<int> L;
  auto it = L.begin();
  while(q--) {
    int t;
    cin >> t;
    if(t == 0) {
      int x;
      cin >> x;
      it = L.insert(it, x);
    } else if(t == 1) {
      int d;
      cin >> d;
      advance(it, d);
    } else if(t == 2) {
      it = L.erase(it);
    } else {
      assert(false);
    }
  }
  for(int a : L) cout << a << endl;
  return 0;
}



Measured memory_bytes: 18568
#!/usr/bin/python3

import array
from fractions import Fraction
import math
import os
import sys


class Vec(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y
        super().__init__()

    def __add__(self, other):
        return Vec(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return Vec(self.x - other.x, self.y - other.y)

    def __mul__(self, scalar):
        return Vec(self.x * scalar, self.y * scalar)

    def __rmul__(self, scalar):
        return Vec(self.x * scalar, self.y * scalar)

    def __truediv__(self, scalar):
        return Vec(self.x / scalar, self.y / scalar)

    def __iadd__(self, other):
        self.x += other.x
        self.y += other.y
        return self

    def __isub__(self, other):
        self.x -= other.x
        self.y -= other.y
        return self

    def __imul__(self, scalar):
        self.x *= scalar
        self.y *= scalar
        return self

    def __idiv__(self, scalar):
        self.x /= scalar
        self.y /= scalar
        return self

    def __neg__(self):
        return Vec(-self.x, -self.y)

    def dot(self, other):
        return self.x * other.x + self.y * other.y

    def cross(self, other):
        return self.x * other.y - self.y * other.x

    def abs2(self):
        return self.x * self.x + self.y * self.y

    def __abs__(self):
        return math.sqrt(float(self.abs2()))

    def __str__(self):
        return '({}, {})'.format(self.x, self.y)


def main():
    x1, y1, x2, y2 = read_ints()
    Q = read_int()
    for _ in range(Q):
        x, y = read_ints()
        print(solve(Vec(x1, y1), Vec(x2, y2), Vec(x, y)))


CCW = 'COUNTER_CLOCKWISE'
CW = 'CLOCKWISE'
OLB = 'ONLINE_BACK'
OLF = 'ONLINE_FRONT'
OL = 'ON_SEGMENT'


def solve(u, v, a):
    v -= u
    a -= u
    c = v.cross(a)
    if c > 0:
        return CCW
    if c < 0:
        return CW
    d = v.dot(a)
    if d < 0:
        return OLB
    if v.abs2() < a.abs2():
        return OLF
    return OL


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


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


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()



Measured memory_bytes: 7156
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI t;
in n;
in ans(){
  in sr=n-1;
  in sl=n-1;
  while(sr+1<sz(t) && t[sr]!=t[sr+1])
    ++sr;
  while(sl-1>=0 && t[sl]!=t[sl-1])
    --sl;
  if((n-1-sl)<(sr-(n-1)))
    return t[sl];
  return t[sr];
}
VI mar;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin>>n;
  mar.resize(2*n-1);
  t.resize(2*n-1);
  forv(i,mar)
    cin>>mar[i];
  in mn=0;
  in mx=2*n-1;
  in md;
  while(mx-mn>1){
    md=(mn+mx)/2;
    forv(i,mar)
      t[i]=(mar[i]>md);
    if(ans())
      mn=md;
    else
      mx=md;
  }
  cout<<mx<<endl;
  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

int32_t main()
{
	c_p_c();
	string s; cin >> s;

	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K,Q; cin >> N >> K >> Q;
    vector<int> A(N);
    rep(i,N) cin >> A[i];

    vector<pii> B(N);
    rep(i,N) B[i] = {A[i],i};
    sort(all(B));
    set<int> dic;
    int ans = 1e9;
    rep(i,N) {
        priority_queue<int, vector<int>, greater<int>> pq,rs;
        rep(j,N) {
            if (dic.count(j)) {
                int M = pq.size();
                rep(_,M-K+1) {
                    rs.emplace(pq.top()); pq.pop();
                }
                while (!pq.empty()) pq.pop();
            } else {
                pq.emplace(A[j]);
            }
        }
        int M = pq.size();
        rep(_,M-K+1) {
            rs.emplace(pq.top()); pq.pop();
        }
        while (!pq.empty()) pq.pop();
        int L = rs.size();
        if (L < Q) break;
        int mini = 1e9;
        int maxi = 0;
        rep(j,Q) {
            if (j==0) mini = rs.top();
            if (j==Q-1) maxi = rs.top();
            rs.pop();
        }
        chmin(ans,maxi-mini);
        dic.emplace(B[i].second);
    }

    cout << ans << ln;
}

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

int main() {
  string n; cin >> n;
  rep(i,3) {
    if (n[i] == '1') n[i] = '9';
    else n[i] = '1';
  }
  cout << n << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();

		if(!S.contains("a")){
			System.out.println("a");
		}else if(!S.contains("b")){
			System.out.println("b");
		}else if(!S.contains("c")){
			System.out.println("c");
		}else if(!S.contains("d")){
			System.out.println("d");
		}else if(!S.contains("e")){
			System.out.println("e");
		}else if(!S.contains("f")){
			System.out.println("f");
		}else if(!S.contains("g")){
			System.out.println("g");
		}else if(!S.contains("h")){
			System.out.println("h");
		}else if(!S.contains("i")){
			System.out.println("i");
		}else if(!S.contains("j")){
			System.out.println("j");
		}else if(!S.contains("k")){
			System.out.println("k");
		}else if(!S.contains("l")){
			System.out.println("l");
		}else if(!S.contains("m")){
			System.out.println("m");
		}else if(!S.contains("n")){
			System.out.println("n");
		}else if(!S.contains("o")){
			System.out.println("o");
		}else if(!S.contains("p")){
			System.out.println("p");
		}else if(!S.contains("q")){
			System.out.println("q");
		}else if(!S.contains("r")){
			System.out.println("r");
		}else if(!S.contains("s")){
			System.out.println("s");
		}else if(!S.contains("t")){
			System.out.println("t");
		}else if(!S.contains("u")){
			System.out.println("u");
		}else if(!S.contains("v")){
			System.out.println("v");
		}else if(!S.contains("w")){
			System.out.println("w");
		}else if(!S.contains("x")){
			System.out.println("x");
		}else if(!S.contains("y")){
			System.out.println("y");
		}else if(!S.contains("z")){
			System.out.println("z");
		}else{
			System.out.println("None");
		}

		scan.close();
	}
}

Measured memory_bytes: 26180
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;

	vector<int> food(M,0);
	int K,A;
	for(int i=0; i<N; i++){
		cin >> K;
		for(int k=0; k<K; k++){
			cin >> A;
			food.at(A-1)++;
		}
	}

	int cnt=0;
	for(int m=0; m<M; m++){
		if(food.at(m)==N){
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

#define MOD 1000000007

// a^n mod m を計算する(二分累乗法:O(logn))
ll modpow(ll a, ll n) {
	ll m = MOD;
	ll x = 1;
	while(n){
		if(n & 1) x = x * a % m;
		a = a * a % m;
		n >>= 1;
	}
	return x;
}

// nCr mod m
ll nCr(ll n, ll r){
	ll m = MOD;
	ll a = 1, b = 1;
	for(ll i=1; i<=r; ++i){
		a *= n - i + 1;
		b *= i;
		a %=m;
		b %=m;
	}
	return a * modpow(b, m-2) % m;
}

int main(){
	ll N,A,B; cin>>N>>A>>B;
	ll ans = modpow(2, N) - 1;
	ans -= nCr(N, A);
	ans -= nCr(N, B);
	ans %= MOD;
	if(ans < 0L) ans += MOD;
	cout<< ans <<endl;
}

Measured memory_bytes: 256